diff options
-rw-r--r-- | lib/sql/migration/005-bundle-patch-ordering.sql | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/sql/migration/005-bundle-patch-ordering.sql b/lib/sql/migration/005-bundle-patch-ordering.sql index e0db398..1491aa8 100644 --- a/lib/sql/migration/005-bundle-patch-ordering.sql +++ b/lib/sql/migration/005-bundle-patch-ordering.sql @@ -8,4 +8,7 @@ ALTER TABLE patchwork_bundlepatch ALTER TABLE patchwork_bundlepatch ALTER COLUMN "order" DROP DEFAULT; DROP SEQUENCE bundlepatch_tmp_seq; ALTER TABLE patchwork_bundlepatch ADD UNIQUE("bundle_id", "order"); +UPDATE patchwork_bundlepatch SET "order" = 1 + "order" - + (SELECT min("order") FROM patchwork_bundlepatch AS p2 + WHERE p2.bundle_id = patchwork_bundlepatch.bundle_id); COMMIT; |