diff --git a/db/migrate/20230710100120_persist_user_and_organisation_info_on_data_protection_confirmation.rb b/db/migrate/20230710100120_persist_user_and_organisation_info_on_data_protection_confirmation.rb new file mode 100644 index 000000000..c721d4b62 --- /dev/null +++ b/db/migrate/20230710100120_persist_user_and_organisation_info_on_data_protection_confirmation.rb @@ -0,0 +1,12 @@ +class PersistUserAndOrganisationInfoOnDataProtectionConfirmation < ActiveRecord::Migration[7.0] + def change + change_table :data_protection_confirmations, bulk: true do |t| + t.column :signed_at, :datetime + t.column :organisation_name, :string + t.column :organisation_address, :string + t.column :organisation_phone_number, :string + t.column :data_protection_officer_email, :string + t.column :data_protection_officer_name, :string + end + end +end diff --git a/db/migrate/20230710101532_remove_data_protection_confirmation_unique_index.rb b/db/migrate/20230710101532_remove_data_protection_confirmation_unique_index.rb new file mode 100644 index 000000000..5b6203730 --- /dev/null +++ b/db/migrate/20230710101532_remove_data_protection_confirmation_unique_index.rb @@ -0,0 +1,14 @@ +class RemoveDataProtectionConfirmationUniqueIndex < ActiveRecord::Migration[7.0] + def up + remove_index :data_protection_confirmations, + %i[organisation_id data_protection_officer_id confirmed], + unique: true + end + + def down + add_index :data_protection_confirmations, + %i[organisation_id data_protection_officer_id confirmed], + unique: true, + name: "data_protection_confirmations_unique" + end +end diff --git a/db/schema.rb b/db/schema.rb index 3a47ae8aa..111396ef3 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: 2023_06_29_125541) do +ActiveRecord::Schema[7.0].define(version: 2023_07_10_101532) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -52,8 +52,13 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_29_125541) do t.string "old_org_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.datetime "signed_at" + t.string "organisation_name" + t.string "organisation_address" + t.string "organisation_phone_number" + t.string "data_protection_officer_email" + t.string "data_protection_officer_name" t.index ["data_protection_officer_id"], name: "dpo_user_id" - t.index ["organisation_id", "data_protection_officer_id", "confirmed"], name: "data_protection_confirmations_unique", unique: true t.index ["organisation_id"], name: "index_data_protection_confirmations_on_organisation_id" end