Programmatic Database Migration without migrations folder

I'm curious if there's a way to programmatically run the migration without the need for the migrations folder.

I have a mono repo with an
api
library that uses my
db
package. I'm creating tests for the
api
and was going to recreate the db before each test run. I was going to run the migrate function from drizzle-orm/mysql2/migrator but it requires the migrationsFolder path to be supplied as an argument. Since I'm in a mono repo, this path will vary based on the relative paths of my tests and the
db
package. I can't put those paths in my test files.

Since the tables are defined in typescript, is there a way to directly in code to create the table without first doing a generate and then a migrate?
Was this page helpful?