summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-06 11:28:26 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-06 11:28:26 +0000
commit7d5e6412bef7fd457e22532faf859e551f8196fc (patch)
treedc62b4a7a5fad8ba0ba260ae82e95f8e984f2398 /db/migrate
parent8e94dad32b10edebf79285c083176c2b7005ef64 (diff)
downloadgitlab-ce-7d5e6412bef7fd457e22532faf859e551f8196fc.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20200224185814_add_project_subscriptions_to_plan_limits.rb9
-rw-r--r--db/migrate/20200225123228_insert_project_subscriptions_plan_limits.rb33
-rw-r--r--db/migrate/20200228160542_create_ci_sources_projects.rb17
-rw-r--r--db/migrate/20200304121828_add_ci_sources_project_pipeline_foreign_key.rb13
-rw-r--r--db/migrate/20200304121844_add_ci_sources_project_source_project_foreign_key.rb13
5 files changed, 85 insertions, 0 deletions
diff --git a/db/migrate/20200224185814_add_project_subscriptions_to_plan_limits.rb b/db/migrate/20200224185814_add_project_subscriptions_to_plan_limits.rb
new file mode 100644
index 00000000000..789f23501fb
--- /dev/null
+++ b/db/migrate/20200224185814_add_project_subscriptions_to_plan_limits.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddProjectSubscriptionsToPlanLimits < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column(:plan_limits, :ci_project_subscriptions, :integer, default: 0, null: false)
+ end
+end
diff --git a/db/migrate/20200225123228_insert_project_subscriptions_plan_limits.rb b/db/migrate/20200225123228_insert_project_subscriptions_plan_limits.rb
new file mode 100644
index 00000000000..4a05e2cd779
--- /dev/null
+++ b/db/migrate/20200225123228_insert_project_subscriptions_plan_limits.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+class InsertProjectSubscriptionsPlanLimits < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ return if Rails.env.test?
+
+ if Gitlab.com?
+ create_or_update_plan_limit('ci_project_subscriptions', 'free', 2)
+ create_or_update_plan_limit('ci_project_subscriptions', 'bronze', 2)
+ create_or_update_plan_limit('ci_project_subscriptions', 'silver', 2)
+ create_or_update_plan_limit('ci_project_subscriptions', 'gold', 2)
+ else
+ create_or_update_plan_limit('ci_project_subscriptions', 'default', 2)
+ end
+ end
+
+ def down
+ return if Rails.env.test?
+
+ if Gitlab.com?
+ create_or_update_plan_limit('ci_project_subscriptions', 'free', 0)
+ create_or_update_plan_limit('ci_project_subscriptions', 'bronze', 0)
+ create_or_update_plan_limit('ci_project_subscriptions', 'silver', 0)
+ create_or_update_plan_limit('ci_project_subscriptions', 'gold', 0)
+ else
+ create_or_update_plan_limit('ci_project_subscriptions', 'default', 0)
+ end
+ end
+end
diff --git a/db/migrate/20200228160542_create_ci_sources_projects.rb b/db/migrate/20200228160542_create_ci_sources_projects.rb
new file mode 100644
index 00000000000..36f5167a784
--- /dev/null
+++ b/db/migrate/20200228160542_create_ci_sources_projects.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class CreateCiSourcesProjects < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ create_table :ci_sources_projects do |t|
+ t.bigint :pipeline_id, null: false
+ t.bigint :source_project_id, null: false
+
+ t.index [:source_project_id, :pipeline_id], unique: true
+ t.index :pipeline_id
+ end
+ end
+end
diff --git a/db/migrate/20200304121828_add_ci_sources_project_pipeline_foreign_key.rb b/db/migrate/20200304121828_add_ci_sources_project_pipeline_foreign_key.rb
new file mode 100644
index 00000000000..db78d9594b0
--- /dev/null
+++ b/db/migrate/20200304121828_add_ci_sources_project_pipeline_foreign_key.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddCiSourcesProjectPipelineForeignKey < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ with_lock_retries do
+ add_foreign_key :ci_sources_projects, :ci_pipelines, column: :pipeline_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ end
+ end
+end
diff --git a/db/migrate/20200304121844_add_ci_sources_project_source_project_foreign_key.rb b/db/migrate/20200304121844_add_ci_sources_project_source_project_foreign_key.rb
new file mode 100644
index 00000000000..88bf835b9f1
--- /dev/null
+++ b/db/migrate/20200304121844_add_ci_sources_project_source_project_foreign_key.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddCiSourcesProjectSourceProjectForeignKey < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ with_lock_retries do
+ add_foreign_key :ci_sources_projects, :projects, column: :source_project_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ end
+ end
+end