Reply To: Tutorial needed to upgrade from simpleinvoices 2011 to 2023

#2007
RRowley
Participant

Concerning unable to apply foreign key changes error, the exception message tells you what the issue is. From your error log:

The records in the FOREIGN KEY TABLE are most likely invalid and should be deleted.

FOREIGN KEY      TABLE COLUMN    REFERENCE TABLE COLUMN INVALID VALUE
————————         ——————          ———————–        ———    ————-
invoice_item_tax invoice_item_id invoice_items   id     10
invoice_item_tax invoice_item_id invoice_items   id     11
invoice_item_tax invoice_item_id invoice_items   id     12
invoice_item_tax invoice_item_id invoice_items   id     13

This is saying that there are si_invoice_item_tax table records with an id of 10, 11, 12 and 13, containing invoice_item_id values that do not exist in the si_invoice_items table.

There are two ways to resolve this. One is to create si_invoice_itens records that contain these values. The other is to delete these records from the si_invoice_item_tax table. Since the orphaned records are likely left over from the deletion of si_invoice_items records that failed to delete associated tax records, the solution to delete the si_invoice_item_tax records with id values of 10, 11, 12 and 13 is likely the best solution.