【发布时间】:2021-10-20 22:41:51
【问题描述】:
我的ormconfig.json 有多个数据库,如何为这个列表的SPECIFIC DB 运行迁移?在下面的示例中,我已经设置了迁移的 dev 数据库,现在我需要为名为 test 的另一个数据库设置迁移。
我想运行这样的命令:
yarn typeorm migration:run --database test
// ormconfig.json
[
{
"name": "dev",
"type": "postgres",
"host": "localhost",
"port": 5432,
"username": "postgres",
"password": "postgres",
"database": "postgres",
"synchronize": true,
"logging": true,
"entities": ["src/typeorm/entity/**/*.ts"],
"migrations": ["src/typeorm/migration/**/*.ts"],
"subscribers": ["src/typeorm/subscriber/**/*.ts"],
"cli": {
"entitiesDir": "src/typeorm/entity",
"migrationsDir": "src/typeorm/migration",
"subscribersDir": "src/typeorm/subscriber"
}
},
{
"name": "test",
"type": "postgres",
"host": "localhost",
"port": 5433,
"username": "postgres",
"password": "postgres",
"database": "postgres",
"synchronize": true,
"logging": false,
"entities": ["src/typeorm/entity/**/*.ts"],
"migrations": ["src/typeorm/migration/**/*.ts"],
"subscribers": ["src/typeorm/subscriber/**/*.ts"],
"cli": {
"entitiesDir": "src/typeorm/entity",
"migrationsDir": "src/typeorm/migration",
"subscribersDir": "src/typeorm/subscriber"
}
}
]
【问题讨论】:
标签: postgresql orm typeorm node.js-typeorm