Zen Cart Logo
Forums / General Questions / Database problem - not all data is importing from DB copy

Database problem - not all data is importing from DB copy

Views: 871

Results 1 to 5 of 5
26 Feb 2015, 8:14 PM
#1
shags38 avatar

shags38

Totally Zenned

Join Date:
Jan 2011
Location:
Adelaide, Australia
Posts:
1,684
Plugin Contributions:
0

Database problem - not all data is importing from DB copy

I am currently doing my first version upgrade from 1.3.9h to 1.5.1 and am at the stage of importing database from existing working site into the test site - everything to do with products and product categories data is not loading into the test site database - address book, admin pages, and others have loaded but not the ones mentioned (as well as others).
When importing the db I got an error message about duplicate addresses so I copied the original db minus address book - then after importing I got another error about address format so copied original db minus that as well and imported it however was still getting errors.

I have tried copying just certain sections for importing to test db - the latest was I copied categories, category descriptions, products, product descriptions - received error message saying duplicate entry for categories (see below) - in checking that section the data was actually there as was category description however products and product description were not.

Is there some reason for this occurring? are there permissions I need to adjust or something else? I figure after the last attempt mentioned that if I was to export then import only one data set at a time I will eventually get there but I have 4 other sites to upgrade so there is either something I am doing wrong or something I haven't done.

cheers, Mike

Error

SQL query:

--
-- Dumping data for table categories

INSERT INTO categories ( categories_id , categories_image , parent_id , sort_order , date_added , last_modified , categories_status )
VALUES ( 1, NULL , 0, 0, '2012-09-06 18:03:38', '2013-04-30 14:30:41', 1 ) , ( 2, NULL , 0, 1, '2012-09-06 18:04:08', '2014-07-30 17:33:38', 1 ) , ( 3, NULL , 0, 2, '2012-09-06 18:04:35', '2014-07-30 11:23:14', 1 ) , ( 4, NULL , 0, 3, '2012-09-06 18:05:05', '2013-04-30 14:31:42', 1 ) , ( 6, NULL , 0, 5, '2012-09-06 18:06:05', '2014-07-04 08:58:26', 1 ) , ( 7, NULL , 0, 6, '2012-09-06 18:06:26', NULL , 1 ) , ( 8, NULL , 0, 3, '2013-04-30 14:29:08', NULL , 1 ) , ( 9, NULL , 0, 9, '2013-04-30 15:24:09', '2013-04-30 15:24:27', 1 ) , ( 10, NULL , 0, 5, '2013-05-14 10:07:56', '2013-05-14 10:08:19', 1 ) , ( 11, NULL , 0, 3, '2013-06-28 10:02:15', '2014-07-13 09:25:56', 1 ) ;

MySQL said: Documentation
#1062 - Duplicate entry '1' for key 'PRIMARY' <<<<<<<<<<<<<< same message in every case

26 Feb 2015, 8:32 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,081
Plugin Contributions:
56

Re: Database problem - not all data is importing from DB copy

When you created the database export, I'm thinking that you didn't check the Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT statement option under the Object creation options.

26 Feb 2015, 9:19 PM
#3
shags38 avatar

shags38

Totally Zenned

Join Date:
Jan 2011
Location:
Adelaide, Australia
Posts:
1,684
Plugin Contributions:
0

Re: Database problem - not all data is importing from DB copy

lat9:

When you created the database export, I'm thinking that you didn't check the Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT statement option under the Object creation options.

Spot on ...... Many thanks !!

28 Feb 2015, 10:22 AM
#5
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Database problem - not all data is importing from DB copy

shags38:

I have tried copying just certain sections for importing

You need to be very careful when importing the data 'in sections'. If you fail to import all of the related tables you can get some rather unpredictable and nasty behaviour.

Unless you have a very good reason to do this it is much safer (and easier) to drop and re-import the entire database. That way you can be sure that everything maintains its relationships with everything else.

Just sayin'

Cheers
RodG