Skip to content

Commit 4ab37e9

Browse files
committed
Merge branch 'main' of https://github.com/boostcampwm-2024/web05-Denamu into fix/tag-insertion-error
2 parents 8e9fb5e + 83a5535 commit 4ab37e9

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ dotenv.config({
99
{
1010
PROD: `${process.cwd()}/env/.env.prod`,
1111
LOCAL: `${process.cwd()}/env/.env.local`,
12-
DEV: `${process.cwd()}/env/.env.local`,
1312
}[process.env.NODE_ENV] || '',
1413
});
1514

@@ -18,4 +17,6 @@ const dbOptions = loadDBSetting(configService);
1817

1918
export const AppDataSource = new DataSource({
2019
...dbOptions,
20+
entities: [`${__dirname}/src/**/*.entity.{js,ts}`],
21+
migrations: [`${__dirname}/src/migration/*.{js,ts}`],
2122
});

server/package.json

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,19 @@
1010
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
1111
"start": "node dist/src/main.js",
1212
"start:dev": "nest start --watch",
13-
"start:debug": "cross-env NODE_ENV=debug nest start --debug --watch",
1413
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
15-
"test:unit": "cross-env NODE_ENV=test jest --config test/jest-unit.json",
16-
"test:unit:cov": "cross-env NODE_ENV=test jest --config test/jest-unit.json --coverage",
17-
"test:e2e": "cross-env NODE_ENV=test jest --config test/jest-e2e.json",
14+
"test:unit": "cross-env NODE_ENV=TEST jest --config test/jest-unit.json",
15+
"test:unit:cov": "cross-env NODE_ENV=TEST jest --config test/jest-unit.json --coverage",
16+
"test:e2e": "cross-env NODE_ENV=TEST jest --config test/jest-e2e.json",
1817
"test:e2e:debug": "cross-env NODE_ENV=debug jest --config test/jest-e2e.json",
19-
"test:e2e:cov": "cross-env NODE_ENV=test jest --config test/jest-e2e.json --coverage",
20-
"test": "cross-env NODE_ENV=test jest --config test/jest-integration.json",
21-
"test:watch": "cross-env NODE_ENV=test jest --config test/jest-integration.json --watch",
22-
"test:cov": "cross-env NODE_ENV=test jest --config test/jest-integration.json --coverage"
18+
"test:e2e:cov": "cross-env NODE_ENV=TEST jest --config test/jest-e2e.json --coverage",
19+
"test": "cross-env NODE_ENV=TEST jest --config test/jest-integration.json",
20+
"test:watch": "cross-env NODE_ENV=TEST jest --config test/jest-integration.json --watch",
21+
"test:cov": "cross-env NODE_ENV=TEST jest --config test/jest-integration.json --coverage",
22+
"typeorm": "typeorm-ts-node-commonjs",
23+
"migration:create": "cross-env NODE_ENV=PROD npm run typeorm -- migration:create",
24+
"prod:migration:generate": "cross-env NODE_ENV=PROD npm run typeorm -- migration:generate -d dataSource.ts",
25+
"local:migration:generate": "cross-env NODE_ENV=LOCAL npm run typeorm -- migration:generate -d dataSource.ts"
2326
},
2427
"dependencies": {
2528
"@anthropic-ai/sdk": "^0.36.3",

server/src/common/database/load.config.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { ConfigService } from '@nestjs/config';
22

33
export function loadDBSetting(configService: ConfigService) {
44
const env = process.env.NODE_ENV;
5-
const isDev = env === 'LOCAL' || env === 'DEV';
6-
const isTest = env === 'test';
5+
const isDev = env === 'LOCAL' || env === 'DEV' || env === 'TEST';
76

87
return {
98
type: configService.get<'mysql' | 'sqlite'>('DB_TYPE'),
@@ -14,9 +13,9 @@ export function loadDBSetting(configService: ConfigService) {
1413
password: configService.get<string>('DB_PASSWORD'),
1514
entities: [`${__dirname}/../../**/*.entity.{js,ts}`],
1615

17-
synchronize: isDev || isTest,
16+
synchronize: isDev,
1817
migrations: [`${__dirname}/../../migration/*.{js,ts}`],
19-
migrationsRun: false,
18+
migrationsRun: !isDev,
2019
logging: isDev,
2120
};
2221
}

0 commit comments

Comments
 (0)