Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Start building tables; #449
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Apr 11, 2013
1 parent 46b4fa3 commit 83c7eaa
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions branch.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
-------------------------------------------------------------------------------
-- https://github.com/gittip/www.gittip.com/issues/449

CREATE TABLE companies
( id bigserial PRIMARY KEY
, brand_id bigint NOT NULL REFERENCES brands
ON DELETE RESTRICT ON UPDATE RESTRICT
, voter_id bigint NOT NULL REFERENCES participants.id
ON DELETE RESTRICT ON UPDATE RESTRICT
, candidate_id bigint NOT NULL REFERENCES participants.id
ON DELETE RESTRICT ON UPDATE RESTRICT
, vote int NOT NULL
);

CREATE TABLE brands
( id bigserial PRIMARY KEY
, name text NOT NULL
, name_lower text NOT NULL
, url text NOT NULL
, company_id bigint NOT NULL REFERENCES companies
ON DELETE RESTRICT ON UPDATE RESTRICT
);

CREATE TABLE identifications
( id bigserial PRIMARY KEY
, brand_id bigint NOT NULL REFERENCES brands
ON DELETE RESTRICT ON UPDATE RESTRICT
, identifier_id bigint NOT NULL REFERENCES participants.id
ON DELETE RESTRICT ON UPDATE RESTRICT
, identified_id bigint NOT NULL REFERENCES participants.id
ON DELETE RESTRICT ON UPDATE RESTRICT
, weight int NOT NULL
);

0 comments on commit 83c7eaa

Please sign in to comment.