You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Placing --bun:split at the top of migration file causes SQL errors due to blank transaction.
Reproduction
Run: go run cmd/db/main.go db create_tx_sql user
Put --bun:split at the top of the file
Run go run cmd/db/main.go db migrate
Causes the following error to occur.
[bun] 16:29:29.374COMMIT1.133ms COMMIT
[bun] 16:29:29.376 INSERT 1.445ms INSERT INTO bun_migrations ("id", "name", "group_id", "migrated_at") VALUES (DEFAULT, '20250126210710', 1, DEFAULT) RETURNING "id", "migrated_at"
[bun] 16:29:29.376BEGIN530µs BEGIN
[bun] 16:29:29.377368µs *errors.errorString: pgdriver: query is empty
[bun] 16:29:29.377ROLLBACK16µs ROLLBACK*errors.errorString: driver: bad connection
Migration failed: pgdriver: query is empty
[bun] 16:29:29.382DELETE5.677ms DELETEFROM bun_migration_locks WHERE ("table_name"='bun_migrations')
Notes
Resolving this is as easy as removing the --bun:split however, it did take me quite a while to figure out this was in the reason the error was being caused. It might be good to omit the bun:split or maybe give the user back an error. Regardless, just wanted to bring this to your attention.
The text was updated successfully, but these errors were encountered:
Description
Placing
--bun:split
at the top of migration file causes SQL errors due to blank transaction.Reproduction
Run:
go run cmd/db/main.go db create_tx_sql user
Put
--bun:split
at the top of the fileRun
go run cmd/db/main.go db migrate
Causes the following error to occur.
Notes
Resolving this is as easy as removing the
--bun:split
however, it did take me quite a while to figure out this was in the reason the error was being caused. It might be good to omit the bun:split or maybe give the user back an error. Regardless, just wanted to bring this to your attention.The text was updated successfully, but these errors were encountered: