tools/migration/migrator/prosody_sql: Throw a friendlier error when LuaDBI is not...
authorMatthew Wild <mwild1@gmail.com>
Tue, 5 Apr 2011 11:58:14 +0000 (12:58 +0100)
committerMatthew Wild <mwild1@gmail.com>
Tue, 5 Apr 2011 11:58:14 +0000 (12:58 +0100)
tools/migration/migrator/prosody_sql.lua

index 3a9172ff6e0c16d5d03cefebdf7d252511c73e80..b1f836beaed1d78178e2f9e1128cfba93c660b53 100644 (file)
@@ -1,6 +1,6 @@
 
 local assert = assert;
-local DBI = require "DBI";
+local have_DBI, DBI = pcall(require,"DBI");
 local print = print;
 local type = type;
 local next = next;
@@ -11,6 +11,10 @@ local mtools = require "migrator.mtools";
 local tostring = tostring;
 local tonumber = tonumber;
 
+if not have_DBI then
+       error("LuaDBI (required for SQL support) was not found, please see http://prosody.im/doc/depends#luadbi", 0);
+end
+
 module "prosody_sql"
 
 local function create_table(connection, params)