mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
Add contacts.code
constraints
This commit is contained in:
parent
46f11155cb
commit
76782c72e3
3 changed files with 31 additions and 1 deletions
|
@ -0,0 +1,5 @@
|
||||||
|
class ChangeContactsCodeToNotNull < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
change_column_null :contacts, :code, false
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,13 @@
|
||||||
|
class AddUniqueConstraintToContactsCode < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
execute <<-SQL
|
||||||
|
ALTER TABLE contacts ADD CONSTRAINT unique_contact_code UNIQUE (code)
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
execute <<-SQL
|
||||||
|
ALTER TABLE contacts DROP CONSTRAINT unique_contact_code
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
end
|
|
@ -644,7 +644,7 @@ ALTER SEQUENCE contact_statuses_id_seq OWNED BY contact_statuses.id;
|
||||||
|
|
||||||
CREATE TABLE contacts (
|
CREATE TABLE contacts (
|
||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
code character varying,
|
code character varying NOT NULL,
|
||||||
phone character varying,
|
phone character varying,
|
||||||
email character varying,
|
email character varying,
|
||||||
fax character varying,
|
fax character varying,
|
||||||
|
@ -3627,6 +3627,14 @@ ALTER TABLE ONLY settings
|
||||||
ADD CONSTRAINT settings_pkey PRIMARY KEY (id);
|
ADD CONSTRAINT settings_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: unique_contact_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY contacts
|
||||||
|
ADD CONSTRAINT unique_contact_code UNIQUE (code);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: unique_zone_origin; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
-- Name: unique_zone_origin; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -5068,3 +5076,7 @@ INSERT INTO schema_migrations (version) VALUES ('20180123170112');
|
||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20180125092422');
|
INSERT INTO schema_migrations (version) VALUES ('20180125092422');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20180126104536');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20180126104903');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue