Modulo makers3d desarrollado con codex V 0.0.1

This commit is contained in:
Ryuk Mike
2026-07-29 23:58:58 +02:00
commit 2bedf7cbb7
171 changed files with 29421 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
import { readFile } from "node:fs/promises";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { pool } from "../db.js";
const currentDir = dirname(fileURLToPath(import.meta.url));
const schemaCandidates = [
join(currentDir, "../db/schema.sql"),
join(process.cwd(), "apps/api/src/db/schema.sql"),
join(process.cwd(), "dist/apps/api/src/db/schema.sql")
];
let sql: string | undefined;
for (const schemaPath of schemaCandidates) {
try {
sql = await readFile(schemaPath, "utf8");
break;
} catch {
// Try the next known location. The runtime container keeps the schema outside dist.
}
}
if (!sql) {
throw new Error(`Schema file not found. Checked: ${schemaCandidates.join(", ")}`);
}
await pool.query(sql);
console.log("Database schema applied");
await pool.end();