summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-14 15:09:44 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-14 15:09:44 +0000
commit874ead9c3a50de4c4ca4551eaf5b7eb976d26b50 (patch)
tree637ee9f2da5e251bc08ebf3e972209d51966bf7c /db/migrate
parent2e4c4055181eec9186458dd5dd3219c937032ec7 (diff)
downloadgitlab-ce-874ead9c3a50de4c4ca4551eaf5b7eb976d26b50.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20200325111432_add_issues_create_limit_to_application_settings.rb9
-rw-r--r--db/migrate/20200326122700_create_diff_note_positions.rb31
-rw-r--r--db/migrate/20200406165950_add_not_null_constraint_on_file_store_to_lfs_objects.rb24
-rw-r--r--db/migrate/20200406171857_add_not_null_constraint_on_file_store_to_ci_job_artifacts.rb24
-rw-r--r--db/migrate/20200406172135_add_not_null_constraint_on_file_store_to_uploads.rb24
-rw-r--r--db/migrate/20200408153842_add_index_on_creator_id_and_id_on_projects.rb17
6 files changed, 129 insertions, 0 deletions
diff --git a/db/migrate/20200325111432_add_issues_create_limit_to_application_settings.rb b/db/migrate/20200325111432_add_issues_create_limit_to_application_settings.rb
new file mode 100644
index 00000000000..60da96ccf33
--- /dev/null
+++ b/db/migrate/20200325111432_add_issues_create_limit_to_application_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddIssuesCreateLimitToApplicationSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :application_settings, :issues_create_limit, :integer, default: 300, null: false
+ end
+end
diff --git a/db/migrate/20200326122700_create_diff_note_positions.rb b/db/migrate/20200326122700_create_diff_note_positions.rb
new file mode 100644
index 00000000000..87159e666b5
--- /dev/null
+++ b/db/migrate/20200326122700_create_diff_note_positions.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class CreateDiffNotePositions < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ create_table :diff_note_positions do |t|
+ t.references :note, foreign_key: { on_delete: :cascade }, null: false, index: false
+ t.integer :old_line
+ t.integer :new_line
+ t.integer :diff_content_type, limit: 2, null: false
+ t.integer :diff_type, limit: 2, null: false
+ t.string :line_code, limit: 255, null: false
+ t.binary :base_sha, null: false
+ t.binary :start_sha, null: false
+ t.binary :head_sha, null: false
+ t.text :old_path, null: false
+ t.text :new_path, null: false
+
+ t.index [:note_id, :diff_type], unique: true
+ end
+ end
+ end
+
+ def down
+ drop_table :diff_note_positions
+ end
+end
diff --git a/db/migrate/20200406165950_add_not_null_constraint_on_file_store_to_lfs_objects.rb b/db/migrate/20200406165950_add_not_null_constraint_on_file_store_to_lfs_objects.rb
new file mode 100644
index 00000000000..78b5832fea4
--- /dev/null
+++ b/db/migrate/20200406165950_add_not_null_constraint_on_file_store_to_lfs_objects.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class AddNotNullConstraintOnFileStoreToLfsObjects < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ CONSTRAINT_NAME = 'lfs_objects_file_store_not_null'
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ execute <<~SQL
+ ALTER TABLE lfs_objects ADD CONSTRAINT #{CONSTRAINT_NAME} CHECK (file_store IS NOT NULL) NOT VALID;
+ SQL
+ end
+ end
+
+ def down
+ with_lock_retries do
+ execute <<~SQL
+ ALTER TABLE lfs_objects DROP CONSTRAINT IF EXISTS #{CONSTRAINT_NAME};
+ SQL
+ end
+ end
+end
diff --git a/db/migrate/20200406171857_add_not_null_constraint_on_file_store_to_ci_job_artifacts.rb b/db/migrate/20200406171857_add_not_null_constraint_on_file_store_to_ci_job_artifacts.rb
new file mode 100644
index 00000000000..1d44e5c17b3
--- /dev/null
+++ b/db/migrate/20200406171857_add_not_null_constraint_on_file_store_to_ci_job_artifacts.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class AddNotNullConstraintOnFileStoreToCiJobArtifacts < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ CONSTRAINT_NAME = 'ci_job_artifacts_file_store_not_null'
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ execute <<~SQL
+ ALTER TABLE ci_job_artifacts ADD CONSTRAINT #{CONSTRAINT_NAME} CHECK (file_store IS NOT NULL) NOT VALID;
+ SQL
+ end
+ end
+
+ def down
+ with_lock_retries do
+ execute <<~SQL
+ ALTER TABLE ci_job_artifacts DROP CONSTRAINT IF EXISTS #{CONSTRAINT_NAME};
+ SQL
+ end
+ end
+end
diff --git a/db/migrate/20200406172135_add_not_null_constraint_on_file_store_to_uploads.rb b/db/migrate/20200406172135_add_not_null_constraint_on_file_store_to_uploads.rb
new file mode 100644
index 00000000000..aa498ba9c89
--- /dev/null
+++ b/db/migrate/20200406172135_add_not_null_constraint_on_file_store_to_uploads.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class AddNotNullConstraintOnFileStoreToUploads < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ CONSTRAINT_NAME = 'uploads_store_not_null'
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ execute <<~SQL
+ ALTER TABLE uploads ADD CONSTRAINT #{CONSTRAINT_NAME} CHECK (store IS NOT NULL) NOT VALID;
+ SQL
+ end
+ end
+
+ def down
+ with_lock_retries do
+ execute <<~SQL
+ ALTER TABLE uploads DROP CONSTRAINT IF EXISTS #{CONSTRAINT_NAME};
+ SQL
+ end
+ end
+end
diff --git a/db/migrate/20200408153842_add_index_on_creator_id_and_id_on_projects.rb b/db/migrate/20200408153842_add_index_on_creator_id_and_id_on_projects.rb
new file mode 100644
index 00000000000..2cc91efcc36
--- /dev/null
+++ b/db/migrate/20200408153842_add_index_on_creator_id_and_id_on_projects.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexOnCreatorIdAndIdOnProjects < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :projects, [:creator_id, :id]
+ end
+
+ def down
+ remove_concurrent_index :projects, [:creator_id, :id]
+ end
+end