tada5hi / typeorm-extension

This library provides utitlites to create & drop the database, seed the database and apply URL query parameter(s).
https://typeorm-extension.tada5hi.net
MIT License
211 stars 34 forks source link

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. #867

Closed kimkimani closed 5 months ago

kimkimani commented 7 months ago

💚

tada5hi commented 7 months ago

@kimkimani i'm not familiar with nest.js. Can you provide a reproduction repo for testing ?

SebiBasti commented 7 months ago

I'm using this package with Nest.js. What is not working on your end?

tada5hi commented 5 months ago

@kimkimani please reopen the issue, if you still have problems setting everything up.

cavator commented 3 months ago

@SebiBasti could u provide your config files? to make it work

SebiBasti commented 3 months ago

@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