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C,CAAC,CAAA;QACnB,CAAC;IACL,CAAC;CACJ;AAxCD,oDAwCC","file":"MigrationShowCommand.js","sourcesContent":["import { DataSource } from \"../data-source\"\nimport * as process from \"process\"\nimport * as yargs from \"yargs\"\nimport { PlatformTools } from \"../platform/PlatformTools\"\nimport path from \"path\"\nimport { CommandUtils } from \"./CommandUtils\"\n\n/**\n * Shows all migrations and whether they have been run or not.\n */\nexport class MigrationShowCommand implements yargs.CommandModule {\n command = \"migration:show\"\n describe = \"Show all migrations and whether they have been run or not\"\n\n builder(args: yargs.Argv) {\n return args.option(\"dataSource\", {\n alias: \"d\",\n describe:\n \"Path to the file where your DataSource instance is defined.\",\n demandOption: true,\n })\n }\n\n async handler(args: yargs.Arguments) {\n let dataSource: DataSource | undefined = undefined\n try {\n dataSource = await CommandUtils.loadDataSource(\n path.resolve(process.cwd(), args.dataSource as string),\n )\n dataSource.setOptions({\n subscribers: [],\n synchronize: false,\n migrationsRun: false,\n dropSchema: false,\n logging: [\"schema\"],\n })\n await dataSource.initialize()\n await dataSource.showMigrations()\n await dataSource.destroy()\n\n process.exit(0)\n } catch (err) {\n PlatformTools.logCmdErr(\"Error during migration show:\", err)\n\n if (dataSource && dataSource.isInitialized)\n await dataSource.destroy()\n\n process.exit(1)\n }\n }\n}\n"],"sourceRoot":".."}