Fix indexes in container repositories table
This commit is contained in:
parent
6d7a52480c
commit
163e9f99ab
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue