summaryrefslogtreecommitdiffstats
path: root/lib/sql
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2008-09-10 11:21:19 +1000
committerJeremy Kerr <jk@ozlabs.org>2008-09-10 11:21:19 +1000
commitd075be0a249133942434c8ea1f936ec9b055327a (patch)
tree4a59d0173e1da8e7e1517fa77675b3e3f7c7e71a /lib/sql
parent6351649917f6dd399135284ad4a845e698824ef6 (diff)
downloadpatchwork-d075be0a249133942434c8ea1f936ec9b055327a.tar.bz2
patchwork-d075be0a249133942434c8ea1f936ec9b055327a.tar.xz
Use hex strings for hash values
Binary strings a too hard to manage in DB queries and XMLRPC methods, as we get all kinds of encoding issues. Change HashField to use a hex string, and add a migration script for db updates. The patches should be rehashed after migration. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'lib/sql')
-rw-r--r--lib/sql/migration/001-hex-hash-types.sql8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/sql/migration/001-hex-hash-types.sql b/lib/sql/migration/001-hex-hash-types.sql
new file mode 100644
index 0000000..cef6b0b
--- /dev/null
+++ b/lib/sql/migration/001-hex-hash-types.sql
@@ -0,0 +1,8 @@
+BEGIN;
+ALTER TABLE patchwork_patch ALTER COLUMN hash DROP NOT NULL;
+UPDATE patchwork_patch SET hash = NULL;
+COMMIT;
+BEGIN;
+ALTER TABLE patchwork_patch ALTER COLUMN hash TYPE CHAR(40);
+CREATE INDEX "patchwork_patch_hash" ON "patchwork_patch" ("hash");
+COMMIT;