【发布时间】:2022-07-07 01:31:39
【问题描述】:
我最近从typeorm@0.2 移动到版本0.3 并且在发布的文档中有这句话:https://github.com/typeorm/typeorm/releases/tag/0.3.0 这对我来说没有多大意义(在DEPRECATED 的部分下):
entities, migrations, subscribers options inside DataSourceOptions accepting string directories support is deprecated. You'll be only able to pass entity references in the future versions.
从这里我知道我们现在必须指定实体并且不能使用(或者更好地说,将来不能使用)通配符路径,即entities: ['dist/**/*.entity.{ts,js}'],而我们必须使用:entities: [User, AnoherEntity...]
但这也适用于migrations 吗?我觉得这很令人困惑,因为迁移是由 typeorm 的 cli 生成的,这意味着我们必须生成迁移,即1652169197705-SomeMigration,然后将该文件名及其完整路径添加到 DataSource 的迁移中? migrations: ['1652169197705-SomeMigration'...]
谢谢!
【问题讨论】:
标签: nestjs typeorm node.js-typeorm