diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-04-05 16:12:29 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-04-05 16:18:39 +0300 |
commit | 1e54181523f42c2734056b6ea548ebc2134f57a6 (patch) | |
tree | bf756e63bdb5aaefe9320613a096e7da14bb28ce /db/migrate/20170322013926_create_container_repository.rb | |
parent | 6b565f534a17ce893ce288e8afd1e3e4d5d3dd3a (diff) |
Improve migration for container repositories table
Diffstat (limited to 'db/migrate/20170322013926_create_container_repository.rb')
-rw-r--r-- | db/migrate/20170322013926_create_container_repository.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/db/migrate/20170322013926_create_container_repository.rb b/db/migrate/20170322013926_create_container_repository.rb index 87a1523724c..32eba3903b1 100644 --- a/db/migrate/20170322013926_create_container_repository.rb +++ b/db/migrate/20170322013926_create_container_repository.rb @@ -5,8 +5,13 @@ class CreateContainerRepository < ActiveRecord::Migration def change create_table :container_repositories do |t| - t.integer :project_id - t.string :name + t.references :project, foreign_key: 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 |