Create user_contributed_projects table.

This commit is contained in:
Andreas Brandl 2018-02-23 13:39:54 +01:00
parent 49f72d0665
commit 8cca328201
2 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,23 @@
class CreateUserContributedProjectsTable < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
create_table :user_contributed_projects, id: false do |t|
t.references :user, null: false
t.references :project, null: false
t.index [:user_id, :project_id], unique: true
end
add_concurrent_foreign_key :user_contributed_projects, :users, column: :user_id, on_delete: :cascade
add_concurrent_foreign_key :user_contributed_projects, :projects, column: :project_id, on_delete: :cascade
end
def down
drop_table :user_contributed_projects
end
end

View file

@ -1815,6 +1815,13 @@ ActiveRecord::Schema.define(version: 20180304204842) do
add_index "user_callouts", ["user_id", "feature_name"], name: "index_user_callouts_on_user_id_and_feature_name", unique: true, using: :btree
add_index "user_callouts", ["user_id"], name: "index_user_callouts_on_user_id", using: :btree
create_table "user_contributed_projects", id: false, force: :cascade do |t|
t.integer "user_id", null: false
t.integer "project_id", null: false
end
add_index "user_contributed_projects", ["user_id", "project_id"], name: "index_user_contributed_projects_on_user_id_and_project_id", unique: true, using: :btree
create_table "user_custom_attributes", force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
@ -2094,6 +2101,8 @@ ActiveRecord::Schema.define(version: 20180304204842) do
add_foreign_key "trending_projects", "projects", on_delete: :cascade
add_foreign_key "u2f_registrations", "users"
add_foreign_key "user_callouts", "users", on_delete: :cascade
add_foreign_key "user_contributed_projects", "projects", name: "fk_6fe26e92ae", on_delete: :cascade
add_foreign_key "user_contributed_projects", "users", name: "fk_285db038d3", on_delete: :cascade
add_foreign_key "user_custom_attributes", "users", on_delete: :cascade
add_foreign_key "user_synced_attributes_metadata", "users", on_delete: :cascade
add_foreign_key "users_star_projects", "projects", name: "fk_22cd27ddfc", on_delete: :cascade