Refactor settings

This commit is contained in:
Martin Lensment 2014-10-15 17:49:42 +03:00
parent 26f5eda636
commit dafcb6f78c
25 changed files with 132 additions and 282 deletions

View file

@ -1,9 +0,0 @@
class CreateSettings < ActiveRecord::Migration
def change
create_table :settings do |t|
t.integer :setting_group_id
t.string :code
t.string :value
end
end
end

View file

@ -0,0 +1,18 @@
class CreateSettings < ActiveRecord::Migration
def self.up
drop_table :settings
create_table :settings do |t|
t.string :var, :null => false
t.text :value, :null => true
t.integer :thing_id, :null => true
t.string :thing_type, :limit => 30, :null => true
t.timestamps
end
add_index :settings, [ :thing_type, :thing_id, :var ], :unique => true
end
def self.down
drop_table :settings
end
end

View file

@ -0,0 +1,17 @@
class CorrectSettings < ActiveRecord::Migration
def up
drop_table :setting_groups
Setting.ds_algorithm = 2
Setting.ds_data_allowed = true
Setting.ds_data_with_key_allowed = true
Setting.key_data_allowed = true
Setting.dnskeys_min_count = 0
Setting.dnskeys_max_count = 9
Setting.ns_min_count = 2
Setting.ns_max_count = 11
Setting.transfer_wait_time = 0
end
end