Migration Add API Broken
Author: jemtuckerCreated Nov 13, 2025Updated Mar 24, 2026
Labelsstaleno stalebot
In version 1.2.15 the Migration.Add API has breaking changes that make it no longer usable.
I have been using migrations in Go like so:
ms.Add(migrate.Migration{
Name: "20241024-initial-migration",
Comment: "init first model",
Up: func(ctx context.Context, db *bun.DB) error {
...
},
Down: func(ctx context.Context, db *bun.DB) error {
...
},
})
Since https://github.com/uptrace/bun/commit/d92e29e459ae2804ad48e1b4f6a8147211a47a57 this is no longer possible due to a private type being used in the definition of the Up and Down members.
Is there a migration path (pun not intended) from Add to Register that won't break compatibility with migrations that have already been run?
Source: uptrace/bun