How do best do custom database migrations
I'd like to build a custom Database adapter for a database that can handle programatic schema changes, but not via standard SQL syntax. What I'd like to do to expand upon the existing generate or migrate commands from the Better Auth CLI, since it already handles loading the user's config, but these functions are not exported from the CLI package for me to use in my own CLI. What is the best way to approach this? I would also be OK with exposing a method on my adapter that simply handles the migration if that's simpler. I tried doing this briefly with the createSchema function, but all of my console output is suppressed so I can't show a confirmation prompt to the user
3 Replies
Hmm not sure
The BA CLI doesn't really support custom migrations systems right now
You may need a separate system for your users to run migrations - such as your own CLI?
Yes, I'm happy to build my own CLI for this, but I would love for the
getConfig
function to be exposed from the BetterAuth CLI package. Otherwise I would have to parse all that myself, or have the user somehow pass creds to their database in multiple placesI'll pass this along to the team.