From 95ce3610db0994ce4214bdaabacd9e9f7efee019 Mon Sep 17 00:00:00 2001 From: Kat Date: Thu, 4 Apr 2024 08:42:04 +0100 Subject: [PATCH] Add and set assigned to fields --- db/migrate/20240404072714_add_assigned_to.rb | 9 +++++++++ db/schema.rb | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20240404072714_add_assigned_to.rb diff --git a/db/migrate/20240404072714_add_assigned_to.rb b/db/migrate/20240404072714_add_assigned_to.rb new file mode 100644 index 000000000..88569d1e3 --- /dev/null +++ b/db/migrate/20240404072714_add_assigned_to.rb @@ -0,0 +1,9 @@ +class AddAssignedTo < ActiveRecord::Migration[7.0] + def change + add_column :lettings_logs, :assigned_to_id, :integer + add_column :sales_logs, :assigned_to_id, :integer + + LettingsLog.update_all("assigned_to_id=created_by_id") + SalesLog.update_all("assigned_to_id=created_by_id") + end +end diff --git a/db/schema.rb b/db/schema.rb index cca8b7f5c..c3997c6a1 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_03_19_122706) do +ActiveRecord::Schema[7.0].define(version: 2024_04_04_072714) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -320,6 +320,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_03_19_122706) do t.string "la_as_entered" t.integer "partner_under_16_value_check" t.integer "multiple_partners_value_check" + t.integer "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" @@ -686,6 +687,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_03_19_122706) do t.string "la_as_entered" t.integer "partner_under_16_value_check" t.integer "multiple_partners_value_check" + t.integer "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"