Error
ConnectionNotFoundError: Connection "default" was not found.
I encountered this error when I implemented the dependency inversion principle in my project.
ormconfig.json
{
"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"
}
}
Listing this now
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.