The issue is the NOT NULL constraint, which is filled by the ORM, and not deferrable.
First off, try setting the value to DEFAULT on the ORM side.
If it's not a workable solution in your ORM, try adding a trigger that sets the default value:
create function make_default() returns trigger as $$
begin
new.app_status := 'undeployed'::apps_status
return null;
end;
$$ language plpgsql;
create trigger before insert or delete on yourtable
for each row when (new.app_type is null)
execute procedure make_default();
If that doesn't work either, drop the NOT NULL constraint altogether, and enforce it with a constraint trigger instead:
create function reject_row() returns trigger as $$
begin
raise exception 'rejected!'
return null;
end;
$$ language plpgsql;
create constraint trigger after insert or delete on yourtable
for each row when (new.app_type is null)
execute procedure reject_row();
DEFAULTor simply omitting the column)NULLvalue, or remove the column alltogether from the insert, or use theDEFAULTkeyword. All that will also work for MySQL