When I click the Add Blank Line button on the order edit page. I get the following error message: An AJAX HTTP error occurred. HTTP result code: 500 (etc.)
The log has the following details:
Location http://mysite.com/system/ajax
Referrer http://mysite.com/admin/store/orders/706/edit
Message PDOException: SQLSTATE[HY000]: General error: 1364 Field 'model' doesn't have a default value: INSERT INTO {uc_order_products} (order_id, qty, weight_units) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 706 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => kg ) in drupal_write_record() (line 7194 of /public_html/drupal/includes/common.inc).
Comments
Comment #1
longwaveIs this a fresh install, or an upgrade from a previous version?
I can't reproduce this; 'model' has a default value set during install, and it's present in my database:
Comment #2
LeeHunter CreditAttribution: LeeHunter commentedIt's an upgrade from a previous version. We just upgraded from Drupal 5 to 7.
Comment #3
longwaveWow, I'm not sure how many other D5-7 upgrades there have been, but I'm happy that this is the first problem you encountered!
I don't think there is an easy way of going back and fixing this in code, as it seems to be caused by a change back in D5 that never had a proper update hook written for it, and we can't retrospectively fix that now as D5 is long dead. However you should be able to run the following SQL query to fix your table:
ALTER TABLE uc_order_products MODIFY model varchar(255) NOT NULL DEFAULT '';
You may run into a few similar issues where updates were missing in D5; it should be possible to fix all these with similar SQL queries, if you post the error messages.
Comment #4
LeeHunter CreditAttribution: LeeHunter commentedThat query didn't totally solve the problem but it made some progress and showed me how to fix it. After I ran the query, I had the same error but the log showed this message:
PDOException: SQLSTATE[HY000]: General error: 1364 Field 'data' doesn't have a default value: INSERT INTO {uc_order_products} (order_id, qty, weight_units) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 706 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => kg ) in drupal_write_record() (line 7194 of /home/intersub/public_html/drupal/includes/common.inc).
This indicated that we had the same problem, but now it was with the "data" field, so I adjusted your query to:
ALTER TABLE uc_order_products MODIFY data text NOT NULL DEFAULT '';
And that seems to solve things.
Thanks!
Comment #5
longwaveIf you think there may be more undiscovered database issues after your upgrade, you could try using https://drupal.org/project/schema to compare your upgraded database against what Drupal thinks the schema should be.