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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-04-13 15:11:32 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-13 15:11:32 +0300
commit7ad147d6b88837b12b02d1b1711061dcdcd6c0e3 (patch)
tree75fccfb5f4f66d2a20d53be6e9c2e60964fad04e /db
parent37974ac0b196b06ffcc6cbea44385eaac1cc57bd (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20210412142223_add_user_index_on_spam_logs.rb17
-rw-r--r--db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb10
-rw-r--r--db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb10
-rw-r--r--db/schema_migrations/202104121422231
-rw-r--r--db/structure.sql2
5 files changed, 36 insertions, 4 deletions
diff --git a/db/migrate/20210412142223_add_user_index_on_spam_logs.rb b/db/migrate/20210412142223_add_user_index_on_spam_logs.rb
new file mode 100644
index 00000000000..0a12f0f1a87
--- /dev/null
+++ b/db/migrate/20210412142223_add_user_index_on_spam_logs.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddUserIndexOnSpamLogs < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_spam_logs_on_user_id'
+
+ def up
+ add_concurrent_index :spam_logs, :user_id, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :spam_logs, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb b/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb
index 812f0a3a84e..01e81c65eee 100644
--- a/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb
+++ b/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb
@@ -6,13 +6,13 @@ class BackfillEventsIdForBigintConversion < ActiveRecord::Migration[6.0]
DOWNTIME = false
def up
- return unless Gitlab.dev_env_or_com?
+ return unless should_run?
backfill_conversion_of_integer_to_bigint :events, :id, batch_size: 15000, sub_batch_size: 100
end
def down
- return unless Gitlab.dev_env_or_com?
+ return unless should_run?
Gitlab::Database::BackgroundMigration::BatchedMigration
.where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob')
@@ -20,4 +20,10 @@ class BackfillEventsIdForBigintConversion < ActiveRecord::Migration[6.0]
.where('job_arguments = ?', %w[id id_convert_to_bigint].to_json)
.delete_all
end
+
+ private
+
+ def should_run?
+ Gitlab.dev_or_test_env? || Gitlab.com?
+ end
end
diff --git a/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb b/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb
index 7c1aba254f0..6b8595b3ad3 100644
--- a/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb
+++ b/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb
@@ -6,14 +6,14 @@ class BackfillPushEventPayloadEventIdForBigintConversion < ActiveRecord::Migrati
DOWNTIME = false
def up
- return unless Gitlab.dev_env_or_com?
+ return unless should_run?
backfill_conversion_of_integer_to_bigint :push_event_payloads, :event_id, primary_key: :event_id,
batch_size: 15000, sub_batch_size: 100
end
def down
- return unless Gitlab.dev_env_or_com?
+ return unless should_run?
Gitlab::Database::BackgroundMigration::BatchedMigration
.where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob')
@@ -21,4 +21,10 @@ class BackfillPushEventPayloadEventIdForBigintConversion < ActiveRecord::Migrati
.where('job_arguments = ?', %w[event_id event_id_convert_to_bigint].to_json)
.delete_all
end
+
+ private
+
+ def should_run?
+ Gitlab.dev_or_test_env? || Gitlab.com?
+ end
end
diff --git a/db/schema_migrations/20210412142223 b/db/schema_migrations/20210412142223
new file mode 100644
index 00000000000..9ddb9b7f1e4
--- /dev/null
+++ b/db/schema_migrations/20210412142223
@@ -0,0 +1 @@
+4a1435a56b8e5cddd83b844f84374bca91810bbfc5f44faf2a53fd41f93be69c \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 15f14bc5208..5d0ca31e91f 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -23942,6 +23942,8 @@ CREATE UNIQUE INDEX index_sop_configs_on_project_id ON security_orchestration_po
CREATE INDEX index_sop_configurations_project_id_policy_project_id ON security_orchestration_policy_configurations USING btree (security_policy_management_project_id, project_id);
+CREATE INDEX index_spam_logs_on_user_id ON spam_logs USING btree (user_id);
+
CREATE INDEX index_sprints_iterations_cadence_id ON sprints USING btree (iterations_cadence_id);
CREATE INDEX index_sprints_on_description_trigram ON sprints USING gin (description gin_trgm_ops);