If this is your first visit, check our documentation. To post, register or login.
Forums / Installing on a Linux/Unix Server / Updating 155f to 157b, Database tables empty

Updating 155f to 157b, Database tables empty

Started by marton_1 on 3 Dec 2020, 10:16 PM · Views: 2,867

Results 1 to 10 of 10
3 Dec 2020, 10:16 PM
#1
marton_1 avatar

marton_1

Totally Zenned

Join Date:
Apr 2013
Location:
eglisau switzerland
Posts:
568
Plugin Contributions:
0

Updating 155f to 157b, Database tables empty

157b, xampp testsite, no plugins, standard responsive classic template.

I copied the 157b files to xampp, created the new db by importing my 155f db which contains data back for 7 years.
I checked the new db and all the tables and data are there; I copied the db to a new db for backup using PHPMyAdmin.

After I run zc_install everything seems fine. I can log in to admin and start the storefront.
The problem is the 157db, all my tables are in my 157b db but many are now empty - no data in tables like customers, products.
For example, Table querybuilder has the standard queries but not the queries I wrote myself

I tried to run zc_install again by copying the zc_install folder into xampp but when I try to start zc_install I immediately get a fatal error message, no chance to click on "upgrade".
From logs

PHP Fatal error: 1146:Table 'zencart157btest.plugin_control' doesn't exist :: UPDATE plugin_control SET infs = 0 ==> (as called by) C:\xampp73a\htdocs\Zencart157b\catalog\includes\classes\PluginManager.php on line 199 <== in C:\xampp73a\htdocs\Zencart157b\catalog\includes\classes\db\mysql\query_factory.php on line 170.

No other error messages in logs.

The table zencart157btest.plugin_control does exist in the 157b db with one row with author "Vinos de Frutas Tropicales (lat9)", my 155f db does not have this table.

Usually, such problems in basic things are from me doing something dumb`:blush:

Thanks for any help.

3 Dec 2020, 10:57 PM
#2
marton_1 avatar

marton_1

Totally Zenned

Join Date:
Apr 2013
Location:
eglisau switzerland
Posts:
568
Plugin Contributions:
0

Re: Updating 155f to 157b, Database tables empty

BTW, I am using xampp 3.2.4, PHP7.3.9

4 Dec 2020, 12:10 AM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Updating 155f to 157b, Database tables empty

Three possibilities come to mind without further info:

  • I wouldn't have expected zc_install to access those plugin tables at all. So, it sounds like you're not hitting /zc_install/index.php but rather just the "root" of the site, which would be your storefront ... which will definitely complain if it's missing those essential tables.

  • perhaps your "import" of 155 into 157 left some of your initial 157 tables behind, but the upgrade-detector erroneously sees it as already up-to-date, so isn't offering an upgrade option. Suggest deleting the 157 database and re-making it and re-linking the db credentials to it, before importing the 155 data into it.

  • perhaps after you imported your 155 db and ran zc_install maybe you clicked "Clean Install" instead of "Upgrade", so it wiped out a lot of what you imported. Clearing the old temporary 157 tables and re-importing 155 data would be the steps to take here.

.
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 Dec 2020, 3:18 PM
#4
marton_1 avatar

marton_1

Totally Zenned

Join Date:
Apr 2013
Location:
eglisau switzerland
Posts:
568
Plugin Contributions:
0

Re: Updating 155f to 157b, Database tables empty

DrByte:

Three possibilities come to mind without further info:

  • I wouldn't have expected zc_install to access those plugin tables at all. So, it sounds like you're not hitting /zc_install/index.php but rather just the "root" of the site, which would be your storefront ... which will definitely complain if it's missing those essential tables.

  • perhaps your "import" of 155 into 157 left some of your initial 157 tables behind, but the upgrade-detector erroneously sees it as already up-to-date, so isn't offering an upgrade option. Suggest deleting the 157 database and re-making it and re-linking the db credentials to it, before importing the 155 data into it.

  • perhaps after you imported your 155 db and ran zc_install maybe you clicked "Clean Install" instead of "Upgrade", so it wiped out a lot of what you imported. Clearing the old temporary 157 tables and re-importing 155 data would be the steps to take here.

Thanks for your quick and helpful reply.
You are correct I missed the index.php.

I fixed the db as follows.
I ran zc_install and created an empty 157db.
Then using PHPmyadmin I imported my 155f db
Then I ran zc_install/index.php, I had to login using the 155f Super user.
Using "upgrade" it upgraded 155 to 156 and then to 157.
Now the db seems to be OK with all my data prsent.

5 Dec 2020, 1:18 PM
#5
marton_1 avatar

marton_1

Totally Zenned

Join Date:
Apr 2013
Location:
eglisau switzerland
Posts:
568
Plugin Contributions:
0

Re: Updating 155f to 157b, Database tables empty

When I tried to look at my customer list I had a failure

PHP Fatal error: 1054:Unknown column 'c.customers_secret' in 'field list'

I ran this SQL and fixed the problem

ALTER TABLE customers ADD COLUMN customers_secret VARCHAR(16);

Was that a good idea?

5 Dec 2020, 3:13 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Updating 155f to 157b, Database tables empty

The upgrade script should have handled that.
Did it log any other failed db changes when the upgrade ran? Logs dir. zc_install in the filenames.

.
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.

5 Dec 2020, 3:40 PM
#7
marton_1 avatar

marton_1

Totally Zenned

Join Date:
Apr 2013
Location:
eglisau switzerland
Posts:
568
Plugin Contributions:
0

Re: Updating 155f to 157b, Database tables empty

Thanks for the quick answer, just this in logs (did not know there are zc_install logs)

[04-Dec-2020 14:32:27 Europe/Berlin] MySQL error 1292 encountered during zc_install:
Incorrect datetime value: '0000-00-00 00:00:00' for column `zencart157btest`.`customers`.`gdpr_accept_date` at row 1
ALTER TABLE customers ADD customers_secret varchar(64) NOT NULL default '';

As you know this the EU General-Data-Protection-Rules-GDPR plugin is from JSWeb so not part of the basic zen cart.

I deleted the column I added and ran your "ALTER TABLE" SQL.
It inserted new customers_secret column OK but a load of warnings "Warning: #1264 Out of range value for column 'gdpr_accept_date' at row 1
"

5 Dec 2020, 3:58 PM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Updating 155f to 157b, Database tables empty

Ya, it looks like that jsweb thing is based on old ways of handling dates, and only built for old MySQL versions not using strict-mode.

You may need to find all those old custom-added date fields and change the old data in them first.
You can't do any table schema alterations until the invalid data is fixed.

We do a bunch of these this way in core code: https://github.com/zencart/zencart/blob/v158/zc_install/sql/install/zero_dates_cleanup.sql You can use that as inspiration for the changes you may need to make to any fields you've added to any of your tables.
You probably also need to change the field's "default" value to a non-zero date.

You'll probably also need to update whatever PHP code inserts data into those fields so that it never uses zero-dates either.

Additional reading: https://docs.zen-cart.com/user/upgrading/date_standardization/

.
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.

14 Mar 2021, 9:57 AM
#9
marton_1 avatar

marton_1

Totally Zenned

Join Date:
Apr 2013
Location:
eglisau switzerland
Posts:
568
Plugin Contributions:
0

Re: Updating 155f to 157b, Database tables empty

DrByte:

Ya, it looks like that jsweb thing is based on old ways of handling dates, and only built for old MySQL versions not using strict-mode.

You may need to find all those old custom-added date fields and change the old data in them first.
You can't do any table schema alterations until the invalid data is fixed.

Sorry for the late reply, this default setting and code update worked fine.
I did not find anything in the PHP code that inserts data into those fields that insert zero-dates.
I have now put an update in the GDPR thread

14 Mar 2021, 8:41 PM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Updating 155f to 157b, Database tables empty

I've updated the links in my post with more information learned since I made those comments.

.
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.