mirror of
https://github.com/docmost/docmost.git
synced 2025-11-13 22:01:14 +10:00
switch to nx monorepo
This commit is contained in:
15
apps/server/src/database/database.module.ts
Normal file
15
apps/server/src/database/database.module.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { AppDataSource } from './typeorm.config';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
TypeOrmModule.forRoot({
|
||||
...AppDataSource.options,
|
||||
entities: ['dist/src/**/*.entity.{ts,js}'],
|
||||
migrations: ['dist/src/**/migrations/*.{ts,js}'],
|
||||
autoLoadEntities: true,
|
||||
}),
|
||||
],
|
||||
})
|
||||
export class DatabaseModule {}
|
||||
3
apps/server/src/database/migrations/.gitignore
vendored
Normal file
3
apps/server/src/database/migrations/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# don't include frequently changing migrations yet
|
||||
.gitignore
|
||||
!.gitignore
|
||||
14
apps/server/src/database/typeorm.config.ts
Normal file
14
apps/server/src/database/typeorm.config.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
import * as dotenv from 'dotenv';
|
||||
dotenv.config();
|
||||
export const AppDataSource: DataSource = new DataSource({
|
||||
type: 'postgres',
|
||||
url:
|
||||
process.env.DATABASE_URL ||
|
||||
'postgresql://postgres:password@localhost:5432/dc?schema=public',
|
||||
entities: ['src/**/*.entity.{ts,js}'],
|
||||
migrations: ['src/**/migrations/*.{ts,js}'],
|
||||
subscribers: [],
|
||||
synchronize: false,
|
||||
logging: process.env.NODE_ENV === 'development',
|
||||
});
|
||||
Reference in New Issue
Block a user