COLUMN “” CONTAINS NULL VALUES | Postgres

I don't maintain migrations so I end having this error almost everytime I add a new column that's not nullable.

Here's a few queries you can execute for this.

Integer

ALTER TABLE public.<tablename> ADD COLUMN <column_name> integer NOT NULL default 0;

String

ALTER TABLE public.<tablename> ADD COLUMN <column_name> VARCHAR NOT NULL default ' ';

Boolean

ALTER TABLE public.<tablename> ADD COLUMN <column_name> boolean NOT NULL default false;

You can also subscribe to my Newsletter or RSS if you'd like to receive such posts in your inbox.