Skip to content

fix(sqlite): emit INTEGER PRIMARY KEY AUTOINCREMENT inline for id() c…#92

Merged
bedus-creation merged 2 commits into
mainfrom
fix/sqlite-autoincrement
Jun 6, 2026
Merged

fix(sqlite): emit INTEGER PRIMARY KEY AUTOINCREMENT inline for id() c…#92
bedus-creation merged 2 commits into
mainfrom
fix/sqlite-autoincrement

Conversation

@bedus-creation

Copy link
Copy Markdown
Contributor

…olumns

SQLite requires AUTOINCREMENT as an inline column constraint, not a table-level constraint. big_increments and increments columns now emit INTEGER PRIMARY KEY AUTOINCREMENT directly, and the redundant CONSTRAINT...PRIMARY KEY table clause is suppressed for those columns. Also skip the sqlite_sequence system table during test teardown to prevent drop errors introduced by AUTOINCREMENT usage.

…olumns

SQLite requires AUTOINCREMENT as an inline column constraint, not a
table-level constraint. big_increments and increments columns now emit
`INTEGER PRIMARY KEY AUTOINCREMENT` directly, and the redundant
CONSTRAINT...PRIMARY KEY table clause is suppressed for those columns.
Also skip the sqlite_sequence system table during test teardown to
prevent drop errors introduced by AUTOINCREMENT usage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

async with await self.schema.create("users") as blueprint:
blueprint.increments("id")
blueprint.string("name")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does just blueprint.id() works as well?

Filter out SQLite internal system tables (sqlite_sequence, sqlite_stat*)
in Migrator.drop_all_tables() before issuing DROP TABLE, preventing the
OperationalError raised when migrate:fresh encounters auto-created system
tables after AUTOINCREMENT columns are used.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bedus-creation bedus-creation merged commit 7d28319 into main Jun 6, 2026
3 checks passed
@bedus-creation bedus-creation deleted the fix/sqlite-autoincrement branch June 8, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant