add db migration
This commit is contained in:
parent
cecc96bbba
commit
edff100ef2
@ -1,12 +1,14 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
import { resolve } from 'path';
|
import { resolve } from 'path';
|
||||||
|
|
||||||
import chalk from 'chalk';
|
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';
|
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 };
|
type HandleOptions = MigrationCreateOptions & { dir: string };
|
||||||
|
|
||||||
export class TypeormMigrationCreate {
|
export class TypeormMigrationCreate {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
import { resolve } from 'path';
|
import { resolve } from 'path';
|
||||||
|
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
@ -5,13 +6,12 @@ import { upperFirst } from 'lodash';
|
|||||||
import { format } from 'mysql2';
|
import { format } from 'mysql2';
|
||||||
import { DataSource } from 'typeorm';
|
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';
|
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 };
|
type HandlerOptions = MigrationGenerateOptions & { dataSource: DataSource } & { dir: string };
|
||||||
|
|
||||||
export class TypeormMigrationGenerate {
|
export class TypeormMigrationGenerate {
|
||||||
@ -44,6 +44,7 @@ export class TypeormMigrationGenerate {
|
|||||||
downSql.query = TypeormMigrationGenerate.prettifyQuery(downSql.query);
|
downSql.query = TypeormMigrationGenerate.prettifyQuery(downSql.query);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
console.log('sqlInMemory', sqlInMemory);
|
||||||
sqlInMemory.upQueries.forEach((upQuery) => {
|
sqlInMemory.upQueries.forEach((upQuery) => {
|
||||||
upSqls.push(
|
upSqls.push(
|
||||||
` await queryRunner.query(\`${upQuery.query.replace(
|
` await queryRunner.query(\`${upQuery.query.replace(
|
||||||
|
Loading…
Reference in New Issue
Block a user