Skip to content
Sarj Code Standards

no-redundant-nullability

Remove redundant column nullability clauses.

Why

Columns are nullable by default, and PRIMARY KEY already enforces NOT NULL. Repeating these properties obscures the constraints that change the schema contract.

Fix

Omit plain NULL clauses. Review unnamed NOT NULL constraints beside an inline PRIMARY KEY before removing their redundant nullability declaration.

Examples

Before — flagged Nullable columns need no NULL clause
migrations/001_item.sql
CREATE TABLE item (note TEXT NULL);
After — preferred Keep only constraints that change nullability
migrations/001_item.sql
CREATE TABLE item (id INTEGER PRIMARY KEY, note TEXT);
Autofix output
migrations/001_item.sql
CREATE TABLE item (note TEXT);
Before — flagged An inline primary key already enforces NOT NULL
migrations/001_item.sql
CREATE TABLE item (id INTEGER PRIMARY KEY NOT NULL);
After — preferred Keep the primary key without an extra nullability declaration
migrations/001_item.sql
CREATE TABLE item (id INTEGER PRIMARY KEY);