Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Make migration reversible

Jan Sandbrink0f1fd41a6d79
diff --git a/modules/storages/db/migrate/20250115100336_set_default_authentication_method.rb b/modules/storages/db/migrate/20250115100336_set_default_authentication_method.rb
index 28a045c691d..e1d05e7f556 100644
--- a/modules/storages/db/migrate/20250115100336_set_default_authentication_method.rb
+++ b/modules/storages/db/migrate/20250115100336_set_default_authentication_method.rb
@@ -29,7 +29,7 @@
#++
class SetDefaultAuthenticationMethod < ActiveRecord::Migration[7.1]
- def change
+ def up
update_sql = <<~SQL.squish
UPDATE storages
SET provider_fields = provider_fields || '{ "authentication_method": "two_way_oauth2" }'::jsonb
@@ -38,4 +38,9 @@ class SetDefaultAuthenticationMethod < ActiveRecord::Migration[7.1]
ActiveRecord::Base.connection.execute(update_sql)
end
+
+ def down
+ # up-direction is backwards-compatible, no need to restrict a migration rollback
+ # but also nothing to do in case of a rollback
+ end
end