Postgres error: relation "goose_db_version" already exists
Running any goose command I now get:
pq: L:"1013" R:"heap_create_with_catalog" S:"ERROR" M:"relation \"goose_db_version\" already exists" C:"42P07" F:"heap.c"
This is a newly introduced issue, sometime since 039efed. It happens only in my prod environment, not dev.
I will look into it over the next week, although it will be a slow process thanks to go's lack of support for specifying commits in import statements. :(
Filing this here in the interim in case someone else just knows the answer offhand.
Comments (6)
-
repo owner -
repo owner Oh - without any deeper investigation, this is likely due to the fact that there were a couple schema changes to the internal goose_db_version table.
It would probably be best to provide a "meta" migration for this, to account for existing version records, but I haven't created such a thing just yet.
-
reporter @liamstask sounds right. I'll just drop and recreate for now. I can see that you would want to give the meta-migrations thing some thought, to avoid needing meta-meta-migrations. :)
I'm also happy to help design and/or implement meta-migrations when the time comes.
-
I'm just doing first steps with goose and I hit this error.
I created my first migration on my workstation with
goose create
, uploaded things to my server and now whether I rungoose status
orgoose up
I get this error.This seemed weired to me even before I installed it, because I don't see nowhere something like
goose init
to create the goose metadata about database as is usual with db migration tools.And now I have to go read the source to figure out how to execute the
createVersionTableSql()
and whatever else it needs. -
It appears that in order to run the creation of metadata table the code expects
errors.New("table does not exist")
while returned is actuallypq: relation "goose_db_version" does not exist
-
Ok, apparently in my case it is my fault. I forgot to change dialect from sqlite to postgresql. Sorry for the noise.
- Log in to comment
blerg - will take a look shortly as well.