提交 7728ab3f 编写于 作者: S Shinya Maeda

Try to explicitly separate with postgresql and mysql for addin index

上级 b95b47b9
......@@ -6,17 +6,21 @@ class AddIndexToCiBuildsArtifactsFile < ActiveRecord::Migration
disable_ddl_transaction!
def up
return unless Gitlab::Database.postgresql?
# We add an temporary index to `ci_builds.artifacts_file` column to avoid statements timeout in legacy artifacts migrations
# This index is to be removed after we have cleaned up background migrations
# https://gitlab.com/gitlab-org/gitlab-ce/issues/46866
add_concurrent_index :ci_builds, :artifacts_file, where: "artifacts_file <> ''", length: 20
if Gitlab::Database.postgresql?
add_concurrent_index :ci_builds, :artifacts_file, where: "artifacts_file <> ''"
elsif Gitlab::Database.mysql?
add_concurrent_index :ci_builds, :artifacts_file, where: "artifacts_file <> ''", length: 20
end
end
def down
return unless Gitlab::Database.postgresql?
remove_concurrent_index :ci_builds, :artifacts_file
if Gitlab::Database.postgresql?
remove_concurrent_index :ci_builds, :artifacts_file, where: "artifacts_file <> ''"
elsif Gitlab::Database.mysql?
remove_concurrent_index :ci_builds, :artifacts_file, where: "artifacts_file <> ''", length: 20
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册