diff --git a/app/models/domain.rb b/app/models/domain.rb index 5745242a0..d67b8f929 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -61,6 +61,7 @@ class Domain < ActiveRecord::Base before_create :generate_auth_info before_create :set_validity_dates + before_create -> { self.reserved = in_reserved_list?; nil } before_update :manage_statuses def manage_statuses return unless registrant_id_changed? diff --git a/db/migrate/20150709092549_add_reserved_field_to_domain.rb b/db/migrate/20150709092549_add_reserved_field_to_domain.rb new file mode 100644 index 000000000..676253575 --- /dev/null +++ b/db/migrate/20150709092549_add_reserved_field_to_domain.rb @@ -0,0 +1,5 @@ +class AddReservedFieldToDomain < ActiveRecord::Migration + def change + add_column :domains, :reserved, :boolean, default: false + end +end diff --git a/db/schema-read-only.rb b/db/schema-read-only.rb index 174cd27d7..21e70ef04 100644 --- a/db/schema-read-only.rb +++ b/db/schema-read-only.rb @@ -11,7 +11,7 @@ # # 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 enable_extension "plpgsql" @@ -323,7 +323,8 @@ ActiveRecord::Schema.define(version: 20150707154543) do t.string "registrant_verification_token" t.json "pending_json" t.datetime "force_delete_at" - t.string "statuses", array: true + t.string "statuses", array: true + t.boolean "reserved", default: false end 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| 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.text "job_class", null: false t.json "args", default: [], null: false diff --git a/db/structure.sql b/db/structure.sql index 17187a88f..f102344a1 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -942,7 +942,8 @@ CREATE TABLE domains ( registrant_verification_token character varying, pending_json json, 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 ( 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_class text 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 ('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 ('20150603211318'); 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 ('20150610111019'); - INSERT INTO schema_migrations (version) VALUES ('20150610112238'); 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 ('20150612125720'); - 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 ('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 ('20150709092549'); + diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index 13abf606f..ac5f37ff6 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -144,6 +144,7 @@ describe 'EPP Domain', epp: true do response[:result_code].should == '1000' d = Domain.last d.legal_documents.count.should == 1 + d.reserved.should == false end # it 'creates ria.ee with valid ds record' do @@ -244,6 +245,7 @@ describe 'EPP Domain', epp: true do d = Domain.last d.statuses.should match_array(['ok']) d.auth_info.should_not == 'abc' # should generate entirely new auth info after domain create + d.reserved.should == true end it 'does not create blocked domain' do