UNPKG

@iarayan/ch-orm

Version:

A Developer-First ClickHouse ORM with Powerful CLI Tools

65 lines 1.86 kB
import { Connection } from "../connection/Connection"; import { Schema } from "./Schema"; /** * Abstract base class for database migrations * Provides structure and common functionality for migrations */ export declare abstract class Migration { /** * Schema instance for database operations */ protected schema: Schema; /** * Connection instance for direct database access */ protected connection: Connection; /** * Migration name (derived from class name) */ readonly name: string; /** * Indicates if migration has been applied */ private applied; /** * Create a new Migration instance * @param connection - ClickHouse connection */ constructor(connection: Connection); /** * Abstract method to be implemented by concrete migrations for applying changes * This contains the forward migration logic */ abstract up(): Promise<void>; /** * Abstract method to be implemented by concrete migrations for reverting changes * This contains the rollback migration logic */ abstract down(): Promise<void>; /** * Apply the migration * @returns Promise that resolves when the migration is applied */ apply(): Promise<void>; /** * Revert the migration * @returns Promise that resolves when the migration is reverted */ revert(): Promise<void>; /** * Get the migration name * @returns Migration name */ getName(): string; /** * Check if the migration has been applied * @returns True if the migration has been applied, false otherwise */ isApplied(): boolean; /** * Set the applied state of the migration * @param state - Applied state */ setApplied(state: boolean): void; } //# sourceMappingURL=Migration.d.ts.map