@adonisjs/lucid
Version:
SQL ORM built on top of Active Record pattern
42 lines (41 loc) • 1.32 kB
TypeScript
import { EventEmitter } from 'node:events';
import { type Application } from '@adonisjs/core/app';
import { type Database } from '../database/main.js';
import { type SchemaDumperOptions } from '../types/migrator.js';
/**
* SchemaDumper provides a code-level API for dumping the current database
* schema to a SQL file. Commands are simply one interface for interacting
* with this class.
*/
export declare class SchemaDumper extends EventEmitter {
#private;
/**
* Last error occurred when executing the dump
*/
error: null | Error;
/**
* Result of the dump operation, available after a successful run
*/
result: {
dumpLabel: string;
metaLabel: string;
pruned: boolean;
} | null;
/**
* Current status of the dumper
*/
get status(): 'pending' | 'completed' | 'error';
constructor(db: Database, app: Application<any>, options: SchemaDumperOptions);
on(event: 'start', callback: () => void): this;
on(event: 'end', callback: () => void): this;
/**
* Execute the schema dump. Dumps the database schema to a SQL file,
* writes the sidecar manifest, and optionally prunes migration
* directories.
*/
run(): Promise<void>;
/**
* Close database connections
*/
close(): Promise<void>;
}