Forums / Upgrading from 1.3.x to 1.3.9 / Copying 1.3.2 DB to new installation 1.3.8

Copying 1.3.2 DB to new installation 1.3.8

Locked

Views: 1,334

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
26 Dec 2007, 12:25 AM
#1
redmonds avatar

redmonds

Zen Follower

Join Date:
Jan 2006
Posts:
108
Plugin Contributions:
1

Copying 1.3.2 DB to new installation 1.3.8

Hi all. I have been playing with and using ZC for a couple of years now but in terms of PHP and SQL am an absolute newbie.

Anyhow in the past I have moved from OSC and CREloaded to ZC and have managed to bluff my way through altering tables and then exporting and importing the data. Apparently without problem.

I am in the process of doing so again from 1.3.2 to 1.3.8a and I just noticed something that I hadn't before and wanted to make sure that it is not going to cause me any problems. Some of the original DB tables have additional Indexes with values. ie. Featured has:

idx_status_zen - 2
idx_products_id_zen - 16
idx_date_avail_zen - 2

When I copy the data across I have the index names but not the values. Generally I am completeing by
EMTPY on new table
EXPORT on old
copy the only the INSERT lines (not recreating the table using the existing one)
past into new DB and run SQL query.

However I did also try once using the complete EXPORT data with the included 'add DROP TABLE' which had the same result.

What is the repercussions if any of losing this index info. Do I need to recreat it? Can it be exported in any way or do I have to go through table by table?

Thanks for the assistance.

26 Dec 2007, 1:29 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Copying 1.3.2 DB to new installation 1.3.8

Do a complete backup checking four (4) additional boxes if using phpmyadmin

Add DROP TABLE
Add IF NOT EXISTS
Complete inserts
Extended inserts

Apply this to the new store (import) and re-run zc_install and insure that you only select DataBase Upgrade

Assuming that any modules that you have installed remain compatible with 1.3.8 and you might seek later vrsions all should be fine. If not, check your overrides files against the change log in the docs folder and merge any that have been changed.

Zen-Venom Get Bitten

26 Dec 2007, 3:45 AM
#3
redmonds avatar

redmonds

Zen Follower

Join Date:
Jan 2006
Posts:
108
Plugin Contributions:
1

Re: Copying 1.3.2 DB to new installation 1.3.8

Thanks for the response.

I am doing the upgrade table by table anyway. Just the necessary tables such as products.... customers.... address book etc.

So if I select those additional check boxes that will export the additional index fields?

Do I need these additional fields. I have done this at least once before and did not notice these issues so presumably did not copy them? And to my knowledge everything worked.

Again thanks for your help

26 Dec 2007, 3:59 AM
#4
redmonds avatar

redmonds

Zen Follower

Join Date:
Jan 2006
Posts:
108
Plugin Contributions:
1

Re: Copying 1.3.2 DB to new installation 1.3.8

I have now noticed that some of the new DB tables have their own different idex settings. If I copy the settings from the old DB I presume that they will overwite the new DB.

I am guessing that the indexes that areon the new DB are better then the old.

Anymore input or advice would be great.

26 Dec 2007, 4:35 AM
#5
drbyte avatar

drbyte

Sensei

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

Re: Copying 1.3.2 DB to new installation 1.3.8

redmonds:

I am doing the upgrade table by table anyway. Just the necessary tables such as products.... customers.... address book etc.
What exactly do you mean? "upgrading" ... "table by table" ???

If you already had a v1.3.0.2 database, you could upgrade it to v1.3.8 by using the built-in upgrade tool in zc_install ... as per the upgrade documentation supplied with Zen Cart.

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

26 Dec 2007, 4:35 AM
#6
drbyte avatar

drbyte

Sensei

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

Re: Copying 1.3.2 DB to new installation 1.3.8

redmonds:

So if I select those additional check boxes that will export the additional index fields?

Do I need these additional fields.

Which additional fields are you referring to? What are the index names, and which fields are assigned to those indexes?
And which tables are they on?

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

26 Dec 2007, 5:28 AM
#7
redmonds avatar

redmonds

Zen Follower

Join Date:
Jan 2006
Posts:
108
Plugin Contributions:
1

Re: Copying 1.3.2 DB to new installation 1.3.8

Dr Byte, Thanks for your involvement.

I have installed a new store 1.3.8. No Demo Data. Installed all of the Mods that I want and now want to bring my old data over from a 1.3.2 store.

Because I have additional mods and some missing I don't want to import the complete DB but was just aiming to bring the necessary tables to have all of my customer/product/order details.

I believe that I have done this before at least in converting from CREloaded to ZC this is how I did it.

I created a copy of my live DB (old) i compare what i believe are the tables I need such as anything customer_ and Order_ products_ etc. If the new DB is missing any columns from the tables that I compare then I add that column to the OLD DB. I then export the old table. Empty the NEW table and run the SQL query on only the exported data starting with INSERT bringing all of the OLD data to the NEW table. (not recreating the table)

However I noticed that the OLD tabes and the NEW tables have different 'indexes'

for example the OLD db Orders table has the following Indexes listed:
Keyname Type Cardinality Action Field
PRIMARY PRIMARY 1992 orders_id
idx_status_orders_cust_zen INDEX 1992 orders_status
orders_id
customers_id

the NEW db Orders table has the following Indexes:
Keyname Type Cardinality Action Field
PRIMARY PRIMARY 4 orders_id
idx_status_orders_cust_zen INDEX 4 orders_status
orders_id
customers_id
idx_date_purchased_zen INDEX 4 date_purchased
qbi_imported INDEX 1 qbi_imported

I uderstand that the qbi line is added from the quickbooks mod and has actually been removed now. When I import the OLD table to the new table it has not been bringing across all of these entries and presumably if it does it will wipe out the existing entries. The primary copies across and I use this as check that all of the data was imported but the other lines don't replicate across at least not how I am doing it. This has been the case even if I select 'add drop table' although I have not yet tried the options suggested by Kobra on a table by table basis.

However once I completed the table by table import I had some wierd bugs. Like I imported and thenc hecked my tax/zone etc. But my store was showing tax free prices until I logged in which is the opposite of the Old store. I checked the product info and I could not get it to accept/show a net price and a gross price. They where both the same even with 'taxable goods' selected and the tax zones/rates checked.

So I thought maybe I am doign this the hardway and I should try the store upgrade method. I imported the complete OLD DB. Went to the install directorya dn selected upgrade. I entered the username and password (the store admin) details as asked and then pressed upgrade. I had to do this 3 times each time getting a page that was fairly indescriptive and unhelpful but each time one of the upgrade steps was unticked.

On the 4th and final upgrade I got these errors:
SKIPPED: Cannot create table nochex_apc_transactions because it already exists
SKIPPED: Cannot create table nochex_sessions because it already exists
SKIPPED: Cannot create table nochex_sessions because it already exists
SKIPPED: Cannot create table nochex_sessions because it already exists
SKIPPED: Cannot create table nochex_sessions because it already exists
SKIPPED: Cannot ALTER or INSERT/REPLACE into table linkpoint_api because it does not exist. CHECK PREFIXES!

I am only concerned with the last one unless someone tells me otherwise.

but also now I can not access the site pages in any way. There is obviously some old configurations in the DB that need to be changed. Currently different server/hostname/physical path etc. I thought all of this was in the configure.php files but I gues some of it is in the DB as well. Where do I change it.

Sorry for going on so long but it is a long story.

26 Dec 2007, 5:34 AM
#8
drbyte avatar

drbyte

Sensei

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

Re: Copying 1.3.2 DB to new installation 1.3.8

  1. If you're going to import data from another database, it should always be at the same version-level as the one you're importing into.
    So, doing an upgrade of your 1.3.0.2 database before importing any pieces of it into 1.3.8 is the right thing to do.
    After that, if you then want to export/import selected tables, and know which tables are doing what and why, then feel free.

  2. If you're getting blank pages after upgrading, it's pretty much always a result of a PHP syntax error in one or more of your files.
    FAQ to help identify where: https://www.zen-cart.com/tutorials/index.php?article=82

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

26 Dec 2007, 5:36 AM
#9
drbyte avatar

drbyte

Sensei

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

Re: Copying 1.3.2 DB to new installation 1.3.8

redmonds:

On the 4th and final upgrade I got these errors:
SKIPPED: Cannot create table nochex_apc_transactions because it already exists
SKIPPED: Cannot create table nochex_sessions because it already exists
SKIPPED: Cannot create table nochex_sessions because it already exists
SKIPPED: Cannot create table nochex_sessions because it already exists
SKIPPED: Cannot create table nochex_sessions because it already exists
SKIPPED: Cannot ALTER or INSERT/REPLACE into table linkpoint_api because it does not exist. CHECK PREFIXES!

I am only concerned with the last one unless someone tells me otherwise.

Those are not errors. They are informational alerts, as explained at the top of the same page. They are exceptions reported by the upgrade script when attempting to work with certain tables ... some of which already exist or do not yet exist, perhaps because they are not needed in your current configuration.

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

26 Dec 2007, 5:42 AM
#10
redmonds avatar

redmonds

Zen Follower

Join Date:
Jan 2006
Posts:
108
Plugin Contributions:
1

Re: Copying 1.3.2 DB to new installation 1.3.8

Found the DB settings that I had to change. I can now see pages and at first glance all looks ok.

Presumably all of the mods that I installed that required DB scripts run may no longer work depending on whether the old store had the same mod and whether it was compatible with the new version that I have probably installed now. So I will now have to filter through all of the mods and find the SQL files and rerun/upgrade them as required.

FUN FUN!

Just need to address the upgrade script error.

Thanks for your help Kobra and Dr Byte and if you can see anything else I need to know/do please let me know.