feat: add database schema support for gateway and game profiles
- Introduced `dbSchema` configuration option in GatewayApiConfig and GatewayOrchestratorConfig. - Implemented schema resolution logic in environment configuration functions. - Updated context and orchestrator factory to use GatewayPrismaClient instead of PrismaClient. - Refactored orchestrator server and profile repository to accommodate new database schema handling. - Created separate Prisma schemas for game and gateway in the infra package. - Enhanced Postgres connector to support schema overrides in database URLs. - Updated documentation to reflect changes in database schema handling. - Added new Prisma generation and database push scripts for game and gateway schemas.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import {
|
||||
createPostgresConnector,
|
||||
createGamePostgresConnector,
|
||||
type InputJsonValue,
|
||||
type TurnEngineDatabaseClient,
|
||||
type TurnEngineEventCreateManyInput,
|
||||
@@ -117,7 +117,7 @@ export const seedScenarioToDatabase = async (
|
||||
},
|
||||
});
|
||||
|
||||
const connector = createPostgresConnector({ url: options.databaseUrl });
|
||||
const connector = createGamePostgresConnector({ url: options.databaseUrl });
|
||||
const now = options.now ?? new Date();
|
||||
const tickSeconds = options.tickSeconds ?? DEFAULT_TICK_SECONDS;
|
||||
const generalGold = options.defaultGeneralGold ?? DEFAULT_GENERAL_GOLD;
|
||||
@@ -125,7 +125,7 @@ export const seedScenarioToDatabase = async (
|
||||
|
||||
await connector.connect();
|
||||
try {
|
||||
const prisma = connector.prisma as TurnEngineDatabaseClient;
|
||||
const prisma = connector.prisma as unknown as TurnEngineDatabaseClient;
|
||||
|
||||
if (options.resetTables ?? true) {
|
||||
await prisma.event.deleteMany();
|
||||
|
||||
Reference in New Issue
Block a user