diff --git a/src/modules/database/commands/typeorm.migration.create.ts b/src/modules/database/commands/typeorm.migration.create.ts index 56624e6..92b54e4 100644 --- a/src/modules/database/commands/typeorm.migration.create.ts +++ b/src/modules/database/commands/typeorm.migration.create.ts @@ -1,12 +1,14 @@ +/* eslint-disable @typescript-eslint/no-require-imports */ import { resolve } from 'path'; import chalk from 'chalk'; -import { CommandUtils } from 'typeorm/commands/CommandUtils'; -import { PlatformTools } from 'typeorm/platform/PlatformTools'; -import { camelCase } from 'typeorm/util/StringUtils'; import { MigrationCreateOptions } from '@/modules/database/commands/types'; +const { CommandUtils } = require('typeorm/commands/CommandUtils'); +const { PlatformTools } = require('typeorm/platform/PlatformTools'); +const { camelCase } = require('typeorm/util/StringUtils'); + type HandleOptions = MigrationCreateOptions & { dir: string }; export class TypeormMigrationCreate { diff --git a/src/modules/database/commands/typeorm.migration.generate.ts b/src/modules/database/commands/typeorm.migration.generate.ts index 84dde55..5e4f7ba 100644 --- a/src/modules/database/commands/typeorm.migration.generate.ts +++ b/src/modules/database/commands/typeorm.migration.generate.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-require-imports */ import { resolve } from 'path'; import chalk from 'chalk'; @@ -5,13 +6,12 @@ import { upperFirst } from 'lodash'; import { format } from 'mysql2'; import { DataSource } from 'typeorm'; -import { CommandUtils } from 'typeorm/commands/CommandUtils'; -import { PlatformTools } from 'typeorm/platform/PlatformTools'; - -import { camelCase } from 'typeorm/util/StringUtils'; - import { MigrationGenerateOptions } from '@/modules/database/commands/types'; +const { CommandUtils } = require('typeorm/commands/CommandUtils'); +const { PlatformTools } = require('typeorm/platform/PlatformTools'); +const { camelCase } = require('typeorm/util/StringUtils'); + type HandlerOptions = MigrationGenerateOptions & { dataSource: DataSource } & { dir: string }; export class TypeormMigrationGenerate { @@ -44,6 +44,7 @@ export class TypeormMigrationGenerate { downSql.query = TypeormMigrationGenerate.prettifyQuery(downSql.query); }); } + console.log('sqlInMemory', sqlInMemory); sqlInMemory.upQueries.forEach((upQuery) => { upSqls.push( ` await queryRunner.query(\`${upQuery.query.replace(