summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200305151736_delete_template_project_services.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20200305151736_delete_template_project_services.rb b/db/migrate/20200305151736_delete_template_project_services.rb
new file mode 100644
index 00000000000..2ab8d46a94e
--- /dev/null
+++ b/db/migrate/20200305151736_delete_template_project_services.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class DeleteTemplateProjectServices < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ # In 12.9 an ActiveRecord validation for services not being a template and
+ # attached to a project at the same time is introduced. This migration cleans up invalid data.
+ execute <<~SQL
+ DELETE
+ FROM services
+ WHERE TEMPLATE = TRUE AND project_id IS NOT NULL
+ SQL
+ end
+
+ def down
+ # This migration cannot be reversed.
+ end
+end