core icon indicating copy to clipboard operation
core copied to clipboard

Error in 2.1 - Upgrade task fails when inserting a new column on contentlet_version_info

Open joseorsini opened this issue 14 years ago • 4 comments

Reproduced on 2.1 using MySQL DB when upgrading a client.

Stacktrace:

2012-05-15 13:15:38,489 INFO com.dotmarketing.common.db.DotConnect - Executing alter table contentletversioninfo add versionts timestamp default CURRENTTIMESTAMP not null 2012-05-15 13:15:39,346 ERROR com.dotmarketing.db.HibernateUtil - ---------- DotHibernate: error on rollbackTransaction --------------- com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Can't call rollback when autocommit=true 2012-05-15 13:15:39,348 FATAL com.dotmarketing.startup.StartupTasksExecutor - Unable to execute the upgrade task : Task00865AddTimestampToVersionTables com.dotmarketing.exception.DotRuntimeException: Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

It fails because there is already an existing column on contentletversioninfo table with CURRENT_TIMESTAMP as default value when inserting or updating a row.

Switching back to 2.0.1 in order to continue the upgrade process.

joseorsini avatar May 15 '12 13:05 joseorsini

Jose you should only be upgrading people to 2.0 I think. The released version.

jtesser avatar May 15 '12 14:05 jtesser

Yes, I told him the same. He went master-2.0.1. But anyway we got this bug report. Good one by the way

dotjorgeu avatar May 15 '12 14:05 dotjorgeu

It is a limitation on MySQL. Only one table can have CURRENT_TIMESTAMP or NOW() as default value. I took a look at VersionableFactoryImpl and I found we're setting those values with current date. So we don't need to set this default value. I'll just drop those default values. At upgrade time we might set them by hand

dotjorgeu avatar May 15 '12 20:05 dotjorgeu

upgraded 2.0.1 to 2.1 in mysql and all other 3 db's this morning

DeanGonzalez avatar Jun 15 '12 21:06 DeanGonzalez