diff options
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/fill_shards.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/config/initializers/fill_shards.rb b/config/initializers/fill_shards.rb index cad662e12f3..40a9a271953 100644 --- a/config/initializers/fill_shards.rb +++ b/config/initializers/fill_shards.rb @@ -1,5 +1,8 @@ # 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 -if Shard.connected? && Shard.table_exists? && !Gitlab::Database.read_only? - Shard.populate! -end +return unless Shard.connected? +return unless Shard.table_exists? +return unless Shard.connection.index_exists?(:shards, :name, unique: true) +return if Gitlab::Database.read_only? + +Shard.populate! |