我ormconfig.json有多個資料庫,如何為此串列的特定資料庫運行遷移?在下面的示例中,我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"
}
}
]
uj5u.com熱心網友回復:
趕緊跑:
yarn typeorm migration:run -c configName其中 configName 是name您的ormconfig.json資料庫串列中的配置。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/328558.html
標籤:PostgreSQL 奥姆 打字机 node.js-typeorm
