UNPKG

@megaorm/cli

Version:

This package allows you to communicate with MegaORM via commands directly from the command line interface (CLI).

36 lines (35 loc) 1.45 kB
import { MegaCommand } from '../MegaCommand'; /** * Represents a command to clear tables using seeder files. * * The command performs the following actions: * - Resolves the path to the seeders folder based on the configuration. * - Clears all tables associated with seeder files by default. * - Optionally allows specifying a single table to clear instead of all tables. * * This ensures that seeded data can be efficiently removed while providing flexibility * to target specific tables or clear all tables if needed. * * @extends MegaCommand */ export declare class ClearCommand extends MegaCommand { protected static syntax: string; /** * Resolves the appropriate path for the seeders folder based on the configuration. * * @param config The MegaORM configuration object. * @returns The resolved path for the seeders folder. * @throws `MegaCommandError` if `paths.seeders` is absolute and TypeScript is enabled. */ private static path; /** * Executes the command to clear seeded data from tables. * * The command clears all tables associated with seeder files by default. * If a specific table is provided as an argument, only that table will be cleared. * * @returns A promise that resolves when the table(s) have been successfully cleared * or rejects with an error if the clearing operation fails. */ static exec(): Promise<unknown>; }