Open
Description
Issues are used to track bugs and feature requests.
Need help or have a general question? Ask on Stack Overflow (tag sqlite.swift).
Build Information
- Include the SQLite.swift version, commit or branch experiencing the issue.
0.12.2 - Mention Xcode and OS X versions affected.
- Xcode 13.0, iOS 15.0
- How do do you integrate SQLite.swift in your project?
- manual
General guidelines
Column check constraints seem to generate invalid SQL:
I'm creating a table with:
let validTypeRange = 0...26
try connection.writeConnection.savepoint {
try connection.writeConnection.run(observations.create { builder in
builder.column(Expression.identifier)
builder.column(Expression.date)
builder.column(Expression.type, check: validTypeRange ~= Expression.type)
// builder.check(validTypeRange ~= Expression.type)
})
And it generates a syntax error:
[logging] near ""type"": syntax error in "CREATE TABLE "Observations" ("identifier" BLOB NOT NULL, "date" TEXT NOT NULL, "type" INTEGER NOT NULL CHECK "type" BETWEEN 0 AND 26)"
If I use table checks instead of column checks, it works fine.
Expression.type is:
Expression("type")