Unable to apply patch 318. Found foreign key table

SimpleInvoices Group Forum Forums Fearless359 SimpleInvoices Discussion Group Unable to apply patch 318. Found foreign key table

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #943
    facer
    Participant

    I looked in my php.log and saw that the following error is causing the problem:
    Since I am have no clue of programming I tried the 2 suggestions without success.

    Can anyone advise me please.

    Unable to apply patch 318. Found foreign key table columns with values not in
    the reference table column. The following list shows what values in foreign
    key columns are missing from reference columns.

    There two ways to fix this situation. Either change the row columns to reference
    an existing record in the REFERENCE TABLE, or delete the rows that contain
    the invalid columns.

    To do this, the following example of the SQL statements to execute for the test
    case where the ‘cron_log’ table contains invalid values ‘2’ and ‘3’ in the
    ‘cron_id’ column. The SQL statements to consider using are:

    UPDATE si_cron_log SET cron_id = 6 WHERE cron_id IN (2,3);
    —- or —-
    DELETE FROM si_cron_log WHERE cron_id IN (2,3);

    FOREIGN KEY TABLE COLUMN REFERENCE TABLE COLUMN INVALID VALUE
    ———————— —————— ———————– ——— ————-
    invoice_items invoice_id invoices id 1

    #946
    facer
    Participant

    after that I see an other error:

    [0] => 42000
    [1] => 1064
    [2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘WHERE sql_id = ‘454” at line 3

    I have no clue any longer one after the other errors keep coming.

    #947
    RRowley
    Participant

    The error is explicit. There are values in the cron_log table where the cron_id is set to 2 and to 3, but there are no entries in the cron table with an id of 2 or 3. Two options are provided. Change the cron_id in the those cron_log records to a value that does exist in the cron table or delete those records.

    The update command:
    UPDATE si_cron_log SET cron_id = 6 WHERE cron_id IN (2,3);
    will set the cron_id to 6 for these records. Or the delete command:
    DELETE FROM si_cron_log WHERE cron_id IN (2,3);
    will delete these orphaned records.

    I recommend the delete command. These records probably were associated with cron table entries that you deleted in the past and the history in the cron_log table was not cleaned up.

    To either update or delete the records copy the command, go to the phpMyAdmin console and do:

    1) Access the cron_log table
    2) Select the SQL tab
    3) Select the Clear button to clear the default content in the text box
    4) Paste your copied command into the Run SQL query text box
    5) Finally select the Go button to execute the command.

    At this point, the orphaned records should not be orphaned/exist any more.

    I recommend that you delete the content of the tmp/log/php.log file before accessing SI again in case there is another error, so it will be at the top of the file.

    • This reply was modified 3 weeks, 6 days ago by RRowley.
    #949
    facer
    Participant

    Thank you, it was a very good tip to delete the php.log as I was looking at the same error again and again, while I got it fixed already. I also used the Master 2019.2.1 BETA which was not a clever idea, I admit. Later on I used version: Master 2019 and I got it rolling.

    Very happy with the result.
    I am a long time user of SI, do not use it often just a couple of times a month.

    Thank you for keeping SI alive!

    • This reply was modified 3 weeks, 6 days ago by facer.
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.