diff --git a/app/models/settings.rb b/app/models/settings.rb new file mode 100644 index 000000000..2ef2c2ec0 --- /dev/null +++ b/app/models/settings.rb @@ -0,0 +1,7 @@ +class Settings < ActiveRecord::Base + @instance = first + + def self.instance + @instance ||= new + end +end diff --git a/db/migrate/20170217141402_create_settings_table.rb b/db/migrate/20170217141402_create_settings_table.rb new file mode 100644 index 000000000..27608f44e --- /dev/null +++ b/db/migrate/20170217141402_create_settings_table.rb @@ -0,0 +1,9 @@ +class CreateSettingsTable < ActiveRecord::Migration + def change + create_table :settings do |t| + t.text :type, null: false + t.jsonb :values, null: false, default: '{}' + end + add_index(:settings, :type, unique: true) + end +end