From 37eaf5c23364abfd5e5e8a25edcac17ad8913009 Mon Sep 17 00:00:00 2001 From: Rebecca Tolmach <10993987+rmtolmach@users.noreply.github.com> Date: Wed, 10 Apr 2024 18:30:38 -0400 Subject: [PATCH] Revert "Create attorneys, claims_agents, representatives, organizations, and organizations_representatives tables" (#16285) --- .../20240405184242_create_orgs_reps_tables.rb | 164 ------------------ ...rganizations_accredited_representatives.rb | 10 ++ ...rganizations_accredited_representatives.rb | 7 + ...410212508_drop_accredited_organizations.rb | 7 + ...0212528_drop_accredited_representatives.rb | 7 + ...410212702_drop_accredited_claims_agents.rb | 7 + ...0240410212727_drop_accredited_attorneys.rb | 7 + db/schema.rb | 143 +-------------- 8 files changed, 46 insertions(+), 306 deletions(-) delete mode 100644 db/migrate/20240405184242_create_orgs_reps_tables.rb create mode 100644 db/migrate/20240410212414_remove_fkeys_from_accredited_organizations_accredited_representatives.rb create mode 100644 db/migrate/20240410212440_drop_accredited_organizations_accredited_representatives.rb create mode 100644 db/migrate/20240410212508_drop_accredited_organizations.rb create mode 100644 db/migrate/20240410212528_drop_accredited_representatives.rb create mode 100644 db/migrate/20240410212702_drop_accredited_claims_agents.rb create mode 100644 db/migrate/20240410212727_drop_accredited_attorneys.rb diff --git a/db/migrate/20240405184242_create_orgs_reps_tables.rb b/db/migrate/20240405184242_create_orgs_reps_tables.rb deleted file mode 100644 index 5e8e2cb011c..00000000000 --- a/db/migrate/20240405184242_create_orgs_reps_tables.rb +++ /dev/null @@ -1,164 +0,0 @@ -# frozen_string_literal: true - -class CreateOrgsRepsTables < ActiveRecord::Migration[7.1] - disable_ddl_transaction! - # rubocop:disable Metrics/MethodLength - # rubocop:disable Metrics/AbcSize - def change - create_table :accredited_attorneys, id: :uuid do |t| - t.string :registration_number, null: false - t.string :poa_code, limit: 3, null: false - t.string :first_name - t.string :middle_initial - t.string :last_name - t.string :full_name - t.string :email - t.string :phone - t.string :address_type - t.string :address_line1 - t.string :address_line2 - t.string :address_line3 - t.string :city - t.string :country_code_iso3 - t.string :country_name - t.string :county_name - t.string :county_code - t.string :international_postal_code - t.string :province - t.string :state_code - t.string :zip_code - t.string :zip_suffix - t.jsonb :raw_address - t.float :lat - t.float :long - t.geography :location, limit: { srid: 4326, type: 'st_point', geographic: true } - t.timestamps - end - add_index :accredited_attorneys, :registration_number, unique: true - add_index :accredited_attorneys, :poa_code, unique: true - add_index :accredited_attorneys, :full_name - add_index :accredited_attorneys, :location, using: :gist - - create_table :accredited_claims_agents, id: :uuid do |t| - t.string :registration_number, null: false - t.string :poa_code, limit: 3, null: false - t.string :first_name - t.string :middle_initial - t.string :last_name - t.string :full_name - t.string :email - t.string :phone - t.string :address_type - t.string :address_line1 - t.string :address_line2 - t.string :address_line3 - t.string :city - t.string :country_code_iso3 - t.string :country_name - t.string :county_name - t.string :county_code - t.string :international_postal_code - t.string :province - t.string :state_code - t.string :zip_code - t.string :zip_suffix - t.jsonb :raw_address - t.float :lat - t.float :long - t.geography :location, limit: { srid: 4326, type: 'st_point', geographic: true } - t.timestamps - end - add_index :accredited_claims_agents, :registration_number, unique: true - add_index :accredited_claims_agents, :poa_code, unique: true - add_index :accredited_claims_agents, :full_name - add_index :accredited_claims_agents, :location, using: :gist - - create_table :accredited_representatives, id: :uuid do |t| - t.string :registration_number, null: false - t.string :first_name - t.string :middle_initial - t.string :last_name - t.string :full_name - t.string :email - t.string :phone - t.string :address_type - t.string :address_line1 - t.string :address_line2 - t.string :address_line3 - t.string :city - t.string :country_code_iso3 - t.string :country_name - t.string :county_name - t.string :county_code - t.string :international_postal_code - t.string :province - t.string :state_code - t.string :zip_code - t.string :zip_suffix - t.jsonb :raw_address - t.float :lat - t.float :long - t.geography :location, limit: { srid: 4326, type: 'st_point', geographic: true } - t.timestamps - end - add_index :accredited_representatives, :registration_number, unique: true - add_index :accredited_representatives, :full_name - add_index :accredited_representatives, :location, using: :gist - - create_table :accredited_organizations, id: :uuid do |t| - t.string :poa_code, limit: 3, null: false - t.string :name - t.string :phone - t.string :address_type - t.string :address_line1 - t.string :address_line2 - t.string :address_line3 - t.string :city - t.string :country_code_iso3 - t.string :country_name - t.string :county_name - t.string :county_code - t.string :international_postal_code - t.string :province - t.string :state_code - t.string :zip_code - t.string :zip_suffix - t.jsonb :raw_address - t.float :lat - t.float :long - t.geography :location, limit: { srid: 4326, type: 'st_point', geographic: true } - t.timestamps - end - add_index :accredited_organizations, :location, using: :gist - add_index :accredited_organizations, :name - - # Use create_table (instead of create_join_table) to explicitly define the table and its columns - create_table :accredited_organizations_accredited_representatives, id: false do |t| - t.uuid :accredited_organization_id, null: false - t.uuid :accredited_representative_id, null: false - end - - # Add the indexes - add_index :accredited_organizations_accredited_representatives, :accredited_organization_id - add_index :accredited_organizations_accredited_representatives, :accredited_representative_id - add_index :accredited_organizations_accredited_representatives, - [:accredited_organization_id, :accredited_representative_id], - unique: true, - name: 'index_organization_representatives_on_rep_and_org', - algorithm: :concurrently - - # Add the foreign keys - add_foreign_key :accredited_organizations_accredited_representatives, :accredited_representatives, - column: :accredited_representative_id, - validate: false - add_foreign_key :accredited_organizations_accredited_representatives, :accredited_organizations, - column: :accredited_organization_id, - validate: false - - # Validate the foreign keys - validate_foreign_key :accredited_organizations_accredited_representatives, :accredited_representatives - validate_foreign_key :accredited_organizations_accredited_representatives, :accredited_organizations - end - # rubocop:enable Metrics/AbcSize - # rubocop:enable Metrics/MethodLength -end diff --git a/db/migrate/20240410212414_remove_fkeys_from_accredited_organizations_accredited_representatives.rb b/db/migrate/20240410212414_remove_fkeys_from_accredited_organizations_accredited_representatives.rb new file mode 100644 index 00000000000..e117c8103cd --- /dev/null +++ b/db/migrate/20240410212414_remove_fkeys_from_accredited_organizations_accredited_representatives.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class RemoveFkeysFromAccreditedOrganizationsAccreditedRepresentatives < ActiveRecord::Migration[7.1] + def change + remove_foreign_key :accredited_organizations_accredited_representatives, :accredited_representatives, + column: :accredited_representative_id, if_exists: true + remove_foreign_key :accredited_organizations_accredited_representatives, :accredited_organizations, + column: :accredited_organization_id, if_exists: true + end +end diff --git a/db/migrate/20240410212440_drop_accredited_organizations_accredited_representatives.rb b/db/migrate/20240410212440_drop_accredited_organizations_accredited_representatives.rb new file mode 100644 index 00000000000..0eb2cb0c4bc --- /dev/null +++ b/db/migrate/20240410212440_drop_accredited_organizations_accredited_representatives.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class DropAccreditedOrganizationsAccreditedRepresentatives < ActiveRecord::Migration[7.1] + def change + drop_table :accredited_organizations_accredited_representatives, if_exists: true # rubocop:disable Rails/ReversibleMigration + end +end diff --git a/db/migrate/20240410212508_drop_accredited_organizations.rb b/db/migrate/20240410212508_drop_accredited_organizations.rb new file mode 100644 index 00000000000..3cce9757e53 --- /dev/null +++ b/db/migrate/20240410212508_drop_accredited_organizations.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class DropAccreditedOrganizations < ActiveRecord::Migration[7.1] + def change + drop_table :accredited_organizations, if_exists: true # rubocop:disable Rails/ReversibleMigration + end +end diff --git a/db/migrate/20240410212528_drop_accredited_representatives.rb b/db/migrate/20240410212528_drop_accredited_representatives.rb new file mode 100644 index 00000000000..e557818c486 --- /dev/null +++ b/db/migrate/20240410212528_drop_accredited_representatives.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class DropAccreditedRepresentatives < ActiveRecord::Migration[7.1] + def change + drop_table :accredited_representatives, if_exists: true # rubocop:disable Rails/ReversibleMigration + end +end diff --git a/db/migrate/20240410212702_drop_accredited_claims_agents.rb b/db/migrate/20240410212702_drop_accredited_claims_agents.rb new file mode 100644 index 00000000000..0bfd4f06741 --- /dev/null +++ b/db/migrate/20240410212702_drop_accredited_claims_agents.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class DropAccreditedClaimsAgents < ActiveRecord::Migration[7.1] + def change + drop_table :accredited_claims_agents, if_exists: true # rubocop:disable Rails/ReversibleMigration + end +end diff --git a/db/migrate/20240410212727_drop_accredited_attorneys.rb b/db/migrate/20240410212727_drop_accredited_attorneys.rb new file mode 100644 index 00000000000..73ab0e0273b --- /dev/null +++ b/db/migrate/20240410212727_drop_accredited_attorneys.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class DropAccreditedAttorneys < ActiveRecord::Migration[7.1] + def change + drop_table :accredited_attorneys, if_exists: true # rubocop:disable Rails/ReversibleMigration + end +end diff --git a/db/schema.rb b/db/schema.rb index 8e301b213f5..40dce50a476 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.1].define(version: 2024_04_08_152120) do +ActiveRecord::Schema[7.1].define(version: 2024_04_10_212727) do # These are extensions that must be enabled in order to support this database enable_extension "btree_gin" enable_extension "pg_stat_statements" @@ -53,145 +53,6 @@ t.index ["uuid"], name: "index_accounts_on_uuid", unique: true end - create_table "accredited_attorneys", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| - t.string "registration_number", null: false - t.string "poa_code", limit: 3, null: false - t.string "first_name" - t.string "middle_initial" - t.string "last_name" - t.string "full_name" - t.string "email" - t.string "phone" - t.string "address_type" - t.string "address_line1" - t.string "address_line2" - t.string "address_line3" - t.string "city" - t.string "country_code_iso3" - t.string "country_name" - t.string "county_name" - t.string "county_code" - t.string "international_postal_code" - t.string "province" - t.string "state_code" - t.string "zip_code" - t.string "zip_suffix" - t.jsonb "raw_address" - t.float "lat" - t.float "long" - t.geography "location", limit: {:srid=>4326, :type=>"st_point", :geographic=>true} - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["full_name"], name: "index_accredited_attorneys_on_full_name" - t.index ["location"], name: "index_accredited_attorneys_on_location", using: :gist - t.index ["poa_code"], name: "index_accredited_attorneys_on_poa_code", unique: true - t.index ["registration_number"], name: "index_accredited_attorneys_on_registration_number", unique: true - end - - create_table "accredited_claims_agents", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| - t.string "registration_number", null: false - t.string "poa_code", limit: 3, null: false - t.string "first_name" - t.string "middle_initial" - t.string "last_name" - t.string "full_name" - t.string "email" - t.string "phone" - t.string "address_type" - t.string "address_line1" - t.string "address_line2" - t.string "address_line3" - t.string "city" - t.string "country_code_iso3" - t.string "country_name" - t.string "county_name" - t.string "county_code" - t.string "international_postal_code" - t.string "province" - t.string "state_code" - t.string "zip_code" - t.string "zip_suffix" - t.jsonb "raw_address" - t.float "lat" - t.float "long" - t.geography "location", limit: {:srid=>4326, :type=>"st_point", :geographic=>true} - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["full_name"], name: "index_accredited_claims_agents_on_full_name" - t.index ["location"], name: "index_accredited_claims_agents_on_location", using: :gist - t.index ["poa_code"], name: "index_accredited_claims_agents_on_poa_code", unique: true - t.index ["registration_number"], name: "index_accredited_claims_agents_on_registration_number", unique: true - end - - create_table "accredited_organizations", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| - t.string "poa_code", limit: 3, null: false - t.string "name" - t.string "phone" - t.string "address_type" - t.string "address_line1" - t.string "address_line2" - t.string "address_line3" - t.string "city" - t.string "country_code_iso3" - t.string "country_name" - t.string "county_name" - t.string "county_code" - t.string "international_postal_code" - t.string "province" - t.string "state_code" - t.string "zip_code" - t.string "zip_suffix" - t.jsonb "raw_address" - t.float "lat" - t.float "long" - t.geography "location", limit: {:srid=>4326, :type=>"st_point", :geographic=>true} - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["location"], name: "index_accredited_organizations_on_location", using: :gist - t.index ["name"], name: "index_accredited_organizations_on_name" - end - - create_table "accredited_organizations_accredited_representatives", id: false, force: :cascade do |t| - t.uuid "accredited_organization_id", null: false - t.uuid "accredited_representative_id", null: false - t.index ["accredited_organization_id", "accredited_representative_id"], name: "index_organization_representatives_on_rep_and_org", unique: true - t.index ["accredited_organization_id"], name: "idx_on_accredited_organization_id_4df677e34d" - t.index ["accredited_representative_id"], name: "idx_on_accredited_representative_id_c58ba2a35b" - end - - create_table "accredited_representatives", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| - t.string "registration_number", null: false - t.string "first_name" - t.string "middle_initial" - t.string "last_name" - t.string "full_name" - t.string "email" - t.string "phone" - t.string "address_type" - t.string "address_line1" - t.string "address_line2" - t.string "address_line3" - t.string "city" - t.string "country_code_iso3" - t.string "country_name" - t.string "county_name" - t.string "county_code" - t.string "international_postal_code" - t.string "province" - t.string "state_code" - t.string "zip_code" - t.string "zip_suffix" - t.jsonb "raw_address" - t.float "lat" - t.float "long" - t.geography "location", limit: {:srid=>4326, :type=>"st_point", :geographic=>true} - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["full_name"], name: "index_accredited_representatives_on_full_name" - t.index ["location"], name: "index_accredited_representatives_on_location", using: :gist - t.index ["registration_number"], name: "index_accredited_representatives_on_registration_number", unique: true - end - create_table "active_storage_attachments", force: :cascade do |t| t.string "name", null: false t.string "record_type", null: false @@ -1563,8 +1424,6 @@ end add_foreign_key "account_login_stats", "accounts" - add_foreign_key "accredited_organizations_accredited_representatives", "accredited_organizations" - add_foreign_key "accredited_organizations_accredited_representatives", "accredited_representatives" add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id" add_foreign_key "appeal_submissions", "user_accounts"