Last active
August 11, 2024 16:54
-
-
Save paulodutra/b3cd742b9b96c9168c47bf749c73a6f3 to your computer and use it in GitHub Desktop.
InMemory database config Typeorm Nestjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { registerAs } from '@nestjs/config'; | |
import { TypeOrmModuleOptions } from '@nestjs/typeorm'; | |
export const inMemoryDatabaseConfig = registerAs( | |
'database.inMemory', | |
(): TypeOrmModuleOptions => ({ | |
type: 'sqlite', | |
database: ':memory', | |
entities: [ | |
__dirname + | |
'/../../../infrastructure/database/entities/*.entity{.ts,.js}', | |
], | |
migrations: [ | |
__dirname + | |
'/../../../infrastructure/database/migrations/*.migration{.ts,.js}', | |
], | |
synchronize: true, | |
logging: ['error', 'query', 'warn', 'info', 'schema', 'log'], | |
}), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment