Created
March 29, 2016 21:03
-
-
Save groue/97a5f2c81fb0fbfabc3bd3d13f08feb3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func setupDatabase() { | |
// That "collation" helps us compare person names in a localized case insensitive fashion | |
let collation = DatabaseCollation.localizedCaseInsensitiveCompare | |
try! dbQueue.execute( | |
"CREATE TABLE persons (" + | |
"id INTEGER PRIMARY KEY, " + | |
"name TEXT NOT NULL COLLATE \(collation.name), " + | |
"score INTEGER NOT NULL " + | |
")") | |
try! Person(name: "Arthur", score: 250).insert(dbQueue) | |
try! Person(name: "Barbara", score: 750).insert(dbQueue) | |
try! Person(name: "Craig", score: 500).insert(dbQueue) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment