how to alter table column to not null postgresql code example
Example 1: postgres add not null to existing column
ALTER TABLE table_name ALTER COLUMN column_name SET NOT NULL;
Example 2: postgresql alter column nullable
-- To change a column to nullable
ALTER TABLE mytable ALTER COLUMN mycolumn DROP NOT NULL;