From 17e39712c3f9398f4aa6aae9f368f642af615eab Mon Sep 17 00:00:00 2001
From: Jeremy Kerr <jk@ozlabs.org>
Date: Tue, 10 Feb 2009 14:30:38 +1100
Subject: [sql] Fix up bundle-reorder migration script

We need to add grants for the new table, and drop the old to
prevent reference constraint errors.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
---
 lib/sql/migration/005-bundle-patch-ordering.sql | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'lib/sql/migration/005-bundle-patch-ordering.sql')

diff --git a/lib/sql/migration/005-bundle-patch-ordering.sql b/lib/sql/migration/005-bundle-patch-ordering.sql
index 238e37b..f6e37eb 100644
--- a/lib/sql/migration/005-bundle-patch-ordering.sql
+++ b/lib/sql/migration/005-bundle-patch-ordering.sql
@@ -23,10 +23,14 @@ BEGIN;
 ALTER TABLE patchwork_bundlepatch
     ALTER COLUMN "order" TYPE INTEGER;
 
+DROP TABLE patchwork_bundle_patches;
+
 -- normalise ordering: order should start with 1 in each bundle
 UPDATE patchwork_bundlepatch SET "order" = 1 + "order" -
 	(SELECT min("order") FROM patchwork_bundlepatch AS p2
 		WHERE p2.bundle_id = patchwork_bundlepatch.bundle_id);
 
-SELECT * FROM patchwork_bundlepatch;
+GRANT SELECT, INSERT, UPDATE, DELETE ON patchwork_bundlepatch TO "www-data";
+GRANT SELECT, UPDATE ON patchwork_bundlepatch_id_seq TO "www-data";
+
 COMMIT;
-- 
cgit v1.2.3

