Commit 163e9f99 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Fix indexes in container repositories table

parent 6d7a5248
...@@ -5,13 +5,12 @@ class CreateContainerRepository < ActiveRecord::Migration ...@@ -5,13 +5,12 @@ class CreateContainerRepository < ActiveRecord::Migration
def change def change
create_table :container_repositories do |t| 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.string :name, null: false
t.timestamps null: false t.timestamps null: false
end end
add_index :container_repositories, :project_id
add_index :container_repositories, [:project_id, :name], unique: true add_index :container_repositories, [:project_id, :name], unique: true
end end
end end
...@@ -21,13 +21,6 @@ describe ContainerRepository do ...@@ -21,13 +21,6 @@ describe ContainerRepository do
headers: { 'Content-Type' => 'application/json' }) headers: { 'Content-Type' => 'application/json' })
end 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 describe 'associations' do
it 'belongs to the project' do it 'belongs to the project' do
expect(container_repository).to belong_to(:project) expect(container_repository).to belong_to(:project)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment