I'm using the peewee ORM to manage a few Postgres databases. I've recently had a problem where the primary keys are not being automatically added when save() or execute() is called like it should be.
Here's the code that's being called:
Macro.insert(name=name, display_text=text).on_conflict(conflict_target=(Macro.name,), preserve=(Macro.display_text,), update={Macro.name: name}).execute()

Here's the error:
Command raised an exception: IntegrityError: null value in column "id" violates non-null constraint; 
DETAIL: Failing row contains (null, nametexthere, displaytexthere)
The macro class has an id (AutoField [set to be primary key]), name (CharField), and display_text (CharField). I've tried using the built in PrimaryKeyField and an IntegerField set to primary key to no change.
Before, I was using Heroku with no issue. I've since migrated my apps to my Raspberry Pi and that's when this issue popped up.
This also isn't the only case where I've had this problem. I have another database with the same AutoField primary key that seems to have broken from the transition from Heroku to Pi. That one uses the save() method rather than insert()/execute(), but the failing row error still shows up.
Should also mention that other non-insert queries work fine. I can still select without issue.
The problem didn't have anything to do with Peewee, it had to do with the dump. Heroku does not dump sequences for you automatically, so I had to add them all again manually. Once those was added the connections worked fine.
Peewee primary keys not showing up (Failing row contains null)