Merge branch 'master' of github.com:internetee/registry

This commit is contained in:
Andres Keskküla 2014-10-16 12:39:27 +03:00
commit 02e313db46
41 changed files with 237 additions and 695 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

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20141014073435) do
ActiveRecord::Schema.define(version: 20141015135742) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -253,15 +253,16 @@ ActiveRecord::Schema.define(version: 20141014073435) do
t.datetime "updated_at"
end
create_table "setting_groups", force: true do |t|
t.string "code"
create_table "settings", force: true do |t|
t.string "var", null: false
t.text "value"
t.integer "thing_id"
t.string "thing_type", limit: 30
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "settings", force: true do |t|
t.integer "setting_group_id"
t.string "code"
t.string "value"
end
add_index "settings", ["thing_type", "thing_id", "var"], name: "index_settings_on_thing_type_and_thing_id_and_var", unique: true, using: :btree
create_table "users", force: true do |t|
t.string "username"

View file

@ -66,27 +66,14 @@ User.where(
country: Country.where(name: 'Estonia').first
).first_or_create
sg = SettingGroup.where(code: 'domain_validation').first_or_create
Setting.ds_algorithm = 2
Setting.ds_data_allowed = true
Setting.ds_data_with_key_allowed = true
Setting.key_data_allowed = true
s_1 = Setting.where(code: 'ns_min_count').first_or_create
s_1.value = 1
Setting.dnskeys_min_count = 0
Setting.dnskeys_max_count = 9
Setting.ns_min_count = 2
Setting.ns_max_count = 11
s_2 = Setting.where(code: 'ns_max_count').first_or_create
s_2.value = 13
s_3 = Setting.where(code: 'dnskeys_min_count').first_or_create
s_3.value = 0
s_4 = Setting.where(code: 'dnskeys_max_count').first_or_create
s_4.value = 9
sg.settings = [s_1, s_2, s_3, s_4]
sg.save
sg = SettingGroup.where(code: 'domain_general').first_or_create
s_1 = Setting.where(code: 'transfer_wait_time').first_or_create
s_1.value = 0
sg.settings = [s_1]
sg.save
Setting.transfer_wait_time = 0