drizzle-kit dry run / different in/out

Hello! I want to test the matching of my migrations to the schema code declarations:
My questions (I'm pretty sure "no" is the answer to all, so it's just stuff that I think will be good to support):
  1. is there a programmatic way to run "generate migration"? didn't find any docs about a js api from drizzle-kit (only types)
  2. is there a way to run a "dry run" / a way to have different "in" and "out" dirs? (this is why I need to copy)
  3. is there a programmatic way to parse a config file, change it and pass it to drizzle-kit? I currently. have two different configs with just "out" different (I import the original and override though...)
My current, primitive, test: (with some try catches)
describe('test migrations match schema', () => {
    afterAll(async () => {
      await rm(testDir, { recursive: true })
    })
    test('migrations match schema', async () => {
      await cp(originDir, testDir, { recursive: true })
      const beforeGenerations = await readdir(testDir)
      execSync("yarn run drizzle-kit generate:pg --config ./src/drizzle.test-config.ts", { stdio: "inherit" })
      const afterGenerations = await readdir(testDir)
      expect(beforeGenerations).toEqual(afterGenerations);
    })
})
Was this page helpful?