summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-12 12:09:17 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-12 12:09:17 +0000
commitcd52759ee33051b8ad7b88b02ba7954e4fad7018 (patch)
treef1096c68e457aef7f5201acd16e4a751ff538026 /db/migrate
parent18f7828977b74bf6e5153594a098ef90e773b3b7 (diff)
downloadgitlab-ce-cd52759ee33051b8ad7b88b02ba7954e4fad7018.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20200203025400_default_lock_version_to_zero_for_merge_requests.rb8
-rw-r--r--db/migrate/20200203025602_default_lock_version_to_zero_for_issues.rb8
-rw-r--r--db/migrate/20200203025619_default_lock_version_to_zero_for_epics.rb8
-rw-r--r--db/migrate/20200203025744_default_lock_version_to_zero_for_ci_builds.rb8
-rw-r--r--db/migrate/20200203025801_default_lock_version_to_zero_for_ci_stages.rb8
-rw-r--r--db/migrate/20200203025821_default_lock_version_to_zero_for_ci_pipelines.rb8
-rw-r--r--db/migrate/20200207062728_add_default_branch_protection_to_namespaces.rb8
-rw-r--r--db/migrate/20200222055543_add_confidential_to_note.rb8
-rw-r--r--db/migrate/20200227165129_create_user_details.rb8
-rw-r--r--db/migrate/20200304121828_add_ci_sources_project_pipeline_foreign_key.rb8
-rw-r--r--db/migrate/20200304121844_add_ci_sources_project_source_project_foreign_key.rb8
11 files changed, 77 insertions, 11 deletions
diff --git a/db/migrate/20200203025400_default_lock_version_to_zero_for_merge_requests.rb b/db/migrate/20200203025400_default_lock_version_to_zero_for_merge_requests.rb
index c0c58cfa3a7..8e48490af77 100644
--- a/db/migrate/20200203025400_default_lock_version_to_zero_for_merge_requests.rb
+++ b/db/migrate/20200203025400_default_lock_version_to_zero_for_merge_requests.rb
@@ -9,9 +9,15 @@ class DefaultLockVersionToZeroForMergeRequests < ActiveRecord::Migration[6.0]
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
- def change
+ def up
with_lock_retries do
change_column_default :merge_requests, :lock_version, from: nil, to: 0
end
end
+
+ def down
+ with_lock_retries do
+ change_column_default :merge_requests, :lock_version, from: 0, to: nil
+ end
+ end
end
diff --git a/db/migrate/20200203025602_default_lock_version_to_zero_for_issues.rb b/db/migrate/20200203025602_default_lock_version_to_zero_for_issues.rb
index 72c265fdf38..1265de70728 100644
--- a/db/migrate/20200203025602_default_lock_version_to_zero_for_issues.rb
+++ b/db/migrate/20200203025602_default_lock_version_to_zero_for_issues.rb
@@ -9,9 +9,15 @@ class DefaultLockVersionToZeroForIssues < ActiveRecord::Migration[6.0]
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
- def change
+ def up
with_lock_retries do
change_column_default :issues, :lock_version, from: nil, to: 0
end
end
+
+ def down
+ with_lock_retries do
+ change_column_default :issues, :lock_version, from: 0, to: nil
+ end
+ end
end
diff --git a/db/migrate/20200203025619_default_lock_version_to_zero_for_epics.rb b/db/migrate/20200203025619_default_lock_version_to_zero_for_epics.rb
index f44cfd07ee2..b2af8cbe707 100644
--- a/db/migrate/20200203025619_default_lock_version_to_zero_for_epics.rb
+++ b/db/migrate/20200203025619_default_lock_version_to_zero_for_epics.rb
@@ -9,9 +9,15 @@ class DefaultLockVersionToZeroForEpics < ActiveRecord::Migration[6.0]
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
- def change
+ def up
with_lock_retries do
change_column_default :epics, :lock_version, from: nil, to: 0
end
end
+
+ def down
+ with_lock_retries do
+ change_column_default :epics, :lock_version, from: 0, to: nil
+ end
+ end
end
diff --git a/db/migrate/20200203025744_default_lock_version_to_zero_for_ci_builds.rb b/db/migrate/20200203025744_default_lock_version_to_zero_for_ci_builds.rb
index feda8c36947..f40bf7d6309 100644
--- a/db/migrate/20200203025744_default_lock_version_to_zero_for_ci_builds.rb
+++ b/db/migrate/20200203025744_default_lock_version_to_zero_for_ci_builds.rb
@@ -9,9 +9,15 @@ class DefaultLockVersionToZeroForCiBuilds < ActiveRecord::Migration[6.0]
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
- def change
+ def up
with_lock_retries do
change_column_default :ci_builds, :lock_version, from: nil, to: 0
end
end
+
+ def down
+ with_lock_retries do
+ change_column_default :ci_builds, :lock_version, from: 0, to: nil
+ end
+ end
end
diff --git a/db/migrate/20200203025801_default_lock_version_to_zero_for_ci_stages.rb b/db/migrate/20200203025801_default_lock_version_to_zero_for_ci_stages.rb
index b825c4ff1c4..fd3194a742a 100644
--- a/db/migrate/20200203025801_default_lock_version_to_zero_for_ci_stages.rb
+++ b/db/migrate/20200203025801_default_lock_version_to_zero_for_ci_stages.rb
@@ -9,9 +9,15 @@ class DefaultLockVersionToZeroForCiStages < ActiveRecord::Migration[6.0]
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
- def change
+ def up
with_lock_retries do
change_column_default :ci_stages, :lock_version, from: nil, to: 0
end
end
+
+ def down
+ with_lock_retries do
+ change_column_default :ci_stages, :lock_version, from: 0, to: nil
+ end
+ end
end
diff --git a/db/migrate/20200203025821_default_lock_version_to_zero_for_ci_pipelines.rb b/db/migrate/20200203025821_default_lock_version_to_zero_for_ci_pipelines.rb
index 6c4c84cb7e7..6b4568cc7e8 100644
--- a/db/migrate/20200203025821_default_lock_version_to_zero_for_ci_pipelines.rb
+++ b/db/migrate/20200203025821_default_lock_version_to_zero_for_ci_pipelines.rb
@@ -9,9 +9,15 @@ class DefaultLockVersionToZeroForCiPipelines < ActiveRecord::Migration[6.0]
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
- def change
+ def up
with_lock_retries do
change_column_default :ci_pipelines, :lock_version, from: nil, to: 0
end
end
+
+ def down
+ with_lock_retries do
+ change_column_default :ci_pipelines, :lock_version, from: 0, to: nil
+ end
+ end
end
diff --git a/db/migrate/20200207062728_add_default_branch_protection_to_namespaces.rb b/db/migrate/20200207062728_add_default_branch_protection_to_namespaces.rb
index c21cac307f9..6eb650e6b6a 100644
--- a/db/migrate/20200207062728_add_default_branch_protection_to_namespaces.rb
+++ b/db/migrate/20200207062728_add_default_branch_protection_to_namespaces.rb
@@ -5,9 +5,15 @@ class AddDefaultBranchProtectionToNamespaces < ActiveRecord::Migration[6.0]
DOWNTIME = false
- def change
+ def up
with_lock_retries do
add_column :namespaces, :default_branch_protection, :integer, limit: 2
end
end
+
+ def down
+ with_lock_retries do
+ remove_column :namespaces, :default_branch_protection
+ end
+ end
end
diff --git a/db/migrate/20200222055543_add_confidential_to_note.rb b/db/migrate/20200222055543_add_confidential_to_note.rb
index 03173f63a03..d7bf64dca44 100644
--- a/db/migrate/20200222055543_add_confidential_to_note.rb
+++ b/db/migrate/20200222055543_add_confidential_to_note.rb
@@ -4,9 +4,15 @@ class AddConfidentialToNote < ActiveRecord::Migration[6.0]
DOWNTIME = false
- def change
+ def up
with_lock_retries do
add_column :notes, :confidential, :boolean
end
end
+
+ def down
+ with_lock_retries do
+ remove_column :notes, :confidential
+ end
+ end
end
diff --git a/db/migrate/20200227165129_create_user_details.rb b/db/migrate/20200227165129_create_user_details.rb
index 14403824abc..fe9f23fcb21 100644
--- a/db/migrate/20200227165129_create_user_details.rb
+++ b/db/migrate/20200227165129_create_user_details.rb
@@ -5,7 +5,7 @@ class CreateUserDetails < ActiveRecord::Migration[6.0]
DOWNTIME = false
- def change
+ def up
with_lock_retries do
create_table :user_details, id: false do |t|
t.references :user, index: false, foreign_key: { on_delete: :cascade }, null: false, primary_key: true
@@ -15,4 +15,10 @@ class CreateUserDetails < ActiveRecord::Migration[6.0]
add_index :user_details, :user_id, unique: true
end
+
+ def down
+ with_lock_retries do
+ drop_table :user_details
+ 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
index db78d9594b0..d5b0af41d4a 100644
--- a/db/migrate/20200304121828_add_ci_sources_project_pipeline_foreign_key.rb
+++ b/db/migrate/20200304121828_add_ci_sources_project_pipeline_foreign_key.rb
@@ -5,9 +5,15 @@ class AddCiSourcesProjectPipelineForeignKey < ActiveRecord::Migration[6.0]
DOWNTIME = false
- def change
+ def up
with_lock_retries do
add_foreign_key :ci_sources_projects, :ci_pipelines, column: :pipeline_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
end
end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :ci_sources_projects, :ci_pipelines, column: :pipeline_id
+ 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
index 88bf835b9f1..4f679bef85e 100644
--- 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
@@ -5,9 +5,15 @@ class AddCiSourcesProjectSourceProjectForeignKey < ActiveRecord::Migration[6.0]
DOWNTIME = false
- def change
+ def up
with_lock_retries do
add_foreign_key :ci_sources_projects, :projects, column: :source_project_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
end
end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :ci_sources_projects, :projects, column: :source_project_id
+ end
+ end
end