IOS

How to auto generate id with GRDB.swift

And how to only create a table if it doesn’t already exist: as with sqlite, use ifNotExists:

db.create(table: "todo", ifNotExists: true) { t in
    t.autoIncrementedPrimaryKey("id")
    t.column("name", .text).notNull()
}

Standard

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.