diff --git a/src/norm/sqlite.nim b/src/norm/sqlite.nim index 2286e719..da19c44e 100644 --- a/src/norm/sqlite.nim +++ b/src/norm/sqlite.nim @@ -141,14 +141,14 @@ proc createTables*[T: Model](dbConn; obj: T) = dbConn.exec(sql qry) for index, cols in indexes.pairs: - let qry = "CREATE INDEX $# ON $#($#);" % [index, T.table, cols.join(", ")] + let qry = "CREATE INDEX IF NOT EXISTS $# ON $#($#);" % [index, T.table, cols.join(", ")] log(qry) dbConn.exec(sql qry) for index, cols in uniqueIndexes.pairs: - let qry = "CREATE UNIQUE INDEX $# ON $#($#);" % [index, T.table, cols.join(", ")] + let qry = "CREATE UNIQUE INDEX IF NOT EXISTS $# ON $#($#);" % [index, T.table, cols.join(", ")] log(qry)