Admin contact statuses management #2477

This commit is contained in:
Priit Tark 2015-07-22 13:37:30 +03:00
parent 1f85cec9ac
commit 601592aed1
23 changed files with 335 additions and 190 deletions

View file

@ -0,0 +1,15 @@
class RefactorContactStatuses < ActiveRecord::Migration
def self.up
Contact.find_each do |contact|
statuses = []
contact.depricated_statuses.each do |ds|
statuses << ds.value
end
contact.update_column('statuses', statuses)
end
end
def self.down
raise ActiveRecord::IrreversibleMigration
end
end

View file

@ -0,0 +1,5 @@
class AddStatusesToContact < ActiveRecord::Migration
def change
add_column :contacts, :statuses, :string, array: true
end
end

View file

@ -0,0 +1,6 @@
class AddContactAndDomainStatusNotes < ActiveRecord::Migration
def change
add_column :contacts, :status_notes, :hstore
add_column :domains, :status_notes, :hstore
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: 20150713113436) do
ActiveRecord::Schema.define(version: 20150722071128) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -200,6 +200,7 @@ ActiveRecord::Schema.define(version: 20150713113436) do
t.string "state"
t.integer "legacy_id"
t.string "statuses", array: true
t.hstore "status_notes"
end
add_index "contacts", ["code"], name: "index_contacts_on_code", using: :btree
@ -215,12 +216,6 @@ ActiveRecord::Schema.define(version: 20150713113436) do
t.string "updator_str"
end
create_table "data_migrations", id: false, force: :cascade do |t|
t.string "version", null: false
end
add_index "data_migrations", ["version"], name: "unique_data_migrations", unique: true, using: :btree
create_table "delegation_signers", force: :cascade do |t|
t.integer "domain_id"
t.string "key_tag"
@ -327,6 +322,7 @@ ActiveRecord::Schema.define(version: 20150713113436) do
t.datetime "force_delete_at"
t.string "statuses", array: true
t.boolean "reserved", default: false
t.hstore "status_notes"
end
add_index "domains", ["delete_at"], name: "index_domains_on_delete_at", using: :btree

View file

@ -632,7 +632,8 @@ CREATE TABLE contacts (
country_code character varying,
state character varying,
legacy_id integer,
statuses character varying[]
statuses character varying[],
status_notes hstore
);
@ -689,15 +690,6 @@ CREATE SEQUENCE countries_id_seq
ALTER SEQUENCE countries_id_seq OWNED BY countries.id;
--
-- Name: data_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE data_migrations (
version character varying NOT NULL
);
--
-- Name: delegation_signers; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
@ -945,7 +937,8 @@ CREATE TABLE domains (
pending_json json,
force_delete_at timestamp without time zone,
statuses character varying[],
reserved boolean DEFAULT false
reserved boolean DEFAULT false,
status_notes hstore
);
@ -4519,13 +4512,6 @@ CREATE INDEX index_whois_records_on_domain_id ON whois_records USING btree (doma
CREATE INDEX index_whois_records_on_registrar_id ON whois_records USING btree (registrar_id);
--
-- Name: unique_data_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX unique_data_migrations ON data_migrations USING btree (version);
--
-- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@ -4861,10 +4847,6 @@ 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 ('20150603141054');
INSERT INTO schema_migrations (version) VALUES ('20150603141549');
@ -4873,12 +4855,8 @@ 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');
@ -4887,8 +4865,6 @@ 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 ('20150703084632');
@ -4897,8 +4873,6 @@ INSERT INTO schema_migrations (version) VALUES ('20150706091724');
INSERT INTO schema_migrations (version) VALUES ('20150707103241');
INSERT INTO schema_migrations (version) VALUES ('20150707103801');
INSERT INTO schema_migrations (version) VALUES ('20150707104937');
INSERT INTO schema_migrations (version) VALUES ('20150707154543');
@ -4907,3 +4881,5 @@ INSERT INTO schema_migrations (version) VALUES ('20150709092549');
INSERT INTO schema_migrations (version) VALUES ('20150713113436');
INSERT INTO schema_migrations (version) VALUES ('20150722071128');