Skip to content

MG17 — ALTER COLUMN DROP NOT NULL lets nulls into the column

Group: Migration safety · Auto-fixable: no

DROP NOT NULL relaxes a column to accept nulls. Code and clients that relied on the column always being set can break, and once nulls exist the change is hard to reverse. Treat it as a backward-incompatible change.

bad: ALTER TABLE t ALTER COLUMN c DROP NOT NULL;

Disable this rule in banshee.toml:

[lint]
exclude = ["MG17"]

Or silence one line with -- noqa: MG17. See Linting.