X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=lib%2Fsql%2Fmigration%2F005-bundle-patch-ordering.sql;fp=lib%2Fsql%2Fmigration%2F005-bundle-patch-ordering.sql;h=1491aa882fc6098c875c9387a35c9661e0282120;hb=5f20247c07c17d266321d49042c525deafe65152;hp=e0db398e1ee3add1e2f3fb896a1bd7a8ab6a94ac;hpb=9b5c682e8ffb1d711f2848e990140383967380d2;p=patchwork 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;