From e7aa9665696ca25f8d6a8b5bd1843cbc0cf3c3a0 Mon Sep 17 00:00:00 2001 From: Samuel Date: Thu, 8 May 2025 16:12:34 +0100 Subject: [PATCH] Add a new column to track if a user has specified an organisation or not this will be used to disable validations on the sale date until the organisation has been specifically picked by the user, not just the default value --- ...150338_add_selected_organisation_to_sales_logs.rb | 5 +++++ db/schema.rb | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20250508150338_add_selected_organisation_to_sales_logs.rb diff --git a/db/migrate/20250508150338_add_selected_organisation_to_sales_logs.rb b/db/migrate/20250508150338_add_selected_organisation_to_sales_logs.rb new file mode 100644 index 000000000..09570aa83 --- /dev/null +++ b/db/migrate/20250508150338_add_selected_organisation_to_sales_logs.rb @@ -0,0 +1,5 @@ +class AddSelectedOrganisationToSalesLogs < ActiveRecord::Migration[7.2] + def change + add_column :sales_logs, :has_selected_organisation, :boolean, default: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 833703534..109fb839c 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.2].define(version: 2025_04_16_111741) do +ActiveRecord::Schema[7.2].define(version: 2025_05_08_150338) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -373,8 +373,8 @@ ActiveRecord::Schema[7.2].define(version: 2025_04_16_111741) do t.integer "partner_under_16_value_check" t.integer "multiple_partners_value_check" t.bigint "created_by_id" - t.integer "referral_type" t.boolean "manual_address_entry_selected", default: false + t.integer "referral_type" 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" @@ -504,7 +504,7 @@ ActiveRecord::Schema[7.2].define(version: 2025_04_16_111741) do t.date "discarded_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.index ["organisation_id", "startdate"], name: "index_org_name_changes_on_org_id_and_startdate", unique: true + t.index ["organisation_id", "startdate", "discarded_at"], name: "index_org_name_changes_on_org_id_startdate_discarded_at", unique: true t.index ["organisation_id"], name: "index_organisation_name_changes_on_organisation_id" end @@ -559,6 +559,10 @@ ActiveRecord::Schema[7.2].define(version: 2025_04_16_111741) do t.datetime "available_from" t.datetime "discarded_at" t.datetime "schemes_deduplicated_at" + t.integer "profit_status" + t.boolean "group_member" + t.integer "group_member_id" + t.integer "group" t.index ["absorbing_organisation_id"], name: "index_organisations_on_absorbing_organisation_id" t.index ["name"], name: "index_organisations_on_name", unique: true t.index ["old_visible_id"], name: "index_organisations_on_old_visible_id", unique: true @@ -783,6 +787,7 @@ ActiveRecord::Schema[7.2].define(version: 2025_04_16_111741) do t.datetime "lasttransaction" t.datetime "initialpurchase" t.boolean "manual_address_entry_selected", default: false + t.boolean "has_selected_organisation", default: true 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" @@ -890,6 +895,7 @@ ActiveRecord::Schema[7.2].define(version: 2025_04_16_111741) do add_foreign_key "local_authority_links", "local_authorities" add_foreign_key "local_authority_links", "local_authorities", column: "linked_local_authority_id" add_foreign_key "locations", "schemes" + add_foreign_key "organisation_name_changes", "organisations" add_foreign_key "organisation_relationships", "organisations", column: "child_organisation_id" add_foreign_key "organisation_relationships", "organisations", column: "parent_organisation_id" add_foreign_key "organisations", "organisations", column: "absorbing_organisation_id"