diff options
Diffstat (limited to 'db/post_migrate/20200608212030_lock_version_cleanup_for_epics.rb')
-rw-r--r-- | db/post_migrate/20200608212030_lock_version_cleanup_for_epics.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/db/post_migrate/20200608212030_lock_version_cleanup_for_epics.rb b/db/post_migrate/20200608212030_lock_version_cleanup_for_epics.rb new file mode 100644 index 00000000000..aafa6a83200 --- /dev/null +++ b/db/post_migrate/20200608212030_lock_version_cleanup_for_epics.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class LockVersionCleanupForEpics < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + validate_not_null_constraint :epics, :lock_version + remove_concurrent_index_by_name :epics, name: 'index_epics_on_id' + end + + def down + add_concurrent_index :epics, :id, where: "lock_version IS NULL", name: 'index_epics_on_id' + end +end |