Rules#
There are 100+ rules and all rules are enabled by default. Rule are divided into 7 categories:
- constraint: Rules for constraints
- general: Rules for best practice
- naming: Rules for naming
- schema: Rules for schema
- security: Rules for security
- typing: Rules for typing
- unsafe: Rules for unsafe migrations
constraint (CT)#
Code | Name | Stable | Auto-fixable |
---|---|---|---|
CT001 | cascade-update | ||
CT002 | cascade-delete | ||
CT003 | identity-generated-by-default | ||
CT004 | remove-constraint | ||
CT005 | duplicate-primary-key-column | ||
CT006 | duplicate-unique-key-column |
general (GN)#
Code | Name | Stable | Auto-fixable |
---|---|---|---|
GN001 | table-inheritance | ||
GN002 | create-rule | ||
GN003 | sql-ascii-encoding | ||
GN004 | missing-primary-key | ||
GN005 | index-elements-more-than-three | ||
GN006 | create-enum | ||
GN007 | missing-replace-in-function | ||
GN008 | missing-replace-in-procedure | ||
GN009 | duplicate-column | ||
GN010 | table-column-conflict | ||
GN011 | missing-required-column | ||
GN012 | required-column-removal | ||
GN013 | nullable-required-column | ||
GN014 | select-into | ||
GN015 | drop-cascade | ||
GN016 | constant-generated-column | ||
GN017 | id-column | ||
GN018 | multi-column-partitioning | ||
GN019 | unlogged-table | ||
GN020 | current-time | ||
GN021 | null-constraint | ||
GN022 | update-without-where-clause | ||
GN023 | delete-without-where-clause | ||
GN024 | null-comparison | ||
GN025 | duplicate-index | ||
GN026 | not-in | ||
GN027 | yoda-condition | ||
GN028 | asterisk | ||
GN029 | missing-replace-in-view | ||
GN030 | missing-replace-in-trigger | ||
GN031 | stringified-null | ||
GN032 | duplicate-index-column | ||
GN033 | insert-without-target-columns | ||
GN034 | typed-table | ||
GN035 | inline-sql-function-body-wrong-language |
naming (NM)#
Code | Name | Stable | Auto-fixable |
---|---|---|---|
NM001 | invalid-index-name | ||
NM002 | invalid-primary-key-name | ||
NM003 | invalid-unique-key-name | ||
NM004 | invalid-foreign-key-name | ||
NM005 | invalid-check-constraint-name | ||
NM006 | invalid-exclusion-constraint-name | ||
NM007 | invalid-sequence-name | ||
NM008 | implicit-constraint-name | ||
NM009 | invalid-partition-name | ||
NM010 | non-snake-case-identifier | ||
NM011 | keyword-identifier | ||
NM012 | special-character-in-identifier | ||
NM013 | pg-prefix-identifier | ||
NM014 | single-letter-identifier | ||
NM015 | timestamp-column-without-suffix | ||
NM016 | date-column-without-suffix |
schema (SM)#
Code | Name | Stable | Auto-fixable |
---|---|---|---|
SM001 | schema-unqualified-object | ||
SM002 | disallowed-schema |
security (ST)#
Code | Name | Stable | Auto-fixable |
---|---|---|---|
ST001 | extension-whitelist | ||
ST002 | procedural-language-whitelist |
typing (TP)#
Code | Name | Stable | Auto-fixable |
---|---|---|---|
TP001 | timestamp-without-timezone | ||
TP002 | time-with-time-zone | ||
TP003 | timestamp-with-timezone-with-precision | ||
TP004 | char | ||
TP005 | varchar | ||
TP006 | money | ||
TP007 | serial | ||
TP008 | json | ||
TP009 | integer | ||
TP010 | smallint | ||
TP011 | float | ||
TP012 | xml | ||
TP013 | hstore | ||
TP014 | disallowed-data-type | ||
TP015 | wrongly-typed-required-column | ||
TP016 | numeric-with-precision | ||
TP017 | nullable-boolean-field |