From d075be0a249133942434c8ea1f936ec9b055327a Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Wed, 10 Sep 2008 11:21:19 +1000 Subject: 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 --- lib/sql/migration/001-hex-hash-types.sql | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 lib/sql/migration/001-hex-hash-types.sql (limited to 'lib') 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; -- cgit v1.2.3