UNPKG

pg-flyway

Version:

Migration tool for PostgreSQL database, NodeJS version of Java migration tool - flyway (not wrapper for https://flywaydb.org/documentation/commandline)

33 lines (32 loc) 1.61 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.infoHandler = infoHandler; exports.info = info; const commander_1 = require("commander"); const default_1 = require("../constants/default"); const env_keys_1 = require("../constants/env-keys"); const info_service_1 = require("../services/info.service"); async function infoHandler(options) { const infoService = new info_service_1.InfoService({ databaseUrl: options.databaseUrl, historyTable: options.historyTable, historySchema: options.historySchema, }); await infoService.info(); infoService.destroy(); } function info(program) { program .command('info') .description('Prints the details and status information about all the migrations') .addOption(new commander_1.Option('-u,--database-url <string>', 'Database url for connect (example: postgres://POSTGRES_USER:POSTGRES_PASSWORD@localhost:POSTGRES_PORT/POSTGRES_DATABASE?schema=public)') .env(env_keys_1.PG_FLYWAY_DATABASE_URL) .makeOptionMandatory()) .addOption(new commander_1.Option('-h,--history-table <string>', 'History table with states of migration') .default(default_1.PG_FLYWAY_DEFAULT_INFO_CONFIG.historyTable) .env(env_keys_1.PG_FLYWAY_HISTORY_TABLE)) .addOption(new commander_1.Option('--history-schema <string>', 'History table schema with states of migration') .default(default_1.PG_FLYWAY_DEFAULT_INFO_CONFIG.historySchema) .env(env_keys_1.PG_FLYWAY_HISTORY_SCHEMA)) .action((options) => infoHandler(options)); }