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 12:05:51 -05:00
commit 45d1099fd8
7 changed files with 674 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,22 @@ 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,
uri: 'mongodb://disabled',
readUri: undefined,
password: undefined,
}
: {}),
},
},
}