traccar not starting on a fresh installation

Alan Lobo4 months ago

I have a fresh installation of traccar on a new VM.
I changed the DB parameters as follows.

    <entry key='database.driver'>org.postgresql.Driver</entry>
    <entry key='database.url'>jdbc:postgresql://db-postgresql-xxxz-nnnnn-do-user-nnnnnn-0.db.ondigitalocean.com:25060/traccar?sslmode=require</entry>
    <entry key='database.user'>traccar</entry>
    <entry key='database.password'>xxxx</entry>`

Traccar refuses to start with the following error

ERROR: Main method error - Database is in a locked state. It could be due to early service termination on a previous launch. To unlock you can run this query: 'UPDATE DATABASECHANGELOGLOCK SET locked = 0'. Make sure the schema is up to date before unlocking the database. - DatabaseLockException (DatabaseModule:102 < <gener:-1 < *:-1 < ... < MainModule:128 < ...)
Anton Tananaev4 months ago

Have you read the error message before asking for help?

Alan Lobo4 months ago

yes. I tried looking around for answers.
The thing is that the database is fresh with no tables in it.
The table DATABASECHANGELOGLOCK doesnt exist.
My expectation is that traccar will create the entire database upon starting the service ( since I cannot find any command to manually create the tables )

Anton Tananaev4 months ago

If the database is empty, it won't give you think error.

Alan Lobo4 months ago

maybe this is a postgres bug ? unable to detect an empty database ?

Anton Tananaev4 months ago

I very much doubt it. I think the error is exactly what it says it is.

Alan Lobo4 months ago

I checked the database through a client. The public schema is empty

Alan Lobo4 months ago

can I create the data tables manually ? or run some sort of script / command to create the tables ?

Anton Tananaev4 months ago

Traccar should create everything automatically.

Alan Lobo3 months ago

after alot of debugging, it turned out that I couldnt see the tables because the database ownership was with another user.
after changing the ownership, i can now see the tables and it is working fine.