diff --git a/db/migrate/20250409113321_create_organisation_name_changes.rb b/db/migrate/20250409113321_create_organisation_name_changes.rb new file mode 100644 index 000000000..57cc91965 --- /dev/null +++ b/db/migrate/20250409113321_create_organisation_name_changes.rb @@ -0,0 +1,15 @@ +class CreateOrganisationNameChanges < ActiveRecord::Migration[7.2] + def change + create_table :organisation_name_changes do |t| + t.references :organisation, null: false, foreign_key: true + t.string :name, null: false + t.string :change_type + t.datetime :change_date, null: false + t.datetime :discarded_at + + t.timestamps + end + + add_index :organisation_name_changes, %i[organisation_id change_date], unique: true, name: "index_org_name_changes_on_org_id_and_change_date" + end +end diff --git a/db/schema.rb b/db/schema.rb index e29560461..705d02bdf 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -497,6 +497,18 @@ ActiveRecord::Schema[7.2].define(version: 2025_03_05_092900) do t.boolean "show_additional_page" end + create_table "organisation_name_changes", force: :cascade do |t| + t.bigint "organisation_id", null: false + t.string "name", null: false + t.string "change_type" + t.datetime "change_date", null: false + t.datetime "discarded_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["organisation_id", "change_date"], name: "index_org_name_changes_on_org_id_and_change_date", unique: true + t.index ["organisation_id"], name: "index_organisation_name_changes_on_organisation_id" + end + create_table "organisation_relationships", force: :cascade do |t| t.integer "child_organisation_id" t.integer "parent_organisation_id"