@forgeframework/migrations
v0.3.0
Published
Provides database schema migration management for the Forge Framework.
Maintainers
Readme
@forgeframework/migrations
Provides database schema migration management for the Forge Framework.
Part of the Forge Framework — a TypeScript framework for backend microservices and web applications.
Installation
npm install @forgeframework/migrationsUsage
import { MigrationRunner } from '@forgeframework/migrations';
const runner = new MigrationRunner({
directory: './migrations',
connection: db,
tableName: '_migrations',
});
// Run pending migrations
const results = await runner.up();
results.forEach((r) => console.log(`${r.name}: ${r.success ? 'OK' : 'FAILED'} (${r.duration}ms)`));
// Check status
const status = await runner.status();
const pending = status.filter((s) => !s.executed);
console.log(`${pending.length} pending migrations`);
// Rollback last batch
await runner.down();Documentation
Full API reference and guides: https://carbonforge.io/framework/docs/db/migrations
(Documentation site launching soon.)
License
MIT © Carbon Forge
