summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/sql/migration/005-bundle-patch-ordering.sql4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sql/migration/005-bundle-patch-ordering.sql b/lib/sql/migration/005-bundle-patch-ordering.sql
index f6e37eb..3f0ad13 100644
--- a/lib/sql/migration/005-bundle-patch-ordering.sql
+++ b/lib/sql/migration/005-bundle-patch-ordering.sql
@@ -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