Commit f607b1f9 authored by Rémy Coutable's avatar Rémy Coutable

Make sure the shards table has its index created before populating it

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent bc1f926e
# The `table_exists?` check is needed because during our migration rollback testing, # The `table_exists?` check is needed because during our migration rollback testing,
# `Shard.connected?` could be cached and return true even though the table doesn't exist # `Shard.connected?` could be cached and return true even though the table doesn't exist
if Shard.connected? && Shard.table_exists? && !Gitlab::Database.read_only? return unless Shard.connected?
Shard.populate! return unless Shard.table_exists?
end return unless Shard.connection.index_exists?(:shards, :name, unique: true)
return if Gitlab::Database.read_only?
Shard.populate!
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment