debian-mirror-gitlab/config/initializers/fill_shards.rb

9 lines
369 B
Ruby
Raw Normal View History

2019-09-04 21:01:54 +05:30
# 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
2020-04-22 19:07:51 +05:30
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!