// Einfacher Migrations-Runner: spielt alle server/migrations/*.sql in // Sortier-Reihenfolge ein. Idempotent (alle Migrations nutzen IF NOT EXISTS). import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; import { pool } from "./db.js"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const dir = path.join(__dirname, "migrations"); const files = fs.readdirSync(dir).filter((f) => f.endsWith(".sql")).sort(); console.log(`→ ${files.length} Migration(en) gefunden.`); for (const f of files) { const sql = fs.readFileSync(path.join(dir, f), "utf8"); process.stdout.write(` ▸ ${f} … `); await pool.query(sql); console.log("ok"); } console.log("✓ HOST-Schema bereit."); await pool.end();