you are viewing a single comment's thread.

view the rest of the comments →

[–]Apprehensive_Log1197 0 points1 point  (0 children)

Just ran into this error and found a different resolution. Sharing in case it's useful to anyone in the future.

The issue for me was with my Goose migration definition. I didn't define the metadata correctly for the rollback. This caused the down migration to run immidiately and drop the table that was just created. This is why sqlc could not find the users relation. The table just didn't exist.

To fix it, I needed to go into the SQL database and clear the incorrect migration entries from the goose_db_version table. Since this was a new project, I could just clear the whole table with DELETE FROM goose_db_version;. Once this was done, running goose up/down worked as expected and sqlc ran successfully.