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