diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-14 12:06:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-14 12:06:15 +0300 |
commit | 2fa7d2ddf6a7004f89616e43b8279229af831e25 (patch) | |
tree | 91b35d62663f12d68f36a3a12c9891150a9ff251 /db | |
parent | d9251dac4c8f9e27f1e2db4b537d47d7d5a9e5be (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20191016133352_create_ci_subscriptions_projects.rb | 21 | ||||
-rw-r--r-- | db/schema.rb | 9 |
2 files changed, 30 insertions, 0 deletions
diff --git a/db/migrate/20191016133352_create_ci_subscriptions_projects.rb b/db/migrate/20191016133352_create_ci_subscriptions_projects.rb new file mode 100644 index 00000000000..00ab2c19193 --- /dev/null +++ b/db/migrate/20191016133352_create_ci_subscriptions_projects.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class CreateCiSubscriptionsProjects < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + def change + create_table :ci_subscriptions_projects do |t| + t.references :downstream_project, null: false, index: false, foreign_key: { to_table: :projects, on_delete: :cascade } + t.references :upstream_project, null: false, foreign_key: { to_table: :projects, on_delete: :cascade } + end + + add_index :ci_subscriptions_projects, [:downstream_project_id, :upstream_project_id], + unique: true, name: 'index_ci_subscriptions_projects_unique_subscription' + end +end diff --git a/db/schema.rb b/db/schema.rb index fdc42b43422..36883130b78 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -924,6 +924,13 @@ ActiveRecord::Schema.define(version: 2019_11_12_221821) do t.index ["project_id"], name: "index_ci_stages_on_project_id" end + create_table "ci_subscriptions_projects", force: :cascade do |t| + t.bigint "downstream_project_id", null: false + t.bigint "upstream_project_id", null: false + t.index ["downstream_project_id", "upstream_project_id"], name: "index_ci_subscriptions_projects_unique_subscription", unique: true + t.index ["upstream_project_id"], name: "index_ci_subscriptions_projects_on_upstream_project_id" + end + create_table "ci_trigger_requests", id: :serial, force: :cascade do |t| t.integer "trigger_id", null: false t.text "variables" @@ -4190,6 +4197,8 @@ ActiveRecord::Schema.define(version: 2019_11_12_221821) do add_foreign_key "ci_sources_pipelines", "projects", name: "fk_1e53c97c0a", on_delete: :cascade add_foreign_key "ci_stages", "ci_pipelines", column: "pipeline_id", name: "fk_fb57e6cc56", on_delete: :cascade add_foreign_key "ci_stages", "projects", name: "fk_2360681d1d", on_delete: :cascade + add_foreign_key "ci_subscriptions_projects", "projects", column: "downstream_project_id", on_delete: :cascade + add_foreign_key "ci_subscriptions_projects", "projects", column: "upstream_project_id", on_delete: :cascade add_foreign_key "ci_trigger_requests", "ci_triggers", column: "trigger_id", name: "fk_b8ec8b7245", on_delete: :cascade add_foreign_key "ci_triggers", "projects", name: "fk_e3e63f966e", on_delete: :cascade add_foreign_key "ci_triggers", "users", column: "owner_id", name: "fk_e8e10d1964", on_delete: :cascade |