Add database constraints

This commit is contained in:
Artur Beljajev 2019-10-24 18:59:57 +03:00
parent cb823bbe1f
commit 9668ec33d9
5 changed files with 58 additions and 18 deletions

View file

@ -899,7 +899,8 @@ CREATE TABLE public.invoice_items (
created_at timestamp without time zone,
updated_at timestamp without time zone,
creator_str character varying,
updator_str character varying
updator_str character varying,
CONSTRAINT invoice_items_quantity_is_positive CHECK ((quantity > 0))
);
@ -968,7 +969,8 @@ CREATE TABLE public.invoices (
total numeric(10,2) NOT NULL,
in_directo boolean DEFAULT false,
buyer_vat_no character varying,
issue_date date NOT NULL
issue_date date NOT NULL,
CONSTRAINT invoices_due_date_is_not_before_issue_date CHECK ((due_date >= issue_date))
);
@ -4878,3 +4880,7 @@ INSERT INTO schema_migrations (version) VALUES ('20191007123000');
INSERT INTO schema_migrations (version) VALUES ('20191008024334');
INSERT INTO schema_migrations (version) VALUES ('20191024153351');
INSERT INTO schema_migrations (version) VALUES ('20191024160038');