Mercurial > prosody-hg
comparison tools/migration/migrator/prosody_sql.lua @ 4234:ce92aafc9c03
tools/migration/migrator/prosody_sql: Throw a friendlier error when LuaDBI is not found
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 05 Apr 2011 12:58:14 +0100 |
| parents | ff80a8471e86 |
| children | 6a372135b4c4 |
comparison
equal
deleted
inserted
replaced
| 4233:3c644c3b10e2 | 4234:ce92aafc9c03 |
|---|---|
| 1 | 1 |
| 2 local assert = assert; | 2 local assert = assert; |
| 3 local DBI = require "DBI"; | 3 local have_DBI, DBI = pcall(require,"DBI"); |
| 4 local print = print; | 4 local print = print; |
| 5 local type = type; | 5 local type = type; |
| 6 local next = next; | 6 local next = next; |
| 7 local pairs = pairs; | 7 local pairs = pairs; |
| 8 local t_sort = table.sort; | 8 local t_sort = table.sort; |
| 9 local json = require "util.json"; | 9 local json = require "util.json"; |
| 10 local mtools = require "migrator.mtools"; | 10 local mtools = require "migrator.mtools"; |
| 11 local tostring = tostring; | 11 local tostring = tostring; |
| 12 local tonumber = tonumber; | 12 local tonumber = tonumber; |
| 13 | |
| 14 if not have_DBI then | |
| 15 error("LuaDBI (required for SQL support) was not found, please see http://prosody.im/doc/depends#luadbi", 0); | |
| 16 end | |
| 13 | 17 |
| 14 module "prosody_sql" | 18 module "prosody_sql" |
| 15 | 19 |
| 16 local function create_table(connection, params) | 20 local function create_table(connection, params) |
| 17 local create_sql = "CREATE TABLE `prosody` (`host` TEXT, `user` TEXT, `store` TEXT, `key` TEXT, `type` TEXT, `value` TEXT);"; | 21 local create_sql = "CREATE TABLE `prosody` (`host` TEXT, `user` TEXT, `store` TEXT, `key` TEXT, `type` TEXT, `value` TEXT);"; |
