diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20200323011225_complete_migrate_security_scans.rb | 13 | ||||
-rw-r--r-- | db/post_migrate/20200323011955_remove_index_used_for_scan_migration.rb | 24 | ||||
-rw-r--r-- | db/structure.sql | 4 |
3 files changed, 39 insertions, 2 deletions
diff --git a/db/post_migrate/20200323011225_complete_migrate_security_scans.rb b/db/post_migrate/20200323011225_complete_migrate_security_scans.rb new file mode 100644 index 00000000000..39c9a78b1b6 --- /dev/null +++ b/db/post_migrate/20200323011225_complete_migrate_security_scans.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class CompleteMigrateSecurityScans < ActiveRecord::Migration[6.0] + disable_ddl_transaction! + + def up + Gitlab::BackgroundMigration.steal('MigrateSecurityScans') + end + + def down + # intentionally blank + end +end diff --git a/db/post_migrate/20200323011955_remove_index_used_for_scan_migration.rb b/db/post_migrate/20200323011955_remove_index_used_for_scan_migration.rb new file mode 100644 index 00000000000..0568cdb8483 --- /dev/null +++ b/db/post_migrate/20200323011955_remove_index_used_for_scan_migration.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class RemoveIndexUsedForScanMigration < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'job_artifacts_secure_reports_temp_index' + COLUMNS = [:id, :file_type, :job_id, :created_at, :updated_at] + + disable_ddl_transaction! + + def up + if index_exists?(:ci_job_artifacts, COLUMNS, name: INDEX_NAME) + remove_concurrent_index(:ci_job_artifacts, COLUMNS, name: INDEX_NAME) + end + end + + def down + add_concurrent_index(:ci_job_artifacts, + COLUMNS, + name: INDEX_NAME, + where: 'file_type BETWEEN 5 AND 8') + end +end diff --git a/db/structure.sql b/db/structure.sql index 8bd83517bb8..bb291590abc 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -10214,8 +10214,6 @@ CREATE UNIQUE INDEX issue_user_mentions_on_issue_id_and_note_id_index ON public. CREATE UNIQUE INDEX issue_user_mentions_on_issue_id_index ON public.issue_user_mentions USING btree (issue_id) WHERE (note_id IS NULL); -CREATE INDEX job_artifacts_secure_reports_temp_index ON public.ci_job_artifacts USING btree (id, file_type, job_id, created_at, updated_at) WHERE ((file_type >= 5) AND (file_type <= 8)); - CREATE UNIQUE INDEX kubernetes_namespaces_cluster_and_namespace ON public.clusters_kubernetes_namespaces USING btree (cluster_id, namespace); CREATE INDEX merge_request_mentions_temp_index ON public.merge_requests USING btree (id) WHERE ((description ~~ '%@%'::text) OR ((title)::text ~~ '%@%'::text)); @@ -12800,6 +12798,8 @@ COPY "schema_migrations" (version) FROM STDIN; 20200319203901 20200320112455 20200320123839 +20200323011225 +20200323011955 20200323071918 20200323074147 20200323075043 |