Migration Templates
Hysteria ORM provides templates and helpers for common migration patterns.
Basic Migration Template
import { Migration } from "hysteria-orm";
export default class extends Migration {
async up() {
// Your migration logic here
}
async down() {
// Your rollback logic here
}
}
Create Table Template
this.schema.createTable("table_name", (table) => {
table.integer("id").increment().primary();
table.string("name");
// ...
});
Alter Table Template
this.schema.alterTable("table_name", (table) => {
table.addColumn("new_column", "string");
// ...
});
See src/cli/resources/migration_templates.ts for more examples and advanced usage.