summaryrefslogtreecommitdiff
path: root/spec/db
diff options
context:
space:
mode:
authorReuben Pereira <rpereira@gitlab.com>2019-01-07 17:55:21 +0000
committerSean McGivern <sean@gitlab.com>2019-01-07 17:55:21 +0000
commitf40b5860d76a8ea5d964260834a6e83516b0f1fd (patch)
tree2a8e92896130697178f5c989e49fa686f66ce073 /spec/db
parent549ee8ada3b59278871a89720632584bc5cc11df (diff)
downloadgitlab-ce-f40b5860d76a8ea5d964260834a6e83516b0f1fd.tar.gz
Add table and model for error tracking settings
Diffstat (limited to 'spec/db')
-rw-r--r--spec/db/schema_spec.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb
index 7c505ee0d43..897b4411055 100644
--- a/spec/db/schema_spec.rb
+++ b/spec/db/schema_spec.rb
@@ -64,6 +64,7 @@ describe 'Database schema' do
let(:indexes) { connection.indexes(table) }
let(:columns) { connection.columns(table) }
let(:foreign_keys) { connection.foreign_keys(table) }
+ let(:primary_key_column) { connection.primary_key(table) }
context 'all foreign keys' do
# for index to be effective, the FK constraint has to be at first place
@@ -71,6 +72,12 @@ describe 'Database schema' do
first_indexed_column = indexes.map(&:columns).map(&:first)
foreign_keys_columns = foreign_keys.map(&:column)
+ # Add the primary key column to the list of indexed columns because
+ # postgres and mysql both automatically create an index on the primary
+ # key. Also, the rails connection.indexes() method does not return
+ # automatically generated indexes (like the primary key index).
+ first_indexed_column = first_indexed_column.push(primary_key_column)
+
expect(first_indexed_column.uniq).to include(*foreign_keys_columns)
end
end