UNPKG

morpheus4j

Version:

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

50 lines (49 loc) 2.11 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 delete_service_1 = require("../services/delete.service"); const file_service_1 = require("../services/file.service"); const neo4j_repository_1 = require("../services/neo4j.repository"); class Delete extends base_command_1.BaseCommand { static args = { version: core_1.Args.string({ description: 'The version that should be deleted', name: 'version', required: true, }), }; static description = `Delete a migration from the database. This command can be used to repair broken migration chains. If you accidentally deleted a migration file, you can use this command to find the previous migration and delete it.`; static examples = [ '<%= config.bin %> delete 1.0.0', '<%= config.bin %> delete 1.2.3 --config ./custom-config.json', '<%= config.bin %> delete 1.4.0 --dry-run', ]; static flags = { ...base_command_1.BaseCommand.flags, 'dry-run': core_1.Flags.boolean({ default: false, description: 'Perform a dry run - no changes will be made to the database', }), }; async run() { try { const config = this.getConfig(); const { args, flags } = await this.parse(Delete); const connection = await (0, connection_1.getDatabaseConnection)(config); const fileService = new file_service_1.FileService(config); const repository = new neo4j_repository_1.Repository(connection); await new delete_service_1.DeleteService(repository, fileService).delete(args.version, { dryRun: flags['dry-run'], }); await connection.close(); } catch (error) { this.error(error instanceof Error ? error.message : String(error)); } } } exports.default = Delete; //# sourceMappingURL=delete.js.map