diff options
Diffstat (limited to 'db/post_migrate/20231219125907_remove_updated_by_id_column_from_vulnerabilities.rb')
-rw-r--r-- | db/post_migrate/20231219125907_remove_updated_by_id_column_from_vulnerabilities.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/db/post_migrate/20231219125907_remove_updated_by_id_column_from_vulnerabilities.rb b/db/post_migrate/20231219125907_remove_updated_by_id_column_from_vulnerabilities.rb new file mode 100644 index 00000000000..ecac9b55f4c --- /dev/null +++ b/db/post_migrate/20231219125907_remove_updated_by_id_column_from_vulnerabilities.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class RemoveUpdatedByIdColumnFromVulnerabilities < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + + milestone '16.8' + + def up + with_lock_retries do + remove_column :vulnerabilities, :updated_by_id + end + end + + def down + add_column :vulnerabilities, :updated_by_id, :bigint unless column_exists?(:vulnerabilities, :updated_by_id) + + # Add back index and constraint that were dropped in `up` + add_concurrent_index(:vulnerabilities, :updated_by_id) + add_concurrent_foreign_key(:vulnerabilities, :users, column: :updated_by_id, on_delete: :nullify) + end +end |