v0.30.0 — migrations
Version your schema with a fluent builder + migrator:
const migrations: Migration[] = [{
name: "01_create_users",
up: (s) => s.createTable("users", (t) => {
t.id();
t.string("email").unique();
t.boolean("active").default(true);
t.timestamps();
}),
down: (s) => s.dropTable("users"),
}];
await new Migrator(connection, "postgres").up(migrations); // idempotent
await new Migrator(connection, "postgres").down(migrations); // roll back last batchApplied migrations are batch-tracked in a migrations table; SQL is dialect-aware (sqlite/mysql/postgres). See docs/migrations.md.