Software /
code /
prosody
Diff
util/sql.lua @ 5885:cbc25ae1eea0
util.sql: Allow creating unique indices
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 28 Oct 2013 23:18:54 +0100 |
parent | 5883:39b187e7e892 |
child | 5886:1237f9cc3123 |
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