moving from one PC to anther

Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1907
    johnanastasio
    Participant

    Installing on a new Win 11 PC

    Install process gives me the sample/demo user.
    When trying to use existing file from other computer, upgrade database routine hangs here:

    SQL patch 330, Add invoice_item_id as a key for the invoice_item_tax table. has not been applied to the database
    SQL patch 331, Add foreign key for invoice_item_id to invoice_item_tax table. has not been applied to the database
    SQL patch 332, Add payment_warehouse table to the database. has not been applied to the database
    SQL patch 333, Add warehouse_amount field to payment table. has not been applied to the database
    SQL patch 334, Add payment delete days option. has not been applied to the database
    SQL patch 335, Add invoice display days option. has not been applied to the database

    Error Screen Message:

    ( ! ) Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1832 Cannot change column ‘tax_id’: used in a foreign key constraint ‘si_invoice_item_tax_ibfk_1’ in C:\wamp64B\www\simpleinvoices\Inc\Claz\PdoDb.php on line 1294
    ( ! ) PDOException: SQLSTATE[HY000]: General error: 1832 Cannot change column ‘tax_id’: used in a foreign key constraint ‘si_invoice_item_tax_ibfk_1’ in C:\wamp64B\www\simpleinvoices\Inc\Claz\PdoDb.php on line 1294
    Call Stack
    # Time Memory Function Location
    1 0.0008 372592 {main}( ) …\index.php:0
    2 0.1280 806392 Inc\Claz\SqlPatchManager::runPatches( ) …\index.php:228
    3 0.1608 812888 Inc\Claz\SqlPatchManager::runSqlPatch( $id = 330, $patch = [‘sql_patch_ref’ => 330, ‘name’ => ‘Add invoice_item_id as a key for the invoice_item_tax table.’, ‘patch’ => ‘ALTER TABLE si_invoice_item_tax MODIFY invoice_item_id INT(11) UNSIGNED NOT NULL, MODIFY tax_id INT(11) UNSIGNED NOT NULL; ALTER TABLE si_invoice_item_tax ADD KEY invoice_item_id (invoice_item_id);’, ‘date’ => ‘20220926’, ‘source’ => ‘fearless359’] ) …\SqlPatchManager.php:215
    4 0.1639 813264 Inc\Claz\PdoDb->query( $sql = ‘ALTER TABLE si_invoice_item_tax MODIFY invoice_item_id INT(11) UNSIGNED NOT NULL, MODIFY tax_id INT(11) UNSIGNED NOT NULL; ALTER TABLE si_invoice_item_tax ADD KEY invoice_item_id (invoice_item_id);’, $valuePairs = ??? ) …\SqlPatchManager.php:145
    5 0.1639 813744 execute( )

    What did I break?

    #1908
    RRowley
    Participant

    Via phpMyAdmin, select the si_invoice_item_tax table and export it. Then zip the exported sql file and attach the zipped file to a response to this message. Chances are that the changes in patch 330 have already been applied. I want to verify this before I advise you what to do next.

    #1909
    johnanastasio
    Participant

    Here you go, thank you in advance!!

    #1911
    johnanastasio
    Participant

    Forgot to add, none of the items use/add on tax

    #1912
    RRowley
    Participant

    Just wanted to verify that the changes that the update terminated on were indeed already present in your database. They are. So with the database at the point where the error occurred, execute the following SQL command to add the entry for the patch to the si_sql_patchmanager table:

    INSERT INTO si_sql_patchmanager (sql_patch_ref, sql_patch, sql_release, sql_statement, source) VALUES
    (330, ‘Add invoice_item_id as a key for the invoice_item_tax table.’, ‘20220926’, ‘ALTER TABLE si_invoice_item_tax MODIFY invoice_item_id INT(11) UNSIGNED NOT NULL, MODIFY tax_id INT(11) UNSIGNED NOT NULL; ALTER TABLE si_invoice_item_tax ADD KEY invoice_item_id (invoice_item_id);’, ‘fearless359’);

    This entry will to SI that that patch 330 has been applied and you can access SI and it will pick up applying the patches following this. Let me know how this works.

    • This reply was modified 1 year, 6 months ago by RRowley.
    #1914
    johnanastasio
    Participant

    After pasting the above into the Run SQL query/queries box on table simpleinvoices.si_sql_patchmanager:

    There is a red “X” on the side of the query box, when you hover over it the message is “unexpected token (near ALTER)
    I’m by no means even an amateur at this but I’m trying LOL

    Here’s what I got:

    Error
    SQL query: Copy

    INSERT INTO si_sql_patchmanager (sql_patch_ref, sql_patch, sql_release, sql_statement, source) VALUES
    (330, ‘Add invoice_item_id as a key for the invoice_item_tax table.’, ‘20220926’, ‘ALTER TABLE si_invoice_item_tax MODIFY invoice_item_id INT(11) UNSIGNED NOT NULL, MODIFY tax_id INT(11) UNSIGNED NOT NULL;
    MySQL said: Documentation

    #1064 – 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 ‘invoice_item_id as a key for the invoice_item_tax table.’, ‘20220926’, ‘’ at line 2

    #1915
    RRowley
    Participant

    The sinqle quotes surrounding the strings in the values were converted to a different character. I’ll try again and see if it stores correctly.

    INSERT INTO si_sql_patchmanager (sql_patch_ref, sql_patch, sql_release, sql_statement, source) VALUES
    (330, 'Add invoice_item_id as a key for the invoice_item_tax table.', '20220926', 'ALTER TABLE si_invoice_item_tax MODIFY invoice_item_id INT(11) UNSIGNED NOT NULL, MODIFY tax_id INT(11) UNSIGNED NOT NULL; ALTER TABLE si_invoice_item_tax ADD KEY invoice_item_id (invoice_item_id);', 'fearless359');
    

    This appears to work. Give it a try.

    • This reply was modified 1 year, 6 months ago by RRowley.
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.