From ec19c3dcb52eb80957ff0144edecd38b2ea35438 Mon Sep 17 00:00:00 2001 From: ~wispem-wantex Date: Wed, 14 Jan 2026 08:33:59 +0900 Subject: [PATCH] doc: add entries for new 'rowid' related sqlite lint checks --- doc/sqlite-schema-rules-and-linter.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/doc/sqlite-schema-rules-and-linter.md b/doc/sqlite-schema-rules-and-linter.md index 091fd4f..863b9b6 100644 --- a/doc/sqlite-schema-rules-and-linter.md +++ b/doc/sqlite-schema-rules-and-linter.md @@ -47,11 +47,31 @@ Enforce that all columns should use `integer` type instead of `int`. ### `require_explicit_primary_key` -Enforce that all tables must have a primary key. If the primary key is `rowid`, it must be declared explicitly. +Enforce that all tables must have an explicitly declared primary key. **Explanation**: -- All tables need to have a primary key, and it should usually be `rowid`. Declaring it explicitly improves the readability of the schema. +- All tables need to have a primary key for storage reasons, so if you don't declare one, SQLite will auto-generate a hidden "rowid" column. Making it explicit (rowid or otherwise) improves schema readability. + +See more about the special behavior of `rowid` in SQLite's documentation: + +### `require_explicit_rowid` + +Enforce that any table that's not declared `without rowid` has an explicit `rowid integer primary key` column. + +**Explanation**: + +- In SQLite, all tables implicitly have a `rowid` column unless they are declared `without rowid`. Making it explicit improves schema readability. + +See more about the `without rowid` modifier in SQLite's documentation: + +### `forbid_rowid_on_without_rowid_table` + +Enforce that `without rowid` tables don't have a rowid column. + +**Explanation**: + +- This is pretty self explanatory. You can technically give a `without rowid` table a rowid column. But don't. ### `require_indexes_for_foreign_keys`