summaryrefslogtreecommitdiff
path: root/packages/backend/src/postgres.ts
diff options
context:
space:
mode:
authorMarie <marie@kaifa.ch>2024-01-21 13:11:23 +0100
committerMarie <marie@kaifa.ch>2024-01-21 13:11:23 +0100
commitdb012fc8c3c88f8676b8a0c13347d0257df85eb2 (patch)
treee9118b604b9ea027369cd327837bb59843de6f83 /packages/backend/src/postgres.ts
parentmerge: fix make sure that signToActivityPubGet defaults to true (#352) (diff)
parentenhance(frontend): 季節に応じた画面の演出を南半球に対応さ... (diff)
downloadsharkey-db012fc8c3c88f8676b8a0c13347d0257df85eb2.tar.gz
sharkey-db012fc8c3c88f8676b8a0c13347d0257df85eb2.tar.bz2
sharkey-db012fc8c3c88f8676b8a0c13347d0257df85eb2.zip
merge: upstream (1)
Diffstat (limited to 'packages/backend/src/postgres.ts')
-rw-r--r--packages/backend/src/postgres.ts34
1 files changed, 19 insertions, 15 deletions
diff --git a/packages/backend/src/postgres.ts b/packages/backend/src/postgres.ts
index 395c7ab44b..a43b132426 100644
--- a/packages/backend/src/postgres.ts
+++ b/packages/backend/src/postgres.ts
@@ -78,6 +78,7 @@ import { MiFlashLike } from '@/models/FlashLike.js';
import { MiUserMemo } from '@/models/UserMemo.js';
import { NoteEdit } from '@/models/NoteEdit.js';
import { MiBubbleGameRecord } from '@/models/BubbleGameRecord.js';
+import { MiReversiGame } from '@/models/ReversiGame.js';
import { Config } from '@/config.js';
import MisskeyLogger from '@/logger.js';
@@ -194,6 +195,7 @@ export const entities = [
MiUserMemo,
NoteEdit,
MiBubbleGameRecord,
+ MiReversiGame,
...charts,
];
@@ -211,22 +213,24 @@ export function createPostgresDataSource(config: Config) {
statement_timeout: 1000 * 10,
...config.db.extra,
},
- replication: config.dbReplications ? {
- master: {
- host: config.db.host,
- port: config.db.port,
- username: config.db.user,
- password: config.db.pass,
- database: config.db.db,
+ ...(config.dbReplications ? {
+ replication: {
+ master: {
+ host: config.db.host,
+ port: config.db.port,
+ username: config.db.user,
+ password: config.db.pass,
+ database: config.db.db,
+ },
+ slaves: config.dbSlaves!.map(rep => ({
+ host: rep.host,
+ port: rep.port,
+ username: rep.user,
+ password: rep.pass,
+ database: rep.db,
+ })),
},
- slaves: config.dbSlaves!.map(rep => ({
- host: rep.host,
- port: rep.port,
- username: rep.user,
- password: rep.pass,
- database: rep.db,
- })),
- } : undefined,
+ } : {}),
synchronize: process.env.NODE_ENV === 'test',
dropSchema: process.env.NODE_ENV === 'test',
cache: !config.db.disableCache && process.env.NODE_ENV !== 'test' ? { // dbをcloseしても何故かredisのコネクションが内部的に残り続けるようで、テストの際に支障が出るため無効にする(キャッシュも含めてテストしたいため本当は有効にしたいが...)