mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: column dropper class for cleaner removal of superflous columns
Also fixes issues during deploy cause target column was renamed in theme_fields
This commit is contained in:
@@ -2,6 +2,11 @@ class AddUploadIdToThemeFields < ActiveRecord::Migration
|
||||
def up
|
||||
remove_index :theme_fields, [:theme_id, :target, :name]
|
||||
rename_column :theme_fields, :target, :target_id
|
||||
|
||||
# we need a throwaway column here to keep running
|
||||
add_column :theme_fields, :target, :integer
|
||||
execute "UPDATE theme_fields SET target = target_id"
|
||||
|
||||
change_column :theme_fields, :name, :string, null: false, limit: 30
|
||||
|
||||
add_column :theme_fields, :upload_id, :integer
|
||||
@@ -12,6 +17,7 @@ class AddUploadIdToThemeFields < ActiveRecord::Migration
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :theme_fields, :target
|
||||
execute 'drop index theme_field_unique_index'
|
||||
rename_column :theme_fields, :target_id, :target
|
||||
remove_column :theme_fields, :upload_id
|
||||
|
||||
Reference in New Issue
Block a user