diff --git a/db/migrate/20240404074651_add_assigned_to_index.rb b/db/migrate/20240404074651_add_assigned_to_index.rb new file mode 100644 index 000000000..2f39465a6 --- /dev/null +++ b/db/migrate/20240404074651_add_assigned_to_index.rb @@ -0,0 +1,8 @@ +class AddAssignedToIndex < ActiveRecord::Migration[7.0] + def change + remove_index :sales_logs, name: "index_sales_logs_on_created_by_id", column: :created_by_id + remove_index :lettings_logs, name: "index_lettings_logs_on_created_by_id", column: :created_by_id + add_index :sales_logs, :assigned_to_id + add_index :lettings_logs, :assigned_to_id + end +end diff --git a/db/schema.rb b/db/schema.rb index c3997c6a1..03a1a7c9a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_04_04_072714) do +ActiveRecord::Schema[7.0].define(version: 2024_04_04_074651) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -270,7 +270,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_04_072714) do t.integer "irproduct" t.string "old_id" t.integer "joint" - t.bigint "created_by_id" t.integer "retirement_value_check" t.integer "tshortfall_known" t.integer "sheltered" @@ -321,8 +320,9 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_04_072714) do t.integer "partner_under_16_value_check" t.integer "multiple_partners_value_check" t.integer "assigned_to_id" + t.bigint "created_by_id" + t.index ["assigned_to_id"], name: "index_lettings_logs_on_assigned_to_id" t.index ["bulk_upload_id"], name: "index_lettings_logs_on_bulk_upload_id" - t.index ["created_by_id"], name: "index_lettings_logs_on_created_by_id" t.index ["location_id"], name: "index_lettings_logs_on_location_id" t.index ["managing_organisation_id"], name: "index_lettings_logs_on_managing_organisation_id" t.index ["old_id"], name: "index_lettings_logs_on_old_id", unique: true @@ -496,7 +496,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_04_072714) do t.datetime "created_at", null: false t.datetime "updated_at", null: false t.bigint "owning_organisation_id" - t.bigint "created_by_id" t.string "purchid" t.integer "type" t.integer "ownershipsch" @@ -688,8 +687,9 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_04_072714) do t.integer "partner_under_16_value_check" t.integer "multiple_partners_value_check" t.integer "assigned_to_id" + t.bigint "created_by_id" + t.index ["assigned_to_id"], name: "index_sales_logs_on_assigned_to_id" t.index ["bulk_upload_id"], name: "index_sales_logs_on_bulk_upload_id" - t.index ["created_by_id"], name: "index_sales_logs_on_created_by_id" t.index ["managing_organisation_id"], name: "index_sales_logs_on_managing_organisation_id" t.index ["old_id"], name: "index_sales_logs_on_old_id", unique: true t.index ["owning_organisation_id"], name: "index_sales_logs_on_owning_organisation_id"