Skip to content

Commit 88d0d59

Browse files
authored
Professional membership migration (#8736)
1 parent 5df69f8 commit 88d0d59

6 files changed

Lines changed: 17 additions & 41 deletions

.database_consistency.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,3 @@ ProfileEmployment:
102102
jobseeker_profile:
103103
ColumnPresenceChecker:
104104
enabled: false
105-
106-
# This now no longer points at 2 tables, but we can't remove the column yet
107-
ProfessionalBodyMembership:
108-
job_application:
109-
ColumnPresenceChecker:
110-
enabled: false

config/analytics.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,6 @@ shared:
587587
- membership_number
588588
- year_membership_obtained
589589
- exam_taken
590-
- jobseeker_profile_id
591590
- job_application_id
592591
:self_disclosure_requests:
593592
- id
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class ProfessionalMembershipJobApplication < ActiveRecord::Migration[8.0]
2+
disable_ddl_transaction!
3+
4+
def change
5+
remove_index :professional_body_memberships, :jobseeker_profile_id, algorithm: :concurrently
6+
safety_assured { remove_column :professional_body_memberships, :jobseeker_profile_id, :uuid }
7+
8+
add_not_null_constraint :professional_body_memberships, :job_application_id, name: "professional_body_memberships_job_application_id_null", validate: false
9+
# You can use `validate_constraint_in_background` if you have a very large table
10+
# and want to validate the constraint using background schema migrations.
11+
validate_not_null_constraint :professional_body_memberships, :job_application_id, name: "professional_body_memberships_job_application_id_null"
12+
13+
change_column_null :professional_body_memberships, :job_application_id, false
14+
remove_check_constraint :professional_body_memberships, name: "professional_body_memberships_job_application_id_null"
15+
end
16+
end

db/schema.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -620,10 +620,8 @@
620620
t.string "membership_number"
621621
t.integer "year_membership_obtained"
622622
t.boolean "exam_taken", default: false, null: false
623-
t.uuid "jobseeker_profile_id"
624-
t.uuid "job_application_id"
623+
t.uuid "job_application_id", null: false
625624
t.index ["job_application_id"], name: "index_professional_body_memberships_on_job_application_id"
626-
t.index ["jobseeker_profile_id"], name: "index_professional_body_memberships_on_jobseeker_profile_id"
627625
end
628626

629627
create_table "publisher_ats_api_clients", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
@@ -1027,7 +1025,6 @@
10271025
add_foreign_key "personal_details", "jobseeker_profiles"
10281026
add_foreign_key "pre_employment_check_sets", "job_applications"
10291027
add_foreign_key "professional_body_memberships", "job_applications"
1030-
add_foreign_key "professional_body_memberships", "jobseeker_profiles"
10311028
add_foreign_key "publisher_preferences", "organisations"
10321029
add_foreign_key "publisher_preferences", "publishers"
10331030
add_foreign_key "qualification_results", "qualifications"

lib/tasks/remove_profile_professional_memberships.rake

Lines changed: 0 additions & 8 deletions
This file was deleted.

spec/tasks/remove_profile_professional_memberships_spec.rb

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)