Skip to content
Snippets Groups Projects

Finalize ci_job_artifacts conversion to bigint

Merged Alex Ives requested to merge 325615/finalize_ci_job_artifacts_bigint into master
Compare and Show latest version
1 file
+ 5
5
Compare changes
  • Side-by-side
  • Inline
@@ -48,8 +48,8 @@ def swap
name: fk_artifacts_archive_id_tmp,
on_delete: :nullify
# Add a FK on `project_pages_metadata(artifacts_archive_id)` to `id_convert_to_bigint`, the old FK (fk_69366a119e)
# will be removed when ci_job_artifacts_pkey constraint is droppped.
# Add a FK on `job_id_convert_to_bigint` to `ci_builds(id)`, the old FK (fk_rails_c5137cb2c1)
# is removed below since it won't be dropped automatically.
fk_ci_builds_job_id = concurrent_foreign_key_name(TABLE_NAME, :job_id, prefix: 'fk_rails_')
fk_ci_builds_job_id_tmp = "#{fk_ci_builds_job_id}_tmp"
add_concurrent_foreign_key TABLE_NAME, :ci_builds,
@@ -99,12 +99,12 @@ def swap
execute 'DROP INDEX index_ci_job_artifacts_on_job_id_and_file_type'
rename_index TABLE_NAME, 'index_ci_job_artifacts_on_job_id_and_file_type_bigint', 'index_ci_job_artifacts_on_job_id_and_file_type'
# Remove the old foreign key
# Remove the old foreign key from job_id -> ci_builds(id)
remove_check_constraint(TABLE_NAME, fk_ci_builds_job_id)
# Change the name of the temporary FK
# Change the name of the temporary FK for project_pages_metadata(artifacts_archive_id) -> id
rename_constraint(:project_pages_metadata, fk_artifacts_archive_id_tmp, fk_artifacts_archive_id)
# Change the name of the temporary FK
# Change the name of the temporary FK for job_id -> ci_builds(id)
rename_constraint(TABLE_NAME, fk_ci_builds_job_id_tmp, fk_ci_builds_job_id)
end
end
Loading