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>2020-12-08 00:10:08 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-12-08 00:10:08 +0300
commit3a966afb3ea2ef7a98bdc389e0dc906ef4bf0273 (patch)
treee22ca72e41a6d2eaca58ac9cc1390e5f8114ac1f /db
parent39d41e02dca2139d0bbd88165affd818c9c82fb6 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20201109114603_schedule_remove_inaccessible_epic_todos.rb29
-rw-r--r--db/post_migrate/20201203123201_remove_orphan_service_hooks.rb31
-rw-r--r--db/schema_migrations/202011091146031
-rw-r--r--db/schema_migrations/202012031232011
4 files changed, 62 insertions, 0 deletions
diff --git a/db/post_migrate/20201109114603_schedule_remove_inaccessible_epic_todos.rb b/db/post_migrate/20201109114603_schedule_remove_inaccessible_epic_todos.rb
new file mode 100644
index 00000000000..13d12675a28
--- /dev/null
+++ b/db/post_migrate/20201109114603_schedule_remove_inaccessible_epic_todos.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class ScheduleRemoveInaccessibleEpicTodos < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INTERVAL = 2.minutes
+ BATCH_SIZE = 10
+ MIGRATION = 'RemoveInaccessibleEpicTodos'
+
+ disable_ddl_transaction!
+
+ class Epic < ActiveRecord::Base
+ include EachBatch
+ end
+
+ def up
+ return unless Gitlab.ee?
+
+ relation = Epic.where(confidential: true)
+
+ queue_background_migration_jobs_by_range_at_intervals(
+ relation, MIGRATION, INTERVAL, batch_size: BATCH_SIZE)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20201203123201_remove_orphan_service_hooks.rb b/db/post_migrate/20201203123201_remove_orphan_service_hooks.rb
new file mode 100644
index 00000000000..c430e2205c2
--- /dev/null
+++ b/db/post_migrate/20201203123201_remove_orphan_service_hooks.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class RemoveOrphanServiceHooks < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ class WebHook < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'web_hooks'
+
+ def self.service_hooks
+ where(type: 'ServiceHook')
+ end
+ end
+
+ class Service < ActiveRecord::Base
+ self.table_name = 'services'
+ end
+
+ def up
+ WebHook.service_hooks.where.not(service_id: Service.select(:id)).where.not(service_id: nil).each_batch do |relation|
+ relation.delete_all
+ end
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/schema_migrations/20201109114603 b/db/schema_migrations/20201109114603
new file mode 100644
index 00000000000..c1df2223dbd
--- /dev/null
+++ b/db/schema_migrations/20201109114603
@@ -0,0 +1 @@
+ae8034ec52df47ce2ce3397715dd18347e4d297a963c17c7b26321f414dfa632 \ No newline at end of file
diff --git a/db/schema_migrations/20201203123201 b/db/schema_migrations/20201203123201
new file mode 100644
index 00000000000..e3799665ffc
--- /dev/null
+++ b/db/schema_migrations/20201203123201
@@ -0,0 +1 @@
+85a642d60e92a880e0a0699f8dcca42aebe2b5363bfcc3010e647734c7cb7dec \ No newline at end of file