aboutsummaryrefslogtreecommitdiffstats
path: root/util/sql.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-10-28 23:18:54 +0100
committerKim Alvefur <zash@zash.se>2013-10-28 23:18:54 +0100
commit9c9c79584776f8c53ab240fb55ae3121d6095b70 (patch)
tree10d4a46e9118315fa61171070a641f34bcf71c50 /util/sql.lua
parent9b8315dd292d744f26daabe4afbc7d94e09bb61a (diff)
downloadprosody-9c9c79584776f8c53ab240fb55ae3121d6095b70.tar.gz
prosody-9c9c79584776f8c53ab240fb55ae3121d6095b70.zip
util.sql: Allow creating unique indices
Diffstat (limited to 'util/sql.lua')
-rw-r--r--util/sql.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/sql.lua b/util/sql.lua
index 972940f7..736417bb 100644
--- a/util/sql.lua
+++ b/util/sql.lua
@@ -251,6 +251,9 @@ function engine:_create_index(index)
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