]> git.decadent.org.uk Git - dak.git/commitdiff
let there be referential integrity
authorMark Hymers <mhy@debian.org>
Tue, 27 Oct 2009 15:12:14 +0000 (15:12 +0000)
committerMark Hymers <mhy@debian.org>
Tue, 27 Oct 2009 15:12:14 +0000 (15:12 +0000)
Signed-off-by: Mark Hymers <mhy@debian.org>
dak/dakdb/update15.py

index 10812226d519c581c9fe8d78983e0ede28268399..535f9e67cc2bf5890e2213726d337bc9ada74119 100644 (file)
@@ -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)
             )
         """)