From 05ccbff4dd425a4e5db02fbb79cb19faf573640e Mon Sep 17 00:00:00 2001
From: Mark Hymers <mhy@debian.org>
Date: Fri, 30 Oct 2009 13:49:38 +0000
Subject: [PATCH] fix up policy_queue support in the ORM and drop old column

Signed-off-by: Mark Hymers <mhy@debian.org>
---
 dak/dakdb/update20.py | 3 ++-
 daklib/dbconn.py      | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dak/dakdb/update20.py b/dak/dakdb/update20.py
index 61497c21..27df549b 100755
--- a/dak/dakdb/update20.py
+++ b/dak/dakdb/update20.py
@@ -80,7 +80,8 @@ def do_update(self):
         c.execute("ALTER TABLE known_changes ADD COLUMN approved_for INT4 REFERENCES queue(id) DEFAULT NULL")
 
         print "Adding policy queue column to suite table"
-        c.execute("ALTER TABLE suite ADD COLUMN policy_queue INT4 REFERENCES queue(id) DEFAULT NULL")
+        c.execute("ALTER TABLE suite DROP COLUMN policy_engine")
+        c.execute("ALTER TABLE suite ADD COLUMN policy_queue_id INT4 REFERENCES queue(id) DEFAULT NULL")
         # Handle some of our common cases automatically
         if seenqueues.has_key('proposedupdates'):
             c.execute("""UPDATE suite SET policy_queue = (SELECT id FROM queue WHERE queue_name = 'proposedupdates')
diff --git a/daklib/dbconn.py b/daklib/dbconn.py
index 45e000d3..75d271bd 100755
--- a/daklib/dbconn.py
+++ b/daklib/dbconn.py
@@ -2552,7 +2552,8 @@ class DBConn(Singleton):
                                                        primaryjoin=(self.tbl_src_uploaders.c.maintainer==self.tbl_maintainer.c.id))))
 
         mapper(Suite, self.tbl_suite,
-               properties = dict(suite_id = self.tbl_suite.c.id))
+               properties = dict(suite_id = self.tbl_suite.c.id,
+                                 policy_queue = relation(Queue)))
 
         mapper(SuiteArchitecture, self.tbl_suite_architectures,
                properties = dict(suite_id = self.tbl_suite_architectures.c.suite,
-- 
2.39.5