906 local db_uri = sql.db2uri(params); |
906 local db_uri = sql.db2uri(params); |
907 engine = engines[db_uri]; |
907 engine = engines[db_uri]; |
908 if not engine then |
908 if not engine then |
909 module:log("debug", "Creating new engine %s", db_uri); |
909 module:log("debug", "Creating new engine %s", db_uri); |
910 engine = sql:create_engine(params, function (engine) -- luacheck: ignore 431/engine |
910 engine = sql:create_engine(params, function (engine) -- luacheck: ignore 431/engine |
911 if module:get_option("sql_manage_tables", true) then |
911 if module:get_option_boolean("sql_manage_tables", true) then |
912 -- Automatically create table, ignore failure (table probably already exists) |
912 -- Automatically create table, ignore failure (table probably already exists) |
913 -- FIXME: we should check in information_schema, etc. |
913 -- FIXME: we should check in information_schema, etc. |
914 create_table(engine); |
914 create_table(engine); |
915 -- Check whether the table needs upgrading |
915 -- Check whether the table needs upgrading |
916 if upgrade_table(engine, params, false) then |
916 if upgrade_table(engine, params, false) then |