From 82d9342cb1e08323119a89a52de9fa7ba4ee5195 Mon Sep 17 00:00:00 2001 From: RobbieClarken Date: Fri, 5 Dec 2025 16:12:28 +1030 Subject: [PATCH] Fix id column type in documentation example schema to prevent error 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 --- .../Documentation.docc/Articles/PreparingDatabase.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/SQLiteData/Documentation.docc/Articles/PreparingDatabase.md b/Sources/SQLiteData/Documentation.docc/Articles/PreparingDatabase.md index b9c3404d..96e9bf86 100644 --- a/Sources/SQLiteData/Documentation.docc/Articles/PreparingDatabase.md +++ b/Sources/SQLiteData/Documentation.docc/Articles/PreparingDatabase.md @@ -170,7 +170,7 @@ code, but we personally feel that it is simpler, more flexible and more powerful migrator.registerMigration("Create tables") { db in try #sql(""" CREATE TABLE "remindersLists"( - "id" INT NOT NULL PRIMARY KEY AUTOINCREMENT, + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "title" TEXT NOT NULL ) STRICT """) @@ -178,10 +178,10 @@ migrator.registerMigration("Create tables") { db in try #sql(""" CREATE TABLE "reminders"( - "id" INT NOT NULL PRIMARY KEY AUTOINCREMENT, - "isCompleted" INT NOT NULL DEFAULT 0, + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "isCompleted" INTEGER NOT NULL DEFAULT 0, "title" TEXT NOT NULL, - "remindersListID" INT NOT NULL REFERENCES "remindersLists"("id") ON DELETE CASCADE + "remindersListID" INTEGER NOT NULL REFERENCES "remindersLists"("id") ON DELETE CASCADE ) STRICT """) .execute(db)