@byronwade/migrations
v0.1.0
Published
Schema diff, SQL export, migration management for Fakebase
Maintainers
Readme
@byronwade/migrations
Part of Fakebase — a Supabase-shaped, local/dev-only development platform for Next.js prototypes. Not for production use.
Schema tooling for Fakebase: define a schema with the schema() DSL, diff two schemas, manage migrations and snapshots, and export Supabase-compatible SQL/seed scripts when you're ready to graduate to real Supabase.
Installation
pnpm add -D @byronwade/migrationsUsage
import { schema, exportSupabaseSql } from "@byronwade/migrations";
const ir = schema({
tables: {
todos: {
columns: {
id: { type: "uuid", primaryKey: true, default: "gen_random_uuid()" },
title: { type: "text" },
done: { type: "bool", default: "false" },
},
},
},
});
const sql = exportSupabaseSql(ir);What's inside
- DSL + parsers:
schema,parseTypescriptSchema,parseSqlSchema. - Diffing:
diffSchemas,diffToSql,isSchemaDiffEmpty. - Export:
exportSupabaseSql,exportSeedSql(+ExportSqlOptions). - Management:
MigrationManager,SnapshotManager.
Documentation
License
MIT
