Commit a15ec186 authored by Stan Hu's avatar Stan Hu

Merge branch 'ab/check-schema-in-initializer' into 'master'

Add explicit schema version check

See merge request gitlab-org/gitlab!32524
parents e018b6c8 cc8ba45b
# The `table_exists?` check is needed because during our migration rollback testing,
# The explicit schema version check is needed because during our migration rollback testing,
# `Shard.connected?` could be cached and return true even though the table doesn't exist
return unless Shard.connected?
return unless Shard.table_exists?
return unless Shard.connection.index_exists?(:shards, :name, unique: true)
return unless ActiveRecord::Migrator.current_version >= 20190402150158
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