SQL data access best practices for AIRBot reviewers
SELECT col1, col2) rather than SELECT *.jdbi.inTransaction {}; avoid mixing suspend calls inside transactions.@SqlBatch, @BatchChunkSize(2000)) for bulk inserts/updates and chunk large WHERE IN arguments (SQL Server limit ~2200 params).@BlockingClass, @BlockingCall) exist for DAL/Repo classes and consumers.updated_at timestamps update alongside data mutations.CURRENT_TIMESTAMP) to set them.created_at/updated_at columns, primary keys, and consider unique constraints where appropriate.NVARCHAR over VARCHAR; align column nullability with Kotlin model nullability.mockRun, wrap per-row mutations in try/catch, and notify stakeholders before production runs.BulkExecutor; discourage ad-hoc parallel loops.Grep for SELECT *, @SqlBatch, inTransaction, or AsyncResponse inside DAO code to ensure patterns align.Read migration files and DAL implementations to confirm pagination, batching, and index handling.Glob *Dao.kt, *Repository.kt, *Script.kt to review related data access or scripting changes together.