[英]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.