chore(api): temporary boot-time data diagnostics in the container log

Prints aggregate counts only, prefixed [DIAG], right after migrations: customers
by kind/active/archived/step, what the omde list can show and how many rows are
sales-expert trading accounts (created vs adopted), experts' profile/trading
state, referral counts, the Admin table and the last applied migrations.

Read-only, no mobile/name/id is printed, each query isolated so a failure is
reported without stopping boot. Disable with DIAG_LOG=false; remove once the
empty-omde-list investigation is closed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
s.esmaeili
2026-10-26 08:02:57 +03:30
co-authored by Claude Opus 5.5
parent ee43d664d5
commit ab39f6abed
3 changed files with 207 additions and 0 deletions
+4
View File
@@ -4,6 +4,7 @@ import { join } from 'path';
import { promisify } from 'util';
import { Logger } from '@nestjs/common';
import { PrismaClient } from '@prisma/client';
import { logDataDiagnostics } from './diagnostics';
import { runMigrations, runOnce } from './migrate';
const execFileAsync = promisify(execFile);
@@ -40,6 +41,9 @@ export async function prepareDatabase(): Promise<void> {
logger.log('No pending migrations');
}
// TEMPORARY — see diagnostics.ts. Never throws.
await logDataDiagnostics(prisma);
if (process.env.RUN_SEED === 'false') return;
const seedScript = resolveSeedScript();