Update from 2019 to 2026

Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #2272
    altaphista
    Participant

    Hi Fearless,

    I finally decided to upgrade from 2019.2 to the newest version, but i’m getting stuck at sqlpatch331.
    During the update I had an error earlier, and found what you mentioned in this post. I deleted these references, but now i get this error:

    [11-Dec-2025 10:36:43 Europe/Amsterdam] SqlPatchManager::runSqlPatch() - SqlPatchManager::prePatch331() = Unable to set Foreign Keys.
    [11-Dec-2025 10:39:15 Europe/Amsterdam] PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000]: General error: 1005 Can't create table <code>my_fact</code>.<code>si_invoice_item_tax</code> (errno: 150 "Foreign key constraint is incorrectly formed") in /volume1/websites_folder/invoices/Inc/Claz/PdoDb.php:1287
    Stack trace:
    #0 /volume1/websites_folder/invoices/Inc/Claz/PdoDb.php(1287): PDOStatement->execute()
    #1 /volume1/websites_folder/invoices/Inc/Claz/SqlPatchManager.php(145): Inc\Claz\PdoDb->query('ALTER TABLE '
    si...')
    #2 /volume1/websites_folder/invoices/Inc/Claz/SqlPatchManager.php(215): Inc\Claz\SqlPatchManager::runSqlPatch(331, Array)
    #3 /volume1/websites_folder/invoices/index.php(247): Inc\Claz\SqlPatchManager::runPatches()
    #4 {main}
      thrown in /volume1/websites_folder/invoices/Inc/Claz/PdoDb.php on line 1287
    [11-Dec-2025 10:42:17 Europe/Amsterdam] PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000]: General error: 1005 Can't create table <code>my_fact</code>.<code>si_invoice_item_tax</code> (errno: 150 "Foreign key constraint is incorrectly formed") in /volume1/websites_folder/invoices/Inc/Claz/PdoDb.php:1287
    Stack trace:
    #0 /volume1/websites_folder/invoices/Inc/Claz/PdoDb.php(1287): PDOStatement->execute()
    #1 /volume1/websites_folder/invoices/Inc/Claz/SqlPatchManager.php(145): Inc\Claz\PdoDb->query('ALTER TABLE 'si...')
    #2 /volume1/websites_folder/invoices/Inc/Claz/SqlPatchManager.php(215): Inc\Claz\SqlPatchManager::runSqlPatch(331, Array)
    #3 /volume1/websites_folder/invoices/index.php(247): Inc\Claz\SqlPatchManager::runPatches()
    #4 {main}
      thrown in /volume1/websites_folder/invoices/Inc/Claz/PdoDb.php on line 1287
    • This topic was modified 1 day, 10 hours ago by altaphista.
    #2274
    fearless359
    Keymaster

    Check the Version Update Process menu topic and the Unable to set Foreign Keys Error Handling tab. What you don’t show in your error log message is the list of foreign key values that prevent the foreign key constraints from being implemented. This issues need to be manually resolved before the update and proceed.

    • This reply was modified 18 hours, 31 minutes ago by fearless359.
    • This reply was modified 18 hours, 30 minutes ago by fearless359.
    #2277
    altaphista
    Participant

    Thanks for your reply @fearless359. I’ve already done all the steps in the Version Update Process topic. I accidently copied to many rows from the php.log in my first quote, it should only be this what’s below. I manually deleted the 16 references to invoice_item_tax do not get that error any more.
    Just to be sure I ran the update script again and this is the only error I get:

    [12-Dec-2025 12:12:12 Europe/Amsterdam] PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000]: General error: 1005 Can't create table 'my_fact'.'si_invoice_item_tax' (errno: 150 "Foreign key constraint is incorrectly formed") in /volume1/websites_folder/invoices/Inc/Claz/PdoDb.php:1287
    Stack trace:
    #0 /volume1/websites_folder/invoices/Inc/Claz/PdoDb.php(1287): PDOStatement->execute()
    #1 /volume1/websites_folder/invoices/Inc/Claz/SqlPatchManager.php(145): Inc\Claz\PdoDb->query('ALTER TABLE 'si...')
    #2 /volume1/websites_folder/invoices/Inc/Claz/SqlPatchManager.php(215): Inc\Claz\SqlPatchManager::runSqlPatch(331, Array)
    #3 /volume1/websites_folder/invoices/index.php(247): Inc\Claz\SqlPatchManager::runPatches()
    #4 {main}
      thrown in /volume1/websites_folder/invoices/Inc/Claz/PdoDb.php on line 1287
    #2278
    altaphista
    Participant

    I’ve been diving into your SqlPatchManager code trying to retrieve the error. After some time debugging I saw that this query threw an error: ALTER TABLE 'si_invoice_item_tax' ADD CONSTRAINT 'si_invoice_item_tax_ibfk_2' FOREIGN KEY ('invoice_item_id') REFERENCES 'si_invoice_items'('id') ON DELETE NO ACTION ON UPDATE CASCADE; .

    Digging further into the database buildup I stumbled upon the error: invoice_items.id did not have the attritbute ‘UNSIGNED’.

    The fix: ALTER TABLE 'si_invoice_items' CHANGE 'id' 'id' INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;

    Thanks again for your time and efforts Fearless!

    • This reply was modified 7 hours, 8 minutes ago by altaphista. Reason: typo
    • This reply was modified 7 hours, 8 minutes ago by altaphista.
    #2281
    altaphista
    Participant

    I’ve got a new error now…

    [12-Dec-2025 14:16:03 Europe/Amsterdam] modules/invoices/manage.php Unable to store json data.

    #2282
    fearless359
    Keymaster

    The json is stored in the public directory. If this directory doesn’t exist, it is made by SI. Check the directory’s existence and the access permissions. From shell command line the command is ls -l public assuming you are in the root directory. On my system (windows running xampp), SI builds the directory with -rw-r–r– or 644 access. If I delete the directory and build it from the shell, I get drwxr-xr-x or directory with 755 access. Which both work on my system.

    Bottom line, it should come down to directory access permissions. If you want to go whole hog to avoid any possible restrictions you can chmod 777 public and give universal access to anyone. This is overkill and should be used just for testing.

    Hope this helps.

    #2283
    altaphista
    Participant

    Cheers thanks that worked! I just gave my httpd service the needed read&write access.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.