I am new to iOS with android background. and after quite sometime searching how to persist data for my project I chose to use SQLite.swift Library by stephencelis. Now, I want to do a simple Table creation:
CREATE TABLE IF NOT EXISTS TableName (
id INTEGER,
name TEXT NOT NULL,
CONSTRAINT Key PRIMARY KEY (id) ON CONFLICT REPLACE);
but I can't find in the documentation any swift keyword for "ON CONFLICT" ... So My implementation now is like this:
static func createTable (db:Connection) {
do {
try db.run(TableName.create(temporary: false, ifNotExists: true, block: {
t in
t.column(id, primaryKey: true)
t.column(name)
}))
} catch {
print ("Unable to create Table TableName")
}
}
How to add the ON CONFLICT clause?