SQL rules
No rules match. Clear the filters or try another search.
| Rule | Category | Introduced |
|---|---|---|
combine-alter-table Combine compatible adjacent ALTER TABLE actions. | maintainability | |
declared-column-bounds Encode explicitly declared numeric and interval ranges in SQL CHECK constraints. | correctness | |
enforce-timestamptz TIMESTAMP without TIME ZONE — use TIMESTAMPTZ. | correctness | |
excess-migration-index-requires-justification Limit explicit indexes to three per table and eight per authored migration. | performance | |
existing-table-check-or-foreign-key-requires-not-valid CHECK and foreign-key constraints added to existing PostgreSQL tables should defer validation. | performance | |
idempotent-ddl DDL omits a supported IF [NOT] EXISTS guard. | correctness | |
index-concurrently CREATE INDEX without CONCURRENTLY — locks the table against writes. | performance | |
insert-requires-replay-policy Every INSERT must declare replay-safe upsert behavior or explicitly document intentional insert-only semantics. | correctness | |
invalid-concurrent-ddl Keep concurrent PostgreSQL DDL in supported execution contexts. | correctness | |
invalid-postgres-ddl Use supported PostgreSQL index and constraint definitions. | correctness | |
migration-timeout-requires-justification Require an explicit operational reason for migration timeout settings. | maintainability | |
mixed-migration-phases Review existing-table migrations that combine backfill, enforcement, and contract phases. | architecture | |
new-table-inline-constraints Declare new-table constraints inside CREATE TABLE. | maintainability | |
no-analytical-queries-in-transactional-db Keep DISTINCT, GROUP BY, and aggregate queries in analytical databases. | architecture | |
no-application-schema-check Review JSON shape validation duplicated in database CHECK constraints. | architecture | |
no-database-functions Ban stored SQL functions and procedures in migrations. | architecture | |
no-database-triggers Keep behavioral logic in application code, not database triggers. | architecture | |
no-duplicate-index Report duplicate and conservatively covered indexes that remain active in one authored migration. | performance | |
no-long-migration-narration Long migration comments narrate implementation instead of recording durable constraints. | maintainability | |
no-migration-comment-cruft Commented-out SQL, decorative banners, and untracked debt markers must be removed. | maintainability | |
no-migration-comments Encode migration invariants in SQL instead of explanatory comments. | maintainability | |
no-noop-migration-down A migration down section must perform a rollback instead of silently doing nothing. | correctness | |
no-null-comparison Use explicit NULL predicates instead of ordinary NULL comparisons. | correctness | |
no-offset-pagination Dynamic OFFSET pagination in query SQL should use a stable cursor. | performance | |
no-pg-enum CREATE TYPE ... AS ENUM — use TEXT with an application enum instead. | maintainability | |
prefer-constrained-status Review CHECK-constrained boolean states for a single status column. | maintainability | |
prefer-jsonb JSON column type or table-DDL cast — use JSONB. | performance | |
prefer-text-over-varchar VARCHAR(n) — use TEXT (+ CHECK length if needed). | maintainability | |
prefer-uuidv7-default `gen_random_uuid()` emits a random UUIDv4 — use `uuidv7()` so keys are time-ordered. | performance | |
require-fk-index Cascading or set-value FOREIGN KEY action lacks a child-table index. | performance |