Forums / Install & configuration / Upgrading to 4.1.1 dbase update error 'duplicate key name'

Upgrading to 4.1.1 dbase update error 'duplicate key name'

Author Message

Josh Rader

Friday 08 May 2009 11:31:20 am

I'm upgrading from eZ Publish 4.0.0 to 4.1.1 and when I run the update script for the MySQL database we're using, I get the following error:

Error 1061 (42000) at line 11: Duplicate key name 'ezcontent_language_name'

and I can't update the database. I'm running the 'dbupdate-4.0.0-to-4.1.0.sql' script.
Anyone know what the problem is here?

On a side note, since I'm upgrading directly from 4.0.0 to 4.1.1, I followed the upgrade instructions just for the 4.1.1, not the 4.0.0 to 4.1.0. I assume this is okay as long as I run both update scripts for the datase (4.0.0 to 4.1.0 and 4.1.0 to 4.1.1.) is this correct? Thanks.

Łukasz Serwatka

Tuesday 12 May 2009 12:24:18 am

Hi,

It is fine to skip an update query which add such index as you already have it.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Josh Rader

Saturday 16 May 2009 8:21:58 am

So, to clarify, you're saying I don't need to run these SQL queries? (the sql files)

Also, is it ok to upgrade directly from 4.0 to 4.1.1 using the instructions here:

http://ez.no/developer/news/ez_publish_4_1_1_and_4_0_4_released ?

Thanks.

Marco Zinn

Sunday 17 May 2009 2:11:13 am

I experienced similar problems when updating from 3.10.1 to 4.1.1
I'm a fan of eZ, but upgrading the database gets more and more user-unfriendly each time.
In terms of the Database, upgrading from 3.10.1 to 4.x should be easy, but i ran into these issues:
1. There is no real upgrade documenation available for upgrading to 4.1 (i mean, have a look at http://ez.no/doc/ez_publish/upgrading ....)
2. You have to either follow the changelogs of each minor version closely or use trial and error in order to decide which SQL files to run and what to do if they don't. Usually, you look into them, once they stop with an error like "duplicate key name" and there you find some SQL lines with comments like "--- from 3.10.1 ---" ... somewhere there used to be a hint, what these means: Should we use these lines, when i ugrade vom 3.10.1 ... i should we not use them? Whatever you do: When you run the script the 2nd time, i will usually stop in the first lines, as it has run halfway through and now it stumbled again.... This is not the ez way to do ANY update.

Josh (and all other)... what i do is: open the upgrade scripts from the corresponding directories in a text editor and copy and paste them block-wise (or line-by-line) into your SQL client (I use phpMyAdmin for that). That way, you can see, which parts work and which don't. Errors, that tell you, that a key or a column already exists can be ignored, as this means, that this key or columns are already there, usually created by a prior upgrade script statement. If you encounter an error, just go ahead with the next line(s) from the same SQL script.
Not running the SQL scripts at all is probably not a good idea. Among other things, the script store your current ez publish version in some DB table and i assume, that there ARE some (even minor) DB changes between 4.0 and 4.1.1.

@ez: We have loads of PHP scripts for updating, which usually run quite fine. Why can't we have some DB-update-script, which does, what i do manually here: connect to the DB, select the right SQL command file(s), run them line by line and respond more clever then the mysql CLI client to errors? This tool could also parse all the "directives" in the SQL files, which indicate whether the run a specific bunch of lines or not.
Or can't you automatically(!) create "diff" files for the DB structure from any supported older version to the current version, so we'd only have to run ONE SQL command in order to get from 3.10.1 to 4.1.1 for example.

Sorry, but i feel really uneasy, when i think of the 10+ ez3 installations, that i need to update to ez4.x in the next time.

Marco
http://www.hyperroad-design.com

Gaetano Giunta

Monday 18 May 2009 12:15:30 am

<quote>4.0.0 to 4.1.1</quote>

Not really the best way to go at it.

The only upgrade path supported by eZ is: a.a.a => a.a.latest => a.b.x

This means you should first try to update to 4.0.4, and from there go to 4.1.

Regarding the sql scripts, it is a bit counterintuitive, but if you have already passed by version x, you need to actually skip the part between the comments "from version x"

hope it helps
Gaetano

Principal Consultant International Business
Member of the Community Project Board

Kristof Coomans

Monday 18 May 2009 12:43:17 am

Hi Gaetano

What you are saying surprises me very much.

If eZ only supports upgrading from 4.0.4 to 4.1, why is the SQL file that needs to be executed called ..."4.0.0-to-4.1.0" then?

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Gaetano Giunta

Monday 18 May 2009 7:27:09 am

Because it was created at the time when 4.1 was branched and 4.0 was at version 4.0.0?

The upgrade process I described is the one that is recommended to get from 3.9 to 4.0, so I suppose it will be the same going forward...

Principal Consultant International Business
Member of the Community Project Board

Kristof Coomans

Monday 18 May 2009 11:37:15 pm

Well, you are still eZ Systems crew, so you probably know more than me about what the 'supported' upgrade paths are these days. If this is only from 4.0.4, is it somewhere documented? As each person who's upgrading should remove a bunch of SQL then from 4.0.0-to-4.1.0 himself.

I'm talking here about 'supported' upgrade paths now, not about 'possible' upgrade paths, as you can go straight from 3.9 to 4.1 as well if you know what you are doing.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

André R.

Tuesday 19 May 2009 12:34:38 am

Err, no. 4.0.x to 4.1.y is still supported, I think someone is confused by the fact that the file is named dbupdate-4.0.0-to-4.1.0, but if you open it, you can always see what kind of query's to skip.

IMO: Even though it involves a bit more manual work the best thing is to always upgrade 4.0.x to 4.1.y where both x and y is as high as possible. Why? bug fixes, especially to upgrade scripts.. But you still need to run dbupdate-4.0.0-to-4.1.0 (included in the 4.1.1 version) before you run dbupdate-4.1.0-to-4.1.1 and so on.

An upgrade wizard that takes care of running db updates and checking requirements changes would really be nice to avoid this.. We will discuss and define 4.2 road map next week, and this is already proposed as one of the features we have to have in 4.2

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Gaetano Giunta

Tuesday 26 May 2009 9:40:36 am

BTW: here are teh upgrade docs at last: http://ez.no/doc/ez_publish/upgrading/upgrading_to_4_1/4_0_x_to_4_1_y

Principal Consultant International Business
Member of the Community Project Board

Christoph von Siebenthal

Sunday 30 August 2009 7:29:42 am

As you ask us to look in the documentation I'd like to quote:

"This section describes how to upgrade your existing eZ Publish 4.0.x installation to version 4.1.y. If you are upgrading from version 4.0.3 or earlier, you need to first upgrade to 4.0.3 before you can upgrade to 4.1. (Refer to either "Upgrading from 3.10.x to 4.0.y" or "Upgrading from 4.0.x to 4.0.y" depending on which version you are currently running.) "

upgrade to 4.0.3, nothing written about 4.0.4 or maybe it is an error?

And there is still nothing written about deleting script part which should'nt be there according to the line above.

Is that the way you understand documentation?

<b>I really like Ez-publish, but... upgrading sucks!"</b>

Josh Rader

Friday 02 October 2009 9:43:42 am

I caught this same thing, Christoph, but it seems to me like you should upgrade to 4.0.4 (rather than 4.0.3) despite what the documentation says in the link above. That's the way I'm going to try it, anyway.

Marco Zinn

Friday 02 October 2009 11:04:29 am

I didn't try the upgrade to 4.2 yet.
@ez: I guess, the Script for applying the SQL upgrade snippets didn't make it into the 4.2 release? Is there a bug/enhancement report for it, so we can track this?
Quoting the Upgrade docs in http://ez.no/doc/ez_publish/upgrading/upgrading_to_4_2/upgrading_from_4_1_x_to_4_2_y :

Step 4: Upgrading the database
The update script for the database is located in
<eZP root>/update/database/<mysql|postgresql>/4.2/dbupdate-4.1.0-to-4.2.0.sql
You can run this with the appropriate command line tool or application 

Are you at ez aware, that there may be web admins, who must upgrade eZP, which may not be able to apply the .sql files, e.g. because they don't have access to the DB?
Any web admin can copy some files to his webserver and probably is able to run Upgrade scripts from the Shell (if he has SSH access), but maybe he is not the DB admin and will need to contact his fellow DB-guy and discuss the SQL scripts -line by line- with him?

Upgrading really is way to complicated, and one reason is the SQL upgrade scripts fun.
Please provide an PHP script, that runs the SQL commands. Can't be so difficult to read the connection paramters from the INI files and pass the SQL commands to the DB?

I just think, it's too much to expect from us to identify the SQL script to READ them line-by-line and edit them, before we can execute them and hope, they run through without any errors or warnings.

Marco
http://www.hyperroad-design.com