The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

20 lines
855 B

  1. class MigrateSettings < ActiveRecord::Migration[4.2]
  2. def up
  3. remove_index :settings, [:target_type, :target_id, :var]
  4. rename_column :settings, :target_id, :thing_id
  5. rename_column :settings, :target_type, :thing_type
  6. change_column :settings, :thing_id, :integer, null: true, default: nil
  7. change_column :settings, :thing_type, :string, null: true, default: nil
  8. add_index :settings, [:thing_type, :thing_id, :var], unique: true
  9. end
  10. def down
  11. remove_index :settings, [:thing_type, :thing_id, :var]
  12. rename_column :settings, :thing_id, :target_id
  13. rename_column :settings, :thing_type, :target_type
  14. change_column :settings, :target_id, :integer, null: false
  15. change_column :settings, :target_type, :string, null: false, default: ''
  16. add_index :settings, [:target_type, :target_id, :var], unique: true
  17. end
  18. end