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

Add migration to remove unused variables from database

Henriette Darge09edb0f8d929
diff --git a/db/migrate/20241015081341_remove_obsolete_design_variables.rb b/db/migrate/20241015081341_remove_obsolete_design_variables.rb
new file mode 100644
index 00000000000..641b7c1af75
--- /dev/null
+++ b/db/migrate/20241015081341_remove_obsolete_design_variables.rb
@@ -0,0 +1,21 @@
+class RemoveObsoleteDesignVariables < ActiveRecord::Migration[7.1]
+ OBSOLETE_COLOR_VARIABLES = %w( main-menu-font-color
+ main-menu-selected-font-color
+ main-menu-hover-font-color
+ main-menu-border-color
+ header-item-font-color
+ header-item-font-hover-color
+ header-border-bottom-color ).freeze
+
+ class MigrationDesignColor < ApplicationRecord
+ self.table_name = "design_colors"
+ end
+
+ def up
+ MigrationDesignColor.where(variable: OBSOLETE_COLOR_VARIABLES).delete_all
+ end
+
+ def down
+ # This is not revertible
+ end
+end