T-2: M0.2 — Finish shared Postgres migrations: bun run db:migrate + fresh-database schema test

This commit is contained in:
Studio 2026-11-27 10:39:55 -05:00
parent 654782a6a1
commit b82fc7c905
3 changed files with 114 additions and 7 deletions

View file

@ -13,6 +13,7 @@ const __dirname = path.dirname(__filename);
export interface InitializeStockConfigOptions {
mongoReadOnly?: boolean;
postgresOnly?: boolean;
}
/**
@ -33,14 +34,15 @@ export function initializeStockConfig(
const rawConfig = configInstance.initialize(stockAppSchema);
const config: StockAppConfig =
options?.mongoReadOnly === true
options?.mongoReadOnly === true || options?.postgresOnly === true
? {
...rawConfig,
database: {
...rawConfig.database,
mongodb: {
...rawConfig.database.mongodb,
readOnly: true,
...(options?.mongoReadOnly === true ? { readOnly: true } : {}),
...(options?.postgresOnly === true ? { enabled: false } : {}),
},
},
}