check-migrations.ts 454 B

12345678910111213141516
  1. #!/usr/bin/env bun
  2. import { $ } from "bun"
  3. // drizzle-kit check compares schema to migrations, exits non-zero if drift
  4. const result = await $`bun drizzle-kit check`.quiet().nothrow()
  5. if (result.exitCode !== 0) {
  6. console.error("Schema has changes not captured in migrations!")
  7. console.error("Run: bun drizzle-kit generate")
  8. console.error("")
  9. console.error(result.stderr.toString())
  10. process.exit(1)
  11. }
  12. console.log("Migrations are up to date")