【发布时间】:2022-01-14 01:08:22
【问题描述】:
我有一个 NestJs 项目。与预先创建的不同数据库建立了连接。
TypeOrmModule.forRoot({
"type": "mysql",
"host": "***,
"port": 3306,
"username": "***",
"password": "***",
"database": "db_name",
"autoLoadEntities": true,
"name": "users_db",
"synchronize": true
}),
当用户注册时,会使用他的 [user_id] 创建一个数据库。我需要在这个数据库中添加数据。如何通过获取他的 id 连接到他的数据库?我无法将数据传递给 app.module 还是有其他方法?我以前从未使用过 typeorm。
【问题讨论】: