UNPKG

morpheus4j

Version:

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

40 lines (39 loc) 1.69 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const core_1 = require("@oclif/core"); const base_command_1 = require("../base-command"); const connection_1 = require("../neo4j/connection"); const clean_service_1 = require("../services/clean.service"); const neo4j_repository_1 = require("../services/neo4j.repository"); class Clean extends base_command_1.BaseCommand { static description = `Clean up migration-related database objects Removes all Morpheus migration metadata including nodes, relationships, and optionally constraints. Use with caution as this will reset the migration history.`; static examples = [ '<%= config.bin %> clean', '<%= config.bin %> clean --drop-constraints', '<%= config.bin %> clean --config ./custom-config.json', ]; static flags = { 'drop-constraints': core_1.Flags.boolean({ default: false, description: 'Additionally remove all Morpheus-related database constraints', }), ...base_command_1.BaseCommand.flags, }; async run() { const { flags } = await this.parse(Clean); try { const config = this.getConfig(); const connection = await (0, connection_1.getDatabaseConnection)(config); const repository = new neo4j_repository_1.Repository(connection); await new clean_service_1.CleanService(repository).clean(flags['drop-constraints']); await connection.close(); } catch (error) { this.error(error instanceof Error ? error.message : String(error)); } } } exports.default = Clean; //# sourceMappingURL=clean.js.map