-
카테고리
-
세부 분야
백엔드
-
해결 여부
미해결
명령어로 sync 실행이 안됩니다 ㅜㅜ
22.09.13 19:04 작성 조회수 297
0
강좌에 나오는 schema:sync를 입력했는데
Synchronizes your entities with database schema. It runs schema update queries
on all connections you have. To run update queries on a concrete connection use
-c option.
옵션:
-h, --help 도움말 표시 [불리언]
-d, --dataSource Path to the file where your DataSource instance is defined.
[필수]
-v, --version 버전 표시 [불리언]
필수 인수가 주어지지 않았습니다: dataSource
이러한 문구가 계속 나옵니다.
명령어로 sync를 하고싶은데 도와주세요 ㅠㅠ 구글링해도 나오질 않네요
제가 작성한 module은 다음과 같습니다.
import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { TypeOrmModule } from '@nestjs/typeorm';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { Users } from './entities/Users';
@Module({
imports: [
ConfigModule.forRoot({ isGlobal: true }),
TypeOrmModule.forRootAsync({
inject: [ConfigService],
useFactory: async (configService: ConfigService) => {
return {
type: 'mysql',
host:
configService.get('TEST') === 'true'
? configService.get('TEST_HOST')
: configService.get('HOST'),
port:
configService.get('TEST') === 'true'
? configService.get('TEST_DB_PORT')
: configService.get('DB_PORT'),
username:
configService.get('TEST') === 'true'
? configService.get('TEST_USER_NAME')
: configService.get('USER_NAME'),
password:
configService.get('TEST') === 'true'
? configService.get('TEST_PASSWORD')
: configService.get('PASSWORD'),
database:
configService.get('TEST') === 'true'
? configService.get('TEST_DATABASE')
: configService.get('DATABASE'),
entities: [Users],
migrations: [__dirname + '/src/migarions/*.ts'],
cli: { migrationsDir: 'src/migrations' },
charset: 'utf8mb4',
synchronize: false,
autoLoadEntities: true,
keepConnectionAlive: true,
logging: true,
};
},
}),
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
답변을 작성해보세요.
0
답변 1