Error of a unique constraint in Django relationship and unique constraint postgres

Error of a unique constraint in django relationship, when you remove foreign key from code but it is not migrated via database migration tool. You can sometimes get IntegrityError very simply. It takes time to understand what actually went wrong. And when some mechanism works in a command it can lead to unexpected problems. Hanging objects in databases that are normally no longer new. If it is identified then that is easy to improve. A problem well stated is a problem half solved

Bug in cyclus mailing.

Check table constraints.

\d+ cyclusemail_cyclus

We see that index key on the table.

But in code we have removed it and replaced it with a setter and getter something like this..

You can remove it manually from the database to fix this problem for example.

ALTER TABLE cyclusemail_cyclus DROP CONSTRAINT cyclusemail_cyclus_job_id_62194efe_fk_job_job_id;

ALTER TABLE table_name DROP CONSTRAINT constrain_name;

Ok, it is fixed