闭社主体 forked from https://github.com/tootsuite/mastodon
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.

21 lines
537 B

  1. MIGRATION_BASE_CLASS = if ActiveRecord::VERSION::MAJOR >= 5
  2. ActiveRecord::Migration[5.0]
  3. else
  4. ActiveRecord::Migration
  5. end
  6. class RailsSettingsMigration < MIGRATION_BASE_CLASS
  7. def self.up
  8. create_table :settings do |t|
  9. t.string :var, :null => false
  10. t.text :value
  11. t.references :target, :null => false, :polymorphic => true
  12. t.timestamps :null => true
  13. end
  14. add_index :settings, [ :target_type, :target_id, :var ], :unique => true
  15. end
  16. def self.down
  17. drop_table :settings
  18. end
  19. end