1

When I'm updating the base app I'm getting this error - ERROR: there is no unique constraint matching given keys for referenced table "mail_message". for that i have execute this query too, Query : ALTER TABLE "mail_tracking_value" ADD FOREIGN KEY ("mail_message_id") REFERENCES "mail_message"("id") ON DELETE cascade;

but I'm still facing the ERROR: there is no unique constraint matching given keys for referenced table "mail_message"

In odoo14 the object mail.tracking.value has the foreign key which is mail_message_id of mail.the message,but it not granted this.

jps
  • 20,041
  • 15
  • 75
  • 79
Dipen Shah
  • 2,396
  • 2
  • 9
  • 21
  • The error message says, that there is no UNIQUE constraint on the mail_message ID. You can add it "alter table mail_message add constraint unique_id UNIQUE (id);" . If there are duplicates, you have to remove them first. This issue can happen, for example, when restoring a broken DB dump after migration with duplicated IDs. Then, Odoo cannot create the unique constraint, thus, foreign keys don't work. – Micha Feb 25 '22 at 15:06

0 Answers0