uptrace / bun

SQL-first Golang ORM
https://bun.uptrace.dev
BSD 2-Clause "Simplified" License
3.65k stars 221 forks source link

feat: export there are no migrations error #887

Closed greeflas closed 1 year ago

greeflas commented 1 year ago

Hi 👋 I have implemented a CLI command to run migrations. In new projects, I might not have migrations from the start, and in such cases, my command fails. I want to address this issue by exporting the validation error to be able to check it:

_, err := migrator.Migrate(ctx)

if errors.Is(err, migrator.ErrThereAreNoMigrations) {
    return nil
}
vmihailenco commented 1 year ago

Sorry, but this looks like a minor internal detail that will likely change in future. I don't think this should not be part of the API.