diff options
author | Kim Alvefur <zash@zash.se> | 2013-10-28 23:18:54 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2013-10-28 23:18:54 +0100 |
commit | 9c9c79584776f8c53ab240fb55ae3121d6095b70 (patch) | |
tree | 10d4a46e9118315fa61171070a641f34bcf71c50 /util/sql.lua | |
parent | 9b8315dd292d744f26daabe4afbc7d94e09bb61a (diff) | |
download | prosody-9c9c79584776f8c53ab240fb55ae3121d6095b70.tar.gz prosody-9c9c79584776f8c53ab240fb55ae3121d6095b70.zip |
util.sql: Allow creating unique indices
Diffstat (limited to 'util/sql.lua')
-rw-r--r-- | util/sql.lua | 3 |
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 |