The code powering m.abunchtell.com https://m.abunchtell.com
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

20 行
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