From 7a4ec3c57c8e38c49f6527ea00abea9a5dd3ada6 Mon Sep 17 00:00:00 2001
From: Matthew Wild <mwild1@gmail.com>
Date: Wed, 8 Jul 2015 15:04:23 +0100
Subject: util.sql: Create table with same charset as the charset we selected
 for our connection, also use corresponding _bin collation

---
 util/sql.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/sql.lua b/util/sql.lua
index dedef435..562ac709 100644
--- a/util/sql.lua
+++ b/util/sql.lua
@@ -245,7 +245,7 @@ function engine:_create_table(table)
 	if self.params.driver == "PostgreSQL" then
 		sql = sql:gsub("`", "\"");
 	elseif self.params.driver == "MySQL" then
-		sql = sql:gsub(";$", " CHARACTER SET 'utf8' COLLATE 'utf8_bin';");
+		sql = sql:gsub(";$", (" CHARACTER SET '%s' COLLATE '%s_bin';"):format(self.charset, self.charset));
 	end
 	local success,err = self:execute(sql);
 	if not success then return success,err; end
-- 
cgit v1.2.3