UNPKG

forge-sql-orm-cli

Version:
46 lines (45 loc) 1.67 kB
import "reflect-metadata"; /** * Options for migration creation */ export interface CreateMigrationOptions { output: string; entitiesPath: string; force?: boolean; host?: string; port?: number; user?: string; password?: string; dbName?: string; } /** * Loads the current migration version from `migrationCount.ts`. * @param migrationPath - Path to the migration folder. * @returns The latest migration version. */ export declare const loadMigrationVersion: (migrationPath: string) => Promise<number>; /** * Cleans SQL statements by removing unnecessary database options. * @param sql - The raw SQL statement. * @returns The cleaned SQL statement. */ export declare function cleanSQLStatement(sql: string): string; /** * Generates a migration file using the provided SQL statements. * @param createStatements - Array of SQL statements. * @param version - Migration version number. * @returns TypeScript migration file content. */ export declare function generateMigrationFile(createStatements: string[], version: number): string; /** * Saves the generated migration file along with `migrationCount.ts` and `index.ts`. * @param migrationCode - The migration code to be written to the file. * @param version - Migration version number. * @param outputDir - Directory where the migration files will be saved. */ export declare function saveMigrationFiles(migrationCode: string, version: number, outputDir: string): void; /** * Creates a full database migration. * @param options - Database connection settings and output paths. */ export declare const createMigration: (options: CreateMigrationOptions) => Promise<never>;