Zen Cart Logo
Forums / Upgrading from 1.3.x to 1.3.9 / Database upgrade failing

Database upgrade failing

Locked

Views: 2,252

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
26 Jan 2008, 6:26 AM
#1
swingandmiss avatar

swingandmiss

Zen Follower

Join Date:
Apr 2007
Posts:
138
Plugin Contributions:
0

Database upgrade failing

Going from 1.3.7 to 1.3.8.

I did a test database upgrade on a restored DB from earlier today and everything went great. I then deleted the DB and install files, re-uploaded so that everything was by the books and now I get this error.

1062 Duplicate entry 'Customers who have never completed a purchase' for key 2
in:
[INSERT INTO zen_query_builder (query_category, query_name, query_description , query_string) VALUES ('email,newsletters', 'Customers who have never completed a purchase', 'For sending newsletter to all customers who registered but have never completed a purchase', 'SELECT DISTINCT c.customers_email_address as customers_email_address, c.customers_lastname as customers_lastname, c.customers_firstname as customers_firstname FROM TABLE_CUSTOMERS c LEFT JOIN TABLE_ORDERS o ON c.customers_id=o.customers_id WHERE o.date_purchased IS NULL');]I can delete the DB and files, recreate them, and keep the same error. I don't understand why it worked once but I can't get it to work again. Any ideas?

26 Jan 2008, 6:48 AM
#2
swingandmiss avatar

swingandmiss

Zen Follower

Join Date:
Apr 2007
Posts:
138
Plugin Contributions:
0

Re: Database upgrade failing

I swear things are weird tonight. After this error, I went into the admin section and it said I needed to upgrade the DB. I checked the server info and sure enough, it said DB 1.3.7. So I dumped everything and started from scratch, got the same error again, went into the admin section and everything looks fine. I really wish I knew what was going on here. It looks like everything is working, but I feel a little uneasy about it.

26 Jan 2008, 4:58 PM
#3
drbyte avatar

drbyte

Sensei

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

Re: Database upgrade failing

swingandmiss:

1062 Duplicate entry 'Customers who have never completed a purchase' for key 2

You'll only get that message if you're trying to upgrade a database that's already had the upgrade run on it at least once.

If you want to skip ever getting that error, you'll have to remove it from the upgrade script:
edit /zc_install/sql/mysql_upgrade_zencart_137_to_138.sql
find the line (around 62)that says the following, and add the # at the beginning, as show:```
#audience list addition: customers who have signed up but never made a purchase
[B]#[/B]INSERT INTO query_builder (query_category, query_name, query_description , query_string) VALUES ('email,newsletters', 'Customers who have never completed a purchase', 'For sending newsletter to all customers who registered but have never completed a purchase', 'SELECT DISTINCT c.customers_email_address as customers_email_address, c.customers_lastname as customers_lastname, c.customers_firstname as customers_firstname FROM TABLE_CUSTOMERS c LEFT JOIN TABLE_ORDERS o ON c.customers_id=o.customers_id WHERE o.date_purchased IS NULL');

27 Jan 2008, 5:24 AM
#4
swingandmiss avatar

swingandmiss

Zen Follower

Join Date:
Apr 2007
Posts:
138
Plugin Contributions:
0

Re: Database upgrade failing

I thought that may be the case, but it was most definitely a 1.3.7 database. Regardless, it seems to be working now. Thanks for the help.