Feature: Is there a way this package can work Nest.js? I have tried to work around it and I haven't found the solution yet.
kimkimani opened this issue ยท 5 comments
kimkimani commented
๐
tada5hi commented
@kimkimani i'm not familiar with nest.js. Can you provide a reproduction repo for testing ?
SebiBasti commented
I'm using this package with Nest.js. What is not working on your end?
tada5hi commented
@kimkimani please reopen the issue, if you still have problems setting everything up.
cavator commented
@SebiBasti could u provide your config files? to make it work
SebiBasti commented
@SebiBasti could u provide your config files? to make it work
const config = {
type: 'postgres',
host: process.env.DATABASE_HOST,
port: parsePort(5432, process.env.DATABASE_PORT),
username: process.env.DATABASE_USERNAME || 'postgres',
password: process.env.DATABASE_PASSWORD || 'postgres',
database: process.env.DATABASE_NAME || 'nestbackend',
entities: [__dirname + '/../**/*.entity.{js,ts}'],
migrations: [__dirname + '/../database/migrations/*.{js,ts}'],
autoLoadEntities: true,
synchronize: false,
logging: process.env.NODE_ENV === 'development' ? 'all' : true,
logger: logger // custom logger
}
export default registerAs('typeorm', () => config)
export const connectionSource = new DataSource(config as PostgresConnectionOptions)
We are not using synchronize: true
but migration files.
I used this link as inspiration: https://dev.to/amirfakour/using-typeorm-migration-in-nestjs-with-postgres-database-3c75