Database Issue on Upgrade from 6.3

fnolting13 days ago

I keep getting this error when updating my dockerized traccar 6.3 instance. Tried 6.10 and 6.5 so far with same result.
I'm using a MySQL database running in a separate docker container. Of course, both containers are in the same docker network.

2025-10-06 10:36:21 ERROR: Main method error - Duplicate column name 'description' - SQLSyntaxErrorException (... < DatabaseModule:99 < <gener:-1 < *:-1 < ... < MainModule:138 < <gener:-1 < ...)
fnolting13 days ago

Sorry I mixed up the version numbers and since I can't edit my post anymore I'll post a reply.
It's about the upgrade von 6.5 to 6.6 - 6.5 is working fine but on 6.6+ I keep getting the error posted before.

Anton Tananaev13 days ago

This means something is wrong with your database schema. You have a column that you shouldn't have. This could be, for example, because of a failed migration.

fnolting13 days ago

I accidently let watchtower upgrade my traccar container because I forgot to set the environment variable for the exclusion. This means it automatically upgraded traccar to 6.10 but now I downgraded to 6.5 by setting the explicit version in the image tag (traccar:6.5) Anyway, 6.5 is working just fine but if I run a container with 6.6 it throws the above error. Is there a migration script I have to run when upgrading to 6.6+? I couldn't find anything in the 6.6 release notes.

In my DATABASECHANGELOG table the row with the highest "ORDEREXECUTED" value is the job with the ID "changelog-6.3-new" followed by "changelog-6.3-old" as the second latest. How can I upgrade to the latest release and keep my historical data in the database?

Anton Tananaev13 days ago

You can always upgrade, but downgrade requires you to manually roll back database changes.

fnolting13 days ago

I only went back to the version I was previously running, that was what I meant by "downgrading". The database works with the version I had previously installed (6.5) but won't work when I run a docker container with 6.6+ together with the same database (that works with 6.5)

I was expecting more rows (at least one more row) in the DATABASECHANGELOG table containing the new docker image version in the first field (something like "changelog-6.6") after the first run but the most recent row is still 6.3-new (see above). What's the default way to migrate from 6.5 to a newer version?

Anton Tananaev13 days ago

You don't need to do anything special. The database will migrate automatically. Usually the cause of errors like this is interrupted migration. In that case you either manually roll back or complete the migration.

fnolting13 days ago

How can I do this? Is there a migration script I can run?

Anton Tananaev13 days ago

There's a Liquibase changelog that you should check:

https://github.com/traccar/traccar/tree/master/schema

fnolting13 days ago

Thanks for the hint regarding the liquibase schema update. I noticed in the changelog that in 6.6 the column "description" was added to the tc_notifications table and that it was already there in my database (but as VARCHAR(500) and not 4000). What I did is delete the column, created a new 6.6 container and - voila:

2025-10-06 15:17:23  INFO: Reading from traccar.DATABASECHANGELOG
2025-10-06 15:17:23  INFO: Columns description(VARCHAR(4000)) added to tc_notifications
2025-10-06 15:17:23  INFO: ChangeSet changelog-6.6::changelog-6.6::author ran successfully in 35ms
2025-10-06 15:17:23  INFO: UPDATE SUMMARY
2025-10-06 15:17:23  INFO: Run:                          1
2025-10-06 15:17:23  INFO: Previously run:              49
2025-10-06 15:17:23  INFO: Filtered out:                 0
2025-10-06 15:17:23  INFO: -------------------------------
2025-10-06 15:17:23  INFO: Total change sets:           50

2025-10-06 15:17:23  INFO: Update summary generated
2025-10-06 15:17:23  INFO: Update command completed successfully.
2025-10-06 15:17:23  INFO: Successfully released change log lock
2025-10-06 15:17:23  INFO: Command execution complete