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 | 6c769838e9a81a145796cb447c03967f5c6fdb7a (patch) | |
tree | 10d4a46e9118315fa61171070a641f34bcf71c50 | |
parent | f925ba7723bf4336b6ad7089e5cfb8841d5ffa4a (diff) | |
download | prosody-6c769838e9a81a145796cb447c03967f5c6fdb7a.tar.gz prosody-6c769838e9a81a145796cb447c03967f5c6fdb7a.zip |
util.sql: Allow creating unique indices
-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 |