@megaorm/cli
Version:
This package allows you to communicate with MegaORM via commands directly from the command line interface (CLI).
33 lines (28 loc) • 749 B
Plain Text
const { MegaGenerator } = require('@megaorm/gen');
/**
* This is a base generator template for managing database tables.
*
* @extends `MegaGenerator`
*/
class [className] extends MegaGenerator {
/**
* Creates a generator instance.
*/
constructor() {
super();
// The table name associated with this generator.
this.set.table('[tableName]');
}
/**
* Creates the `[tableName]` table.
*/
create() {
return this.schema(
this.primaryKey(), // Primary key column
this.createdAt(), // CreatedAt column
this.updatedAt() // UpdatedAt column
// Add more columns here...
)
}
}
module.exports = new [className](); // Export an instance