From: Mark Hymers Date: Tue, 27 Oct 2009 15:12:14 +0000 (+0000) Subject: let there be referential integrity X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e01b30c70f0223ff9aafa33b7009878b1312e6cc;p=dak let there be referential integrity Signed-off-by: Mark Hymers --- diff --git a/dak/dakdb/update15.py b/dak/dakdb/update15.py index 10812226..535f9e67 100644 --- a/dak/dakdb/update15.py +++ b/dak/dakdb/update15.py @@ -43,7 +43,7 @@ def do_update(self): CREATE TABLE src_format ( id SERIAL PRIMARY KEY, format_name TEXT NOT NULL, - unique (format_name) + UNIQUE (format_name) ) """) c.execute("INSERT INTO src_format (format_name) VALUES('1.0')") @@ -52,9 +52,9 @@ def do_update(self): c.execute(""" CREATE TABLE suite_src_formats ( - suite INT4 NOT NULL, - src_format INT4 NOT NULL, - unique (suite, src_format) + suite INT4 NOT NULL REFERENCES suite(id), + src_format INT4 NOT NULL REFERENCES src_format(id), + PRIMARY KEY (suite, src_format) ) """)