Add reserved boolean to domain #2565

This commit is contained in:
Martin Lensment 2015-07-09 12:55:41 +03:00
parent 873070cb96
commit 55b746a428
5 changed files with 17 additions and 21 deletions

View file

@ -61,6 +61,7 @@ class Domain < ActiveRecord::Base
before_create :generate_auth_info before_create :generate_auth_info
before_create :set_validity_dates before_create :set_validity_dates
before_create -> { self.reserved = in_reserved_list?; nil }
before_update :manage_statuses before_update :manage_statuses
def manage_statuses def manage_statuses
return unless registrant_id_changed? return unless registrant_id_changed?

View file

@ -0,0 +1,5 @@
class AddReservedFieldToDomain < ActiveRecord::Migration
def change
add_column :domains, :reserved, :boolean, default: false
end
end

View file

@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150707154543) do ActiveRecord::Schema.define(version: 20150709092549) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -323,7 +323,8 @@ ActiveRecord::Schema.define(version: 20150707154543) do
t.string "registrant_verification_token" t.string "registrant_verification_token"
t.json "pending_json" t.json "pending_json"
t.datetime "force_delete_at" t.datetime "force_delete_at"
t.string "statuses", array: true t.string "statuses", array: true
t.boolean "reserved", default: false
end end
add_index "domains", ["delete_at"], name: "index_domains_on_delete_at", using: :btree add_index "domains", ["delete_at"], name: "index_domains_on_delete_at", using: :btree
@ -935,7 +936,7 @@ ActiveRecord::Schema.define(version: 20150707154543) do
create_table "que_jobs", id: false, force: :cascade do |t| create_table "que_jobs", id: false, force: :cascade do |t|
t.integer "priority", limit: 2, default: 100, null: false t.integer "priority", limit: 2, default: 100, null: false
t.datetime "run_at", default: '2015-06-30 14:16:49', null: false t.datetime "run_at", default: '2015-06-30 14:16:50', null: false
t.integer "job_id", limit: 8, default: 0, null: false t.integer "job_id", limit: 8, default: 0, null: false
t.text "job_class", null: false t.text "job_class", null: false
t.json "args", default: [], null: false t.json "args", default: [], null: false

View file

@ -942,7 +942,8 @@ CREATE TABLE domains (
registrant_verification_token character varying, registrant_verification_token character varying,
pending_json json, pending_json json,
force_delete_at timestamp without time zone, force_delete_at timestamp without time zone,
statuses character varying[] statuses character varying[],
reserved boolean DEFAULT false
); );
@ -2419,7 +2420,7 @@ ALTER SEQUENCE pricelists_id_seq OWNED BY pricelists.id;
CREATE TABLE que_jobs ( CREATE TABLE que_jobs (
priority smallint DEFAULT 100 NOT NULL, priority smallint DEFAULT 100 NOT NULL,
run_at timestamp without time zone DEFAULT '2015-06-30 14:16:49.190473'::timestamp without time zone NOT NULL, run_at timestamp without time zone DEFAULT '2015-06-30 14:16:50.905537'::timestamp without time zone NOT NULL,
job_id bigint DEFAULT 0 NOT NULL, job_id bigint DEFAULT 0 NOT NULL,
job_class text NOT NULL, job_class text NOT NULL,
args json DEFAULT '[]'::json NOT NULL, args json DEFAULT '[]'::json NOT NULL,
@ -4807,26 +4808,14 @@ INSERT INTO schema_migrations (version) VALUES ('20150520164507');
INSERT INTO schema_migrations (version) VALUES ('20150521120145'); INSERT INTO schema_migrations (version) VALUES ('20150521120145');
INSERT INTO schema_migrations (version) VALUES ('20150522164020');
INSERT INTO schema_migrations (version) VALUES ('20150525075550');
INSERT INTO schema_migrations (version) VALUES ('20150601083516');
INSERT INTO schema_migrations (version) VALUES ('20150601083800');
INSERT INTO schema_migrations (version) VALUES ('20150603141549'); INSERT INTO schema_migrations (version) VALUES ('20150603141549');
INSERT INTO schema_migrations (version) VALUES ('20150603211318'); INSERT INTO schema_migrations (version) VALUES ('20150603211318');
INSERT INTO schema_migrations (version) VALUES ('20150603212659'); INSERT INTO schema_migrations (version) VALUES ('20150603212659');
INSERT INTO schema_migrations (version) VALUES ('20150609093515');
INSERT INTO schema_migrations (version) VALUES ('20150609103333'); INSERT INTO schema_migrations (version) VALUES ('20150609103333');
INSERT INTO schema_migrations (version) VALUES ('20150610111019');
INSERT INTO schema_migrations (version) VALUES ('20150610112238'); INSERT INTO schema_migrations (version) VALUES ('20150610112238');
INSERT INTO schema_migrations (version) VALUES ('20150610144547'); INSERT INTO schema_migrations (version) VALUES ('20150610144547');
@ -4835,12 +4824,8 @@ INSERT INTO schema_migrations (version) VALUES ('20150611124920');
INSERT INTO schema_migrations (version) VALUES ('20150612123111'); INSERT INTO schema_migrations (version) VALUES ('20150612123111');
INSERT INTO schema_migrations (version) VALUES ('20150612125720');
INSERT INTO schema_migrations (version) VALUES ('20150701074344'); INSERT INTO schema_migrations (version) VALUES ('20150701074344');
INSERT INTO schema_migrations (version) VALUES ('20150703084206');
INSERT INTO schema_migrations (version) VALUES ('20150703084632'); INSERT INTO schema_migrations (version) VALUES ('20150703084632');
INSERT INTO schema_migrations (version) VALUES ('20150706091724'); INSERT INTO schema_migrations (version) VALUES ('20150706091724');
@ -4849,3 +4834,5 @@ INSERT INTO schema_migrations (version) VALUES ('20150707104937');
INSERT INTO schema_migrations (version) VALUES ('20150707154543'); INSERT INTO schema_migrations (version) VALUES ('20150707154543');
INSERT INTO schema_migrations (version) VALUES ('20150709092549');

View file

@ -144,6 +144,7 @@ describe 'EPP Domain', epp: true do
response[:result_code].should == '1000' response[:result_code].should == '1000'
d = Domain.last d = Domain.last
d.legal_documents.count.should == 1 d.legal_documents.count.should == 1
d.reserved.should == false
end end
# it 'creates ria.ee with valid ds record' do # it 'creates ria.ee with valid ds record' do
@ -244,6 +245,7 @@ describe 'EPP Domain', epp: true do
d = Domain.last d = Domain.last
d.statuses.should match_array(['ok']) d.statuses.should match_array(['ok'])
d.auth_info.should_not == 'abc' # should generate entirely new auth info after domain create d.auth_info.should_not == 'abc' # should generate entirely new auth info after domain create
d.reserved.should == true
end end
it 'does not create blocked domain' do it 'does not create blocked domain' do