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

Modify migration to override specific rows only.

Pavel Balashovdec84cacfd80
diff --git a/db/migrate/20230420071113_migrate_storages_to_use_provider_type_as_sti_column.rb b/db/migrate/20230420071113_migrate_storages_to_use_provider_type_as_sti_column.rb
index 7cbbb09b63b..d76f7b7922f 100644
--- a/db/migrate/20230420071113_migrate_storages_to_use_provider_type_as_sti_column.rb
+++ b/db/migrate/20230420071113_migrate_storages_to_use_provider_type_as_sti_column.rb
@@ -27,10 +27,14 @@
class MigrateStoragesToUseProviderTypeAsStiColumn < ActiveRecord::Migration[7.0]
def up
- Storages::Storage.update_all("provider_type = 'Storages::NextcloudStorage'")
+ Storages::Storage
+ .where(provider_type: 'nextcloud')
+ .update_all("provider_type = 'Storages::NextcloudStorage'")
end
def down
- Storages::Storage.update_all("provider_type = 'nextcloud'")
+ Storages::Storage
+ .where(provider_type: 'Storages::NextcloudStorage')
+ .update_all("provider_type = 'nextcloud'")
end
end