mujx / hakatime

Wakatime server implementation & analytics dashboard
https://hakatime.mtx-dev.xyz
The Unlicense
631 stars 47 forks source link

Issue With project_tags Creation #26

Closed jimmybrancaccio closed 3 years ago

jimmybrancaccio commented 3 years ago

Hello!

I am using mujx/hakatime:latest and have been using this image for at least 3-4 weeks now. The container seems to be having some issues. In the logs I see:

Waiting for the PostgreSQL service to become available ...,
Connected to PostgreSQL,
Database hakatime already exists,
NOTICE:  relation "schema_migrations" already exists, skipping,
NOTICE:  relation "tags" already exists, skipping,
Running migrations from files found in /app/migrations,
Initializing schema,
Migrations schema initialized,
hakatime: SqlError {sqlState = "42830", sqlExecStatus = FatalError, sqlErrorMsg = "there is no unique constraint matching given keys for referenced table \"projects\"", sqlErrorDetail = "", sqlErrorHint = ""}

So I tried running the query manually and I got the same error:

Screen Shot 2021-03-06 at 20 11 40

Unfortunately I don't know enough about PGSQL and queries to know what the issue here is 😢 so any help on fixing this would be awesome 😬 !

mujx commented 3 years ago

Were you using the image before v1.0.0? It seems that you're missing some schema changes. Before v1.0.0 schema migrations would have to be made manually but now they are automatic.

To add the missing schemas do the following:

Let me know how this goes as it can be used for others that might have been using pre-v1 images.

jimmybrancaccio commented 3 years ago

@mujx Ah yup! Those steps seemed to do the trick. Apologies on my part for not advising I had been running it pre-1.0.0! I had thought I caught all the updates to get to 1.0.0+ as I had to do some manual work to get some of the new heartbeat (de-duplication) stuff working myself. I appreciate your help in getting me back up and running! 😁

mujx commented 3 years ago

No worries @jimmybrancaccio, I'm glad you're up and running again!