Results 1 to 10 of 27

Hybrid View

  1. #1
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: 156a db upgrade does not fix all incorrect datetime values

    Quote Originally Posted by carlwhat View Post
    i think putting this into zc_install mysql_upgrade script would be an awesome idea.
    Yes, that's the plan. I put it here first to get some testing feedback on databases beyond what I'm using myself.

    Quote Originally Posted by carlwhat View Post
    2 of which were added fields (and would not be caught by the above sql statements)
    Yup.

    Quote Originally Posted by carlwhat View Post
    in addition, my test data for v155 also needed the following statement:

    Code:
    ALTER TABLE `products`
      CHANGE `products_date_added` `products_date_added` datetime NULL AFTER `products_virtual`;
    i am not sure if this was missed in a previous update or if my testdata some how is out of of sync with what should be defined for a v155 dataset.
    A fresh install doesn't use null for that field. Not sure why you're changing it to null (nor why you're not using the keyword 'default' as well).

    Since v1.3.8 the schema for products_date_added has been:
    products_date_added datetime NOT NULL default '0001-01-01 00:00:00',
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  2. #2
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,915
    Plugin Contributions
    13

    Default Re: 156a db upgrade does not fix all incorrect datetime values

    Quote Originally Posted by DrByte View Post
    A fresh install doesn't use null for that field. Not sure why you're changing it to null (nor why you're not using the keyword 'default' as well).

    Since v1.3.8 the schema for products_date_added has been:
    products_date_added datetime NOT NULL default '0001-01-01 00:00:00',
    ok... perhaps that makes sense.

    the live data for my sites is defined that way. however, if i were to run:

    Code:
    SELECT `products_id`, `products_date_added`
    FROM `products`
    WHERE `products_date_added` = 'NULL'
    i would get the following:

    Name:  Screenshot from 2019-01-05 19-04-16.png
Views: 703
Size:  11.3 KB

    now the sql "fix" would address this and i would not need to alter the schema.

    it seems that not being in strict mode (or something like that) allowed me to add data in that format. and i was attempting to address the errors reported in the logs.

    the next test on db conversion, i will run the sql statements first w/o the alter statement and see what happens.

    best.my
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  3. #3
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: 156a db upgrade does not fix all incorrect datetime values

    Quote Originally Posted by carlwhat View Post
    Code:
    SELECT `products_id`, `products_date_added`
    FROM `products`
    WHERE `products_date_added` = 'NULL'
    Strictly speaking your 'NULL' should be just NULL or null, without quotes.

    Quote Originally Posted by carlwhat View Post
    it seems that not being in strict mode (or something like that) allowed me to add data in that format
    True.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,845
    Plugin Contributions
    25

    Default Re: 156a db upgrade does not fix all incorrect datetime values

    Maybe this discussion helps in creating an automated script for updating all tables in your database. https://stackoverflow.com/questions/...oss-all-tables
    I have not tested it yet, but stumbled across to find a solution.

  5. #5
    Join Date
    Aug 2009
    Location
    North Idaho, USA
    Posts
    2,008
    Plugin Contributions
    1

    Default Re: 156a db upgrade does not fix all incorrect datetime values

    Quote Originally Posted by DrByte View Post
    Wanna try running this cleanup?
    (ie: run it manually before running zc_install, or insert it into the zc_install mysql_upgrade_zencart_YYY.sql file where YYY is the "next" zc version after the one your database data is from)
    Thanks DrByte,
    Zero logfile errors.

    drop tables
    import db from backup
    run cleanup from within phpMyAdmin
    run zc_install as update
    no logfiles generated

    when I inserted the code at line 252 of mysql_upgrade_zencart_155.sql
    and ran the zc_install as update, there were 2 error files generated.

    That's when I just started over and ran the cleanup from within phpMyAdmin.
    Didn't look to see what/if I fouled up in my paste/save to the mysql_upgrade_zencart_155.sql
    Probably overlooked an overzealous mouse grab in the copy/paste.

  6. #6
    Join Date
    Sep 2011
    Posts
    47
    Plugin Contributions
    0

    Default Re: 156a db upgrade does not fix all incorrect datetime values

    Okay just tried this on my issues.....right now iam able to put the store down for maintenance and all my items are there just gonna keep testing looking around and see so it is prob. worth putting somewhere in the 1.5.6a sql db update file

    Robert

    Thank you very much

  7. #7
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,915
    Plugin Contributions
    13

    Default Re: 156a db upgrade does not fix all incorrect datetime values

    ok, i love sql.... to a point...

    my experience and tests. first off, when i get to here:

    /index.php?main_page=database_upgrade

    and it asks to confirm the steps to upgrade, should there a button to confirm? or does one just press enter? i have not looked to much further into what is on that page, as i am getting caught up into the db upgrade. but if there is supposed to be a button, then something is wrong on my browser, if there is no confirmation button, i think we should add one.

    i have tried modifying this file:

    zc_install/sql/updates/mysql_upgrade_zencart_156.sql

    to include all of the db fixes above; i was not able to get it to work. however, if i manually ran everything prior to doing the upgrade it worked fine.

    that said, do we need to look at standardizing all our datetimes? or is it bound to create more confusion? for example, in the code above:

    Code:
    UPDATE products
    SET products_date_added = '0001-01-01 00:00:00'
    WHERE products_date_added < '0001-01-01'
      and products_date_added is not null;
    UPDATE products
    SET products_last_modified = NULL
    WHERE products_last_modified < '0001-01-01'
      and products_last_modified is not null;
    this is caused by the structure:

    products_date_added datetime [0001-01-01 00:00:00]
    products_last_modified datetime NULL
    products_date_available datetime NULL

    not sure if the effort is worth it or not. or if there is a reason why the schema is different.

    finally i LOVE the link that @design75 added. thank you. i have not played around with it yet. but i will! as i said above, i love sql... to a point...

    best.
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  8. #8
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: 156a db upgrade does not fix all incorrect datetime values

    Quote Originally Posted by carlwhat View Post
    and it asks to confirm the steps to upgrade, should there a button to confirm?
    Yes, there's a button to click to proceed with applying the updates required.

    Quote Originally Posted by carlwhat View Post
    that said, do we need to look at standardizing all our datetimes? or is it bound to create more confusion?
    That's a completely separate topic. It requires changing how the PHP code interacts with the data.
    Maybe for v2.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. Replies: 6
    Last Post: 2 Dec 2017, 11:10 PM
  2. Replies: 5
    Last Post: 10 Jan 2017, 01:24 AM
  3. PayPal IPN - 1292 Incorrect datetime value
    By Alex Clarke in forum Upgrading from 1.3.x to 1.3.9
    Replies: 20
    Last Post: 12 Oct 2009, 05:48 PM
  4. PayPal error: 1292 Incorrect datetime value: '00:13:47 09 2008' for column
    By directprint in forum PayPal Express Checkout support
    Replies: 2
    Last Post: 11 Jul 2008, 08:47 AM
  5. Replies: 3
    Last Post: 1 Aug 2007, 04:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg