SQLite best practices for Node.js with better-sqlite3 — WAL mode, pragmas, foreign keys, STRICT tables, transactions, migrations, graceful shutdown, and query patterns
97
98%
Does it follow best practices?
Impact
96%
1.65xAverage score across 5 eval scenarios
Passed
No known issues
WAL mode enabled
100%
100%
Foreign keys ON
100%
100%
Busy timeout set
0%
100%
Graceful shutdown
0%
100%
Transaction for post+tags creation
100%
100%
Indexes on junction table FKs
33%
100%
Index on posts.author_id FK
100%
100%
JSON for metadata
71%
71%
CHECK constraint on post status
100%
100%
Prepared statements throughout
100%
90%
Migration pattern
16%
100%
Dates as TEXT ISO 8601
100%
100%
STRICT tables
0%
100%
Cached prepared statements
0%
100%
WAL mode enabled
100%
100%
Foreign keys ON
100%
100%
Busy timeout set
0%
100%
synchronous = NORMAL
0%
100%
Graceful shutdown with db.close()
0%
100%
Transaction for order creation
100%
100%
Prepared statements throughout
100%
100%
Indexes on foreign key columns
0%
100%
Migration pattern used
0%
100%
Money stored as INTEGER cents
0%
100%
CHECK constraint on order status
100%
100%
STRICT tables
0%
100%
JSON for customizations
75%
100%
WAL mode enabled
100%
100%
Foreign keys ON
100%
100%
Busy timeout set
0%
100%
Graceful shutdown
0%
100%
Atomic booking with capacity check
100%
100%
Cancel booking in transaction
100%
0%
Indexes on bookings.event_id FK
0%
100%
Prepared statements throughout
100%
100%
Money as INTEGER cents
0%
100%
CHECK constraints on statuses
100%
100%
Dates as TEXT ISO 8601
60%
60%
Migration pattern
0%
100%
STRICT tables
0%
100%
synchronous = NORMAL
0%
100%
WAL mode enabled
100%
100%
Foreign keys ON
100%
100%
Busy timeout set
0%
100%
Graceful shutdown
0%
100%
Receive shipment uses transaction
64%
100%
Record sale uses transaction with validation
71%
100%
Indexes on FK columns
0%
100%
Prepared statements throughout
100%
100%
Money as INTEGER cents
0%
100%
Dates as TEXT for movement timestamps
50%
66%
CHECK constraint on movement type
100%
100%
Migration pattern
0%
100%
STRICT tables
0%
100%
WAL mode enabled
100%
100%
Foreign keys ON
100%
100%
Busy timeout set
0%
100%
Graceful shutdown
0%
100%
Bulk import uses transaction
100%
100%
Prepared statement reuse in bulk
100%
100%
Indexes on all foreign keys
0%
100%
CHECK constraints on priority and status
100%
100%
Dates as TEXT ISO 8601
100%
100%
Migration pattern
16%
100%
Prepared statements throughout
100%
90%
STRICT tables
0%
100%
Money as INTEGER
100%
100%