aboutsummaryrefslogtreecommitdiffstats
path: root/tools/migration/migrator/prosody_sql.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-04-10 23:16:13 +0200
committerKim Alvefur <zash@zash.se>2017-04-10 23:16:13 +0200
commit8a9dd05b08a3a85b84680547e9b0f2027499fd37 (patch)
treee163b8572f88719bc01ba397d169da78c4fc8d48 /tools/migration/migrator/prosody_sql.lua
parentf01822fbfc55fa0cdde361c179f02b044ceb7bcf (diff)
parent91baabfede04fcead2849a35d71a706c9042d074 (diff)
downloadprosody-8a9dd05b08a3a85b84680547e9b0f2027499fd37.tar.gz
prosody-8a9dd05b08a3a85b84680547e9b0f2027499fd37.zip
Merge 0.10->trunk
Diffstat (limited to 'tools/migration/migrator/prosody_sql.lua')
-rw-r--r--tools/migration/migrator/prosody_sql.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/migration/migrator/prosody_sql.lua b/tools/migration/migrator/prosody_sql.lua
index eed499d2..6df2b025 100644
--- a/tools/migration/migrator/prosody_sql.lua
+++ b/tools/migration/migrator/prosody_sql.lua
@@ -92,9 +92,9 @@ local function needs_upgrade(engine, params)
-- 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 @@ local function reader(input)
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 @@ local function writer(output, iter)
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