Updating database not working

I keep getting errors like:

com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry ‘10-cuba/update/mysql/16/160405-createUniqSysCategory.sql’ for key ‘PRIMARY’

Which versions of Studio and the platform do you use?
Have you migrated the project?
How do you update the database? Could you describe your actions step-by-step?


I’ve upgraded from 6.6 to 6.8.1.

I have migrated the project (as in it now compiles), but I normally update the database manually as I got it into a state where none of the updates would run and I’m not sure how to tidy it up.

Now I need to update as it complains e.g. LOCALE_NAMES not present in table etc, but I can’t work out how to tidy up the scripts to get the updates I need to run

Not sure I have everything understood. But let me explain here how the DB update occurs.

As written in the documentation Gradle and Automatic DB updater register executed scripts in sys_db_changelog. If the script is registered - it should not be executed anymore.

When the database is created (create-db.sql is executed) the upgrade-scripts are marked as “executed”: just written to sys_db_changelog (the corresponding tables are already in create-db.sql)

Assumably the error means that the 160405-createUniqSysCategory.sql script has been already executed and now you try to register it again.