]> git.ozlabs.org Git - patchwork/blobdiff - lib/sql/migration/005-bundle-patch-ordering.sql
migration: fix whitespace
[patchwork] / lib / sql / migration / 005-bundle-patch-ordering.sql
index f6e37eb01853513d0c23aa4c3162e686885ed0cd..cd2183a83e3ca8b824b81d11734cd84a04d5add1 100644 (file)
@@ -1,5 +1,5 @@
 BEGIN;
-CREATE TABLE "patchwork_bundlepatch" (                                          
+CREATE TABLE "patchwork_bundlepatch" (
     "id" SERIAL NOT NULL PRIMARY KEY,
     "patch_id" INTEGER NOT NULL
         REFERENCES "patchwork_patch" ("id") DEFERRABLE INITIALLY DEFERRED,
@@ -23,6 +23,10 @@ BEGIN;
 ALTER TABLE patchwork_bundlepatch
     ALTER COLUMN "order" TYPE INTEGER;
 
+-- initialise the starting number for this sequence
+SELECT setval('patchwork_bundlepatch_id_seq',
+        (SELECT max(id) + 1 FROM patchwork_bundlepatch));
+
 DROP TABLE patchwork_bundle_patches;
 
 -- normalise ordering: order should start with 1 in each bundle