diff options
Diffstat (limited to 'spec/db')
-rw-r--r-- | spec/db/schema_spec.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb index 8b02cfa30ab..18f2f7b54c4 100644 --- a/spec/db/schema_spec.rb +++ b/spec/db/schema_spec.rb @@ -34,7 +34,7 @@ RSpec.describe 'Database schema' do compliance_management_frameworks: %w[group_id], commit_user_mentions: %w[commit_id], deploy_keys_projects: %w[deploy_key_id], - deployments: %w[deployable_id environment_id user_id], + deployments: %w[deployable_id user_id], draft_notes: %w[discussion_id commit_id], epics: %w[updated_by_id last_edited_by_id state_id], events: %w[target_id], @@ -56,6 +56,7 @@ RSpec.describe 'Database schema' do ldap_group_links: %w[group_id], members: %w[source_id created_by_id], merge_requests: %w[last_edited_by_id state_id], + merge_request_diff_commits: %w[commit_author_id committer_id], namespaces: %w[owner_id parent_id], notes: %w[author_id commit_id noteable_id updated_by_id resolved_by_id confirmed_by_id discussion_id], notification_settings: %w[source_id], @@ -264,6 +265,18 @@ RSpec.describe 'Database schema' do end end + context 'index names' do + it 'disallows index names with a _ccnew[0-9]* suffix' do + # During REINDEX operations, Postgres generates a temporary index with a _ccnew[0-9]* suffix + # Since indexes are being considered temporary and subject to removal if they stick around for longer. See Gitlab::Database::Reindexing. + # + # Hence we disallow adding permanent indexes with this suffix. + problematic_indexes = Gitlab::Database::PostgresIndex.match("#{Gitlab::Database::Reindexing::ReindexConcurrently::TEMPORARY_INDEX_PATTERN}$").all + + expect(problematic_indexes).to be_empty + end + end + private def retrieve_columns_name_with_jsonb |