diff options
Diffstat (limited to 'db/migrate/20210420120734_initialize_conversion_of_ci_job_artifacts_to_bigint.rb')
-rw-r--r-- | db/migrate/20210420120734_initialize_conversion_of_ci_job_artifacts_to_bigint.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/db/migrate/20210420120734_initialize_conversion_of_ci_job_artifacts_to_bigint.rb b/db/migrate/20210420120734_initialize_conversion_of_ci_job_artifacts_to_bigint.rb new file mode 100644 index 00000000000..715fe8b830a --- /dev/null +++ b/db/migrate/20210420120734_initialize_conversion_of_ci_job_artifacts_to_bigint.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class InitializeConversionOfCiJobArtifactsToBigint < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + TABLE = :ci_job_artifacts + COLUMNS = %i(id job_id) + TARGET_COLUMNS = COLUMNS.map { |col| "#{col}_convert_to_bigint" } + + def up + initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end + + def down + trigger_name = rename_trigger_name(TABLE, COLUMNS, TARGET_COLUMNS) + remove_rename_triggers_for_postgresql TABLE, trigger_name + + TARGET_COLUMNS.each do |column| + remove_column TABLE, column + end + end +end |