fix(server): sslmode not working (#15587)

* parse db url before passing it to the driver

* don't be lazy

* simplify

* simplify

* add tests

* update sql sync script

* update mock

* remove unused import

* remove unused imports
This commit is contained in:
Mert 2025-01-24 14:01:55 -05:00 committed by GitHub
parent f5a3d7ba23
commit ba01b40e7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 154 additions and 50 deletions

View file

@ -4,10 +4,12 @@ import { Reflector } from '@nestjs/core';
import { SchedulerRegistry } from '@nestjs/schedule';
import { Test } from '@nestjs/testing';
import { TypeOrmModule } from '@nestjs/typeorm';
import { PostgresJSDialect } from 'kysely-postgres-js';
import { KyselyModule } from 'nestjs-kysely';
import { OpenTelemetryModule } from 'nestjs-otel';
import { mkdir, rm, writeFile } from 'node:fs/promises';
import { join } from 'node:path';
import postgres from 'postgres';
import { format } from 'sql-formatter';
import { GENERATE_SQL_KEY, GenerateSqlQueries } from 'src/decorators';
import { entities } from 'src/entities';
@ -84,7 +86,7 @@ class SqlGenerator {
const moduleFixture = await Test.createTestingModule({
imports: [
KyselyModule.forRoot({
...database.config.kysely,
dialect: new PostgresJSDialect({ postgres: postgres(database.config.kysely) }),
log: (event) => {
if (event.level === 'query') {
this.sqlLogger.logQuery(event.query.sql);