diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-10-07 13:17:56 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-10-07 13:17:56 +0200 |
commit | 06016453bd91882a53e91c11fc80f2c75fd474bb (patch) | |
tree | 1effbffae4db31206aff69efecb431407f70a924 /db/migrate | |
parent | 943c69c65d6410d1689d4494c9214c90654db56b (diff) |
Adding user settings (model and mailer), no form yet
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20161006213403_rails_settings_migration.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/db/migrate/20161006213403_rails_settings_migration.rb b/db/migrate/20161006213403_rails_settings_migration.rb new file mode 100644 index 000000000..3bfd8af8e --- /dev/null +++ b/db/migrate/20161006213403_rails_settings_migration.rb @@ -0,0 +1,21 @@ +MIGRATION_BASE_CLASS = if ActiveRecord::VERSION::MAJOR >= 5 + ActiveRecord::Migration[5.0] +else + ActiveRecord::Migration +end + +class RailsSettingsMigration < MIGRATION_BASE_CLASS + def self.up + create_table :settings do |t| + t.string :var, :null => false + t.text :value + t.references :target, :null => false, :polymorphic => true + t.timestamps :null => true + end + add_index :settings, [ :target_type, :target_id, :var ], :unique => true + end + + def self.down + drop_table :settings + end +end |