Diff

tools/migration/migrator/prosody_sql.lua @ 8074:4b403f881176

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Mon, 10 Apr 2017 23:16:13 +0200
parent 8068:5abb6bc45edd
parent 8073:7361412a9664
line wrap: on
line diff
--- a/tools/migration/migrator/prosody_sql.lua	Sun Apr 09 01:25:58 2017 +0200
+++ b/tools/migration/migrator/prosody_sql.lua	Mon Apr 10 23:16:13 2017 +0200
@@ -92,9 +92,9 @@
 
 			-- COMPAT w/pre-0.10: Upgrade table to UTF-8 if not already
 			local check_encoding_query = [[
-			SELECT `COLUMN_NAME`,`COLUMN_TYPE`,`TABLE_NAME`
-			FROM `information_schema`.`columns`
-			WHERE `TABLE_NAME` LIKE 'prosody%%' AND ( `CHARACTER_SET_NAME`!='%s' OR `COLLATION_NAME`!='%s_bin' );
+			SELECT "COLUMN_NAME","COLUMN_TYPE","TABLE_NAME"
+			FROM "information_schema"."columns"
+			WHERE "TABLE_NAME" LIKE 'prosody%%' AND ( "CHARACTER_SET_NAME"!='%s' OR "COLLATION_NAME"!='%s_bin' );
 			]];
 			check_encoding_query = check_encoding_query:format(engine.charset, engine.charset);
 			local result = engine:execute(check_encoding_query);
@@ -116,7 +116,7 @@
 	end));
 	local keys = {"host", "user", "store", "key", "type", "value"};
 	assert(engine:connect());
-	local f,s,val = assert(engine:select("SELECT `host`, `user`, `store`, `key`, `type`, `value` FROM `prosody`;"));
+	local f,s,val = assert(engine:select("SELECT \"host\", \"user\", \"store\", \"key\", \"type\", \"value\" FROM \"prosody\";"));
 	-- get SQL rows, sorted
 	local iter = mtools.sorted {
 		reader = function() val = f(s, val); return val; end;
@@ -157,8 +157,8 @@
 		create_table(engine);
 	end));
 	assert(engine:connect());
-	assert(engine:delete("DELETE FROM prosody"));
-	local insert_sql = "INSERT INTO `prosody` (`host`,`user`,`store`,`key`,`type`,`value`) VALUES (?,?,?,?,?,?)";
+	assert(engine:delete("DELETE FROM \"prosody\""));
+	local insert_sql = "INSERT INTO \"prosody\" (\"host\",\"user\",\"store\",\"key\",\"type\",\"value\") VALUES (?,?,?,?,?,?)";
 
 	return function(item)
 		if not item then assert(engine.conn:commit()) return end -- end of input