Browse Source

Update schema

- drop index
- add org and user data to dpc table
pull/1766/head
Jack S 3 years ago
parent
commit
b91bdae027
  1. 12
      db/migrate/20230710100120_persist_user_and_organisation_info_on_data_protection_confirmation.rb
  2. 14
      db/migrate/20230710101532_remove_data_protection_confirmation_unique_index.rb
  3. 9
      db/schema.rb

12
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

14
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

9
db/schema.rb

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # 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 # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -52,8 +52,13 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_29_125541) do
t.string "old_org_id" t.string "old_org_id"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_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 ["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" t.index ["organisation_id"], name: "index_data_protection_confirmations_on_organisation_id"
end end

Loading…
Cancel
Save