From 0b5b2ae0d143337998d1a62d5728c47e26d8fd34 Mon Sep 17 00:00:00 2001 From: aandis Date: Sun, 23 Oct 2016 19:27:05 +0530 Subject: [PATCH] Add id column in emails and foreign key constraint to pacakges. --- sql/branch.sql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sql/branch.sql b/sql/branch.sql index e23a51fd74..fd67fa3add 100644 --- a/sql/branch.sql +++ b/sql/branch.sql @@ -18,8 +18,9 @@ BEGIN; ); CREATE TABLE package_emails - ( package_id bigint NOT NULL - , email text NOT NULL + ( id bigserial PRIMARY KEY + , package_id bigint NOT NULL REFERENCES packages ON UPDATE CASCADE ON DELETE RESTRICT + , email text NOT NULL , UNIQUE (package_id, email) );