UNPKG

morpheus4j

Version:

Morpheus is a migration tool for Neo4j. It aims to be a simple and intuitive way to migrate your database.

54 lines (53 loc) 2.13 kB
import { Neo4jConfig } from '../types'; export declare class MorpheusService { /** * Cleans the database by removing data and optionally dropping constraints. * * @param config - Optional configuration object that can include: * - Standard Neo4j configuration * - cleanConfig.dropConstraints: Whether to drop database constraints * * Configuration Resolution (in order of precedence): * 1. Provided config parameter (if passed) * 2. Environment variables * 3. .morpheus.json config file values * * The method will: * - Load and merge configurations from all sources * - Validate the final configuration against the Neo4jConfigSchema * - Establish a database connection * - Execute cleanup operations (optionally including constraint removal) * - Automatically close the database connection * * @throws {Error} If configuration validation fails or cleanup encounters an error */ cleanDatabase(config: { cleanConfig?: { dropConstraints?: boolean; }; } & Neo4jConfig): Promise<void>; cleanDatabase(): Promise<void>; /** * Executes database migrations using the merged configuration from config file and environment variables. * * @param config - Optional explicit configuration that takes highest precedence * * Configuration Resolution (in order of precedence): * 1. Provided config parameter (if passed) * 2. Environment variables * 3. .morpheus.json config file values * * The method will: * - Load and merge configurations from all sources * - Validate the final configuration against the Neo4jConfigSchema * - Establish a database connection * - Execute pending migrations * - Automatically close the database connection * * @throws {Error} If configuration validation fails or migrations encounter an error */ runMigrations(config: Neo4jConfig): Promise<void>; runMigrations(): Promise<void>; private getConfig; private withDatabaseConnection; }