diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2009-02-07 15:48:37 +1100 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2009-02-07 15:48:37 +1100 |
commit | 5f20247c07c17d266321d49042c525deafe65152 (patch) | |
tree | da3f9a49e2b1e81e619521dcfc26d5f57fc053ce /lib | |
parent | 9b5c682e8ffb1d711f2848e990140383967380d2 (diff) | |
download | patchwork-5f20247c07c17d266321d49042c525deafe65152.tar patchwork-5f20247c07c17d266321d49042c525deafe65152.tar.gz |
Normalise order numbers in bundle-ordering migration SQL
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'lib')
-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; |