move pg_dump elsewhere so it doesn't run during the Docker build

This commit is contained in:
Ryan Pandya 2025-01-31 18:25:40 -08:00
parent 38423b88e3
commit d683797185

View File

@ -8,12 +8,11 @@ import { pgDump } from 'pg-dump-restore';
const dbPath = path.join(serverConfig.dataDir, `lifetracker-${new Date().getTime()}.sql`); const dbPath = path.join(serverConfig.dataDir, `lifetracker-${new Date().getTime()}.sql`);
const returnVal = (await pgDump(getConnectionDetails(), {
filePath: dbPath,
}));
export async function GET(req: NextRequest) { export async function GET(req: NextRequest) {
try { try {
console.log((await pgDump(getConnectionDetails(), {
filePath: dbPath,
})).stdout);
// Read the production database file // Read the production database file
const dbFile = fs.readFileSync(dbPath); const dbFile = fs.readFileSync(dbPath);
return new NextResponse(dbFile, { return new NextResponse(dbFile, {