Kysely - WIP

* create database migration files
* kysely codegen
* kysely migrate
This commit is contained in:
Philipinho
2024-03-24 16:59:26 +00:00
parent 7d56920ad5
commit d855152dda
19 changed files with 2634 additions and 643 deletions

View File

@ -8,6 +8,10 @@ import { DatabaseModule } from './database/database.module';
import { WsModule } from './ws/ws.module';
import { ServeStaticModule } from '@nestjs/serve-static';
import { join } from 'path';
import { KyselyModule } from 'nestjs-kysely';
import { EnvironmentService } from './integrations/environment/environment.service';
import { PostgresDialect } from 'kysely';
import { Pool } from 'pg';
@Module({
imports: [
@ -19,6 +23,19 @@ import { join } from 'path';
ServeStaticModule.forRoot({
rootPath: join(__dirname, '..', '..', '..', 'client/dist'),
}),
KyselyModule.forRootAsync({
imports: [],
inject: [EnvironmentService],
useFactory: (envService: EnvironmentService) => {
return {
dialect: new PostgresDialect({
pool: new Pool({
connectionString: envService.getDatabaseURL(),
}) as any,
}),
};
},
}),
],
controllers: [AppController],
providers: [AppService],