Commit 1e541815 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Improve migration for container repositories table

parent 6b565f53
...@@ -5,8 +5,13 @@ class CreateContainerRepository < ActiveRecord::Migration ...@@ -5,8 +5,13 @@ class CreateContainerRepository < ActiveRecord::Migration
def change def change
create_table :container_repositories do |t| create_table :container_repositories do |t|
t.integer :project_id t.references :project, foreign_key: true, null: false
t.string :name t.string :name, null: false
t.timestamps null: false
end end
add_index :container_repositories, :project_id
add_index :container_repositories, [:project_id, :name], unique: true
end end
end end
...@@ -324,10 +324,15 @@ ActiveRecord::Schema.define(version: 20170329124448) do ...@@ -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 add_index "ci_variables", ["project_id"], name: "index_ci_variables_on_project_id", using: :btree
create_table "container_repositories", force: :cascade do |t| create_table "container_repositories", force: :cascade do |t|
t.integer "project_id" t.integer "project_id", null: false
t.string "name" t.string "name", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end 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| create_table "deploy_keys_projects", force: :cascade do |t|
t.integer "deploy_key_id", null: false t.integer "deploy_key_id", null: false
t.integer "project_id", null: false t.integer "project_id", null: false
...@@ -1304,6 +1309,7 @@ ActiveRecord::Schema.define(version: 20170329124448) do ...@@ -1304,6 +1309,7 @@ ActiveRecord::Schema.define(version: 20170329124448) do
add_foreign_key "boards", "projects" add_foreign_key "boards", "projects"
add_foreign_key "chat_teams", "namespaces", on_delete: :cascade 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 "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 "issue_metrics", "issues", on_delete: :cascade
add_foreign_key "label_priorities", "labels", on_delete: :cascade add_foreign_key "label_priorities", "labels", on_delete: :cascade
add_foreign_key "label_priorities", "projects", on_delete: :cascade add_foreign_key "label_priorities", "projects", on_delete: :cascade
......
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