Changeset

5884:9cb81a17ae23

mod_storage_sql2: Move checking of the sql_manage_tables option so it also includes table upgrades (again)
author Kim Alvefur <zash@zash.se>
date Mon, 28 Oct 2013 22:08:46 +0100
parents 5883:39b187e7e892
children 5885:cbc25ae1eea0
files plugins/mod_storage_sql2.lua
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_storage_sql2.lua	Mon Oct 28 22:07:16 2013 +0100
+++ b/plugins/mod_storage_sql2.lua	Mon Oct 28 22:08:46 2013 +0100
@@ -41,9 +41,6 @@
 	engine:transaction(function()
 		ProsodyTable:create(engine);
 	end);]]
-	if not module:get_option("sql_manage_tables", true) then
-		return;
-	end
 
 	local create_sql = "CREATE TABLE `prosody` (`host` TEXT, `user` TEXT, `store` TEXT, `key` TEXT, `type` TEXT, `value` TEXT);";
 	if params.driver == "PostgreSQL" then
@@ -138,10 +135,12 @@
 
 	engine:set_encoding();
 
-	-- Automatically create table, ignore failure (table probably already exists)
-	create_table();
-	-- Encoding mess
-	upgrade_table();
+	if module:get_option("sql_manage_tables", true) then
+		-- Automatically create table, ignore failure (table probably already exists)
+		create_table();
+		-- Encoding mess
+		upgrade_table();
+	end
 end
 
 local function serialize(value)