postgres add column if not exists code example
Example 1: postgresql add column with constraint
ALTER TABLE customers
ADD COLUMN contact_name VARCHAR NOT NULL;
Example 2: postgres add not null to existing column
ALTER TABLE table_name ALTER COLUMN column_name SET NOT NULL;
Example 3: add column if not exists postgresql
ALTER TABLE table_name ADD COLUMN IF NOT EXISTS column_name INTEGER;