Skip to content

Commit caa37bb

Browse files
Fix id column type in documentation example schema to prevent error (#322)
When the `id` column is defined as `INT NOT NULL PRIMARY KEY AUTOINCREMENT` sqlite will throw an error: > AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY
1 parent 90568d3 commit caa37bb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/SQLiteData/Documentation.docc/Articles/PreparingDatabase.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,18 @@ code, but we personally feel that it is simpler, more flexible and more powerful
170170
migrator.registerMigration("Create tables") { db in
171171
try #sql("""
172172
CREATE TABLE "remindersLists"(
173-
"id" INT NOT NULL PRIMARY KEY AUTOINCREMENT,
173+
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
174174
"title" TEXT NOT NULL
175175
) STRICT
176176
""")
177177
.execute(db)
178178

179179
try #sql("""
180180
CREATE TABLE "reminders"(
181-
"id" INT NOT NULL PRIMARY KEY AUTOINCREMENT,
182-
"isCompleted" INT NOT NULL DEFAULT 0,
181+
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
182+
"isCompleted" INTEGER NOT NULL DEFAULT 0,
183183
"title" TEXT NOT NULL,
184-
"remindersListID" INT NOT NULL REFERENCES "remindersLists"("id") ON DELETE CASCADE
184+
"remindersListID" INTEGER NOT NULL REFERENCES "remindersLists"("id") ON DELETE CASCADE
185185
) STRICT
186186
""")
187187
.execute(db)

0 commit comments

Comments
 (0)