diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2009-01-29 17:38:46 +1100 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2009-01-29 17:38:46 +1100 |
commit | c105cb0f107a7459abc8c33988d2da24582a7a5a (patch) | |
tree | b45da7063fc8a4598e169b61d475d6a915e5641e /lib | |
parent | 6eb48bb0ca07765185fc21015fe815be18282f07 (diff) | |
download | patchwork-c105cb0f107a7459abc8c33988d2da24582a7a5a.tar patchwork-c105cb0f107a7459abc8c33988d2da24582a7a5a.tar.gz |
Initial bundle reordering support
todo:
* implement ajax reorder api
* finish migration script
* order patches in bundle view
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sql/migration/005-bundle-patch-ordering.sql | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/sql/migration/005-bundle-patch-ordering.sql b/lib/sql/migration/005-bundle-patch-ordering.sql new file mode 100644 index 0000000..9f5bcf3 --- /dev/null +++ b/lib/sql/migration/005-bundle-patch-ordering.sql @@ -0,0 +1,9 @@ +BEGIN; +ALTER TABLE patchwork_bundle_patches RENAME TO patchwork_bundlepatch; +ALTER TABLE patchwork_bundlepatch ADD COLUMN "order" INTEGER NULL; +UPDATE patchwork_bundlepatch SET "order" = + (SELECT COALESCE(max("order"), 0) + 1 FROM patchwork_bundlepatch AS p2 + WHERE p2.bundle_id = patchwork_bundlepatch.bundle_id); +ALTER TABLE patchwork_bundlepatch ALTER COLUMN "order" SET NOT NULL; +ALTER TABLE patchwork_bundlepatch ADD UNIQUE("bundle_id", "order"); +COMMIT; |