# HG changeset patch # User Kim Alvefur # Date 1382998734 -3600 # Node ID cbc25ae1eea0679c45e8ce8a9eacfc64fbb330de # Parent 9cb81a17ae236c4b498e74ddc23690b41cbff634 util.sql: Allow creating unique indices diff -r 9cb81a17ae23 -r cbc25ae1eea0 util/sql.lua --- 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