Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorAndreas Brandl <abrandl@gitlab.com>2018-02-23 15:39:54 +0300
committerAndreas Brandl <abrandl@gitlab.com>2018-03-06 14:53:12 +0300
commit8cca328201c4ed560650c77a7ead83160eba1261 (patch)
tree9c8fd5dd03827d211e74c0d69746858a68997cdf /db
parent49f72d06654bd7bdea259154e1092a53aab57acc (diff)
Create user_contributed_projects table.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20180223120443_create_user_contributed_projects_table.rb23
-rw-r--r--db/schema.rb9
2 files changed, 32 insertions, 0 deletions
diff --git a/db/migrate/20180223120443_create_user_contributed_projects_table.rb b/db/migrate/20180223120443_create_user_contributed_projects_table.rb
new file mode 100644
index 00000000000..bbd39da14bd
--- /dev/null
+++ b/db/migrate/20180223120443_create_user_contributed_projects_table.rb
@@ -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
diff --git a/db/schema.rb b/db/schema.rb
index 4937fbd3df1..4b1508e350c 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -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