Skip to content

A platform for community discussion. Free, open, simple.

FIX: set default on theme.key, if it has not yet been dropped (#6095)

David Taylorf4c902b434d0
diff --git a/db/migrate/20180716200103_add_theme_key_default.rb b/db/migrate/20180716200103_add_theme_key_default.rb
new file mode 100644
index 00000000000..f3f6684cd56
--- /dev/null
+++ b/db/migrate/20180716200103_add_theme_key_default.rb
@@ -0,0 +1,11 @@
+class AddThemeKeyDefault < ActiveRecord::Migration[5.2]
+ def up
+ if column_exists?(:themes, :key)
+ execute("ALTER TABLE themes ALTER COLUMN key SET DEFAULT 'deprecated'")
+ end
+ end
+
+ def down
+ raise ActiveRecord::IrreversibleMigration
+ end
+end