Software / code / prosody
Comparison
plugins/mod_storage_sql.lua @ 8079:b058fc4a4243
mod_storage_sql: Quote some field names
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 12 Apr 2017 21:51:17 +0200 |
| parent | 8075:a4dd08fd64cf |
| child | 8080:8833f2ca6e53 |
comparison
equal
deleted
inserted
replaced
| 8077:29b3957db212 | 8079:b058fc4a4243 |
|---|---|
| 460 | 460 |
| 461 local function upgrade_table(engine, params, apply_changes) -- luacheck: ignore 431/engine | 461 local function upgrade_table(engine, params, apply_changes) -- luacheck: ignore 431/engine |
| 462 local changes = false; | 462 local changes = false; |
| 463 if params.driver == "MySQL" then | 463 if params.driver == "MySQL" then |
| 464 local success,err = engine:transaction(function() | 464 local success,err = engine:transaction(function() |
| 465 local result = engine:execute("SHOW COLUMNS FROM prosody WHERE Field='value' and Type='text'"); | 465 local result = engine:execute("SHOW COLUMNS FROM \"prosody\" WHERE \"Field\"='value' and \"Type\"='text'"); |
| 466 if result:rowcount() > 0 then | 466 if result:rowcount() > 0 then |
| 467 changes = true; | 467 changes = true; |
| 468 if apply_changes then | 468 if apply_changes then |
| 469 module:log("info", "Upgrading database schema..."); | 469 module:log("info", "Upgrading database schema..."); |
| 470 engine:execute("ALTER TABLE prosody MODIFY COLUMN \"value\" MEDIUMTEXT"); | 470 engine:execute("ALTER TABLE \"prosody\" MODIFY COLUMN \"value\" MEDIUMTEXT"); |
| 471 module:log("info", "Database table automatically upgraded"); | 471 module:log("info", "Database table automatically upgraded"); |
| 472 end | 472 end |
| 473 end | 473 end |
| 474 return true; | 474 return true; |
| 475 end); | 475 end); |