Fix indexes in container repositories table

This commit is contained in:
Grzegorz Bizon 2017-04-06 12:25:09 +02:00
parent 6d7a52480c
commit 163e9f99ab
2 changed files with 1 additions and 9 deletions

View File

@ -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

View File

@ -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)