Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Collate .nocase strictly enforces NOT NULL even when using Optional #697

Closed
Laptopmini opened this issue Aug 1, 2017 · 0 comments
Closed

Comments

@Laptopmini
Copy link

Laptopmini commented Aug 1, 2017

Environment:
Language: Swift 3
Target: iOS 10.0
Pod Version: 0.11.2
xCode: 8.3.2

Description of Issue:
When creating a table column for which the values can be nil, if a collate .nocase is declared for it, the database creates the column using NOT NULL.

Steps to Reproduce:

let ruleTable = Table("ruleTable")
let description = Expression<String?>("description")
try db.run(ruleTable.create(ifNotExists: true) { t in
    ...
    t.column(description, collate: .nocase)
    ...
}

Attempt to insert a row using nil as the description and it will yield the following error:

NOT NULL constraint failed: ruleTable.description (code: 19)

I was able to confirm this bug by creating a table without the collate and the above procedure operated as intended.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant