pressly / goose

A database migration tool. Supports SQL migrations and Go functions.
http://pressly.github.io/goose/
Other
6.65k stars 504 forks source link

goose migrate fails with sql, psql loads ok #823

Open jmls opened 1 week ago

jmls commented 1 week ago

I'm trying to load some existing schema and data as a migration into a new postgres db

when goose starts up, it creates the migration table but then errors with

"ERROR: trailing junk after numeric literal at or near "8c" (SQLSTATE 42601)" loading "20240911190228_development.sql"

however, if I use psql

psql < 20240911190228_development.sql

then all the data is loaded without any apparent errors

the 20240911190228_development.sql file was created with pg_dump . Is there any options / formatting that needs to be applied to pg_dump ?

jmls commented 1 week ago

if I pg_dump with --inserts --column-inserts then the migration works

mfridman commented 1 week ago

Probably worth documenting this, but these are the commands that have been fairly useful: