From 163e9f99ab29524bca204fbd0d0aabc1a1813e4a Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon <grzesiek.bizon@gmail.com> Date: Thu, 6 Apr 2017 12:25:09 +0200 Subject: [PATCH] Fix indexes in container repositories table --- db/migrate/20170322013926_create_container_repository.rb | 3 +-- spec/models/container_repository_spec.rb | 7 ------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/db/migrate/20170322013926_create_container_repository.rb b/db/migrate/20170322013926_create_container_repository.rb index 32eba3903b1..91540bc88bd 100644 --- a/db/migrate/20170322013926_create_container_repository.rb +++ b/db/migrate/20170322013926_create_container_repository.rb @@ -5,13 +5,12 @@ class CreateContainerRepository < ActiveRecord::Migration def change create_table :container_repositories do |t| - t.references :project, foreign_key: true, null: false + t.references :project, foreign_key: true, index: true, null: false t.string :name, null: false t.timestamps null: false end - add_index :container_repositories, :project_id add_index :container_repositories, [:project_id, :name], unique: true end end diff --git a/spec/models/container_repository_spec.rb b/spec/models/container_repository_spec.rb index 3e6082ec326..f7ee0b57072 100644 --- a/spec/models/container_repository_spec.rb +++ b/spec/models/container_repository_spec.rb @@ -21,13 +21,6 @@ describe ContainerRepository do headers: { 'Content-Type' => 'application/json' }) end - describe 'validations' do - it 'validates uniqueness of name scoped to project' do - expect(subject).to validate_uniqueness_of(:name) - .scoped_to(:project_id) - end - end - describe 'associations' do it 'belongs to the project' do expect(container_repository).to belong_to(:project) -- 2.30.9