Running schema migrations on the server

I'm currently in need to run schema migrations directly on the server instead of the CLI. I'd need this because I'm programmatically provisioning a database on Neon with their API and I'd like to run the initial schema migration directly from my code on the server on that newly created database. I found a couple months old question on this, without any other responses: https://github.com/drizzle-team/drizzle-orm/discussions/1901 Is there any way to make this possible without directly running SQL?
GitHub
Generating migration commands programmatically · drizzle-team drizz...
We have some sync code that dynamically write tables & columns into our database based on shape of the incoming object. Therefore are not able to use a static schemas.ts file with the existing ...
1 Reply
Woet
Woet4mo ago
It would also work if I could somehow get the SQL output of the entire creation of my schema that would come from drizzle-kit generate:pg if no other migrations exist yet and then run that SQL code after the database creation. Perhaps there's a way for me to do this with drizzle-kit push:pg --schema ./src/db/global/schema.ts --driver pg --connectionString $DATABASE_URL ?
Want results from more Discord servers?
Add your server