Changeset

5885:cbc25ae1eea0

util.sql: Allow creating unique indices
author Kim Alvefur <zash@zash.se>
date Mon, 28 Oct 2013 23:18:54 +0100
parents 5884:9cb81a17ae23
children 5886:1237f9cc3123
files util/sql.lua
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/sql.lua	Mon Oct 28 22:08:46 2013 +0100
+++ b/util/sql.lua	Mon Oct 28 23:18:54 2013 +0100
@@ -251,6 +251,9 @@
 	elseif self.params.driver == "MySQL" then
 		sql = sql:gsub("`([,)])", "`(20)%1");
 	end
+	if index.unique then
+		sql = sql:gsub("^CREATE", "CREATE UNIQUE");
+	end
 	--print(sql);
 	return self:execute(sql);
 end