From: Mark Hymers Date: Mon, 21 Mar 2011 21:38:29 +0000 (+0000) Subject: Use PK at twerners suggestion X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4542e2ad5b2900bb52db17e17600a94ddf754444;p=dak Use PK at twerners suggestion Signed-off-by: Mark Hymers --- diff --git a/dak/dakdb/update45.py b/dak/dakdb/update45.py index 0a12d5bc..32ed04f0 100755 --- a/dak/dakdb/update45.py +++ b/dak/dakdb/update45.py @@ -42,7 +42,7 @@ CREATE TABLE extra_src_references ( bin_id INT4 NOT NULL REFERENCES binaries(id) ON DELETE CASCADE, src_id INT4 NOT NULL REFERENCES source(id) ON DELETE RESTRICT, - UNIQUE (bin_id, src_id) + PRIMARY KEY (bin_id, src_id) )""") c.execute("UPDATE config SET value = '45' WHERE name = 'db_revision'") diff --git a/dak/dakdb/update46.py b/dak/dakdb/update46.py index 652a9656..d1b2d3ac 100755 --- a/dak/dakdb/update46.py +++ b/dak/dakdb/update46.py @@ -43,7 +43,9 @@ def do_update(self): c.execute(""" CREATE TABLE metadata_keys ( key_id SERIAL NOT NULL UNIQUE, - key TEXT NOT NULL UNIQUE + key TEXT NOT NULL UNIQUE, + + PRIMARY KEY (key_id) ) """) @@ -52,7 +54,8 @@ CREATE TABLE binaries_metadata ( bin_id INT4 NOT NULL REFERENCES binaries(id) ON DELETE CASCADE, key_id INT4 NOT NULL REFERENCES metadata_keys(key_id), value TEXT NOT NULL, - UNIQUE (bin_id, key_id) + + PRIMARY KEY (bin_id, key_id) ) """) @@ -61,7 +64,8 @@ CREATE TABLE source_metadata ( src_id INT4 NOT NULL REFERENCES source(id) ON DELETE CASCADE, key_id INT4 NOT NULL REFERENCES metadata_keys(key_id), value TEXT NOT NULL, - UNIQUE (src_id, key_id) + + PRIMARY KEY (src_id, key_id) ) """)