[英]Connection “default” was not found
ConnectionNotFoundError: Connection "default" was not found.
當我開始使用依賴倒置原則時,我收到了這個錯誤。
{
"name": "default",
"type": "postgres",
"host": "localhost",
"port": 5432,
"username": "postgres",
"password": "docker",
"database": "customer",
"entities": [
"./src/modules/**/infra/typeorm/entities/*.ts"
],
"migrations": [
"./src/shared/infra/typeorm/migrations/*.ts"
],
"seeds": [
"./src/shared/infra/typeorm/seeds/*.ts"
],
"cli": {
"migrationsDir": "./src/shared/infra/typeorm/migrations"
}
}
Column type for Admin#email is not defined and cannot be guessed. Make sure you have turned on an "emitDecoratorMetadata": true option in tsconfig.json. Also make sure you have imported "reflect-metadata" on top of the main entry file in your application (before any entity imported).If you are using JavaScript instead of TypeScript you must explicitly provide a column type.
您必須使用
createConnection
function 創建與數據庫的連接。
const connection = await createConnection();
createConnection
function 返回一個connection
。 將此connection
用於所有數據庫操作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.