Browse Source

Add organisation_name_changes table

pull/3054/head
Manny Dinssa 2 weeks ago
parent
commit
f782340259
  1. 15
      db/migrate/20250416111741_create_organisation_name_changes.rb
  2. 14
      db/schema.rb

15
db/migrate/20250416111741_create_organisation_name_changes.rb

@ -0,0 +1,15 @@
class CreateOrganisationNameChanges < ActiveRecord::Migration[7.0]
def change
create_table :organisation_name_changes do |t|
t.references :organisation, null: false, foreign_key: true
t.string :name, null: false
t.date :startdate, null: false
t.date :discarded_at
t.integer :change_type
t.timestamps
end
add_index :organisation_name_changes, %i[organisation_id startdate], unique: true, name: "index_org_name_changes_on_org_id_and_startdate"
end
end

14
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_03_05_092900) do
ActiveRecord::Schema[7.2].define(version: 2025_04_16_111741) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -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.date "startdate", null: false
t.date "discarded_at"
t.integer "change_type"
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"], 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"

Loading…
Cancel
Save