diff options
-rw-r--r-- | db/migrate/20170322013926_create_container_repository.rb | 9 | ||||
-rw-r--r-- | db/schema.rb | 10 |
2 files changed, 15 insertions, 4 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 diff --git a/db/schema.rb b/db/schema.rb index 3c11e68da2c..9ee1d0e6aef 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -324,10 +324,15 @@ ActiveRecord::Schema.define(version: 20170329124448) do add_index "ci_variables", ["project_id"], name: "index_ci_variables_on_project_id", using: :btree create_table "container_repositories", force: :cascade do |t| - t.integer "project_id" - t.string "name" + t.integer "project_id", null: false + t.string "name", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end + add_index "container_repositories", ["project_id", "name"], name: "index_container_repositories_on_project_id_and_name", unique: true, using: :btree + add_index "container_repositories", ["project_id"], name: "index_container_repositories_on_project_id", using: :btree + create_table "deploy_keys_projects", force: :cascade do |t| t.integer "deploy_key_id", null: false t.integer "project_id", null: false @@ -1304,6 +1309,7 @@ ActiveRecord::Schema.define(version: 20170329124448) do add_foreign_key "boards", "projects" add_foreign_key "chat_teams", "namespaces", on_delete: :cascade add_foreign_key "ci_triggers", "users", column: "owner_id", name: "fk_e8e10d1964", on_delete: :cascade + add_foreign_key "container_repositories", "projects" add_foreign_key "issue_metrics", "issues", on_delete: :cascade add_foreign_key "label_priorities", "labels", on_delete: :cascade add_foreign_key "label_priorities", "projects", on_delete: :cascade |