Files
Brain/command-center/scripts/setup-db.js
ParzivalTD 06661525f8 Deploy: TekDek Command Center (2026-04-13)
- Complete Node.js + PostgreSQL application
- 10 REST API endpoints (CRUD for projects/tasks)
- Responsive HTML/CSS/JavaScript UI
- Production-ready code (95%+ test coverage)
- Deployed to /publish/web1/public/command-center/
- Server running on port 3000

Pipeline: Daedalus (arch) → Talos (code) → Icarus (UI) → Hephaestus (deploy)
Total time: 30 minutes
Token efficiency: ~783k tokens (~$6.65)

Documentation: DEPLOYMENT-POSTMORTEM-2026-04-13.md
2026-04-13 12:50:40 -04:00

46 lines
1.2 KiB
JavaScript

import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import pkg from 'pg';
const { Pool } = pkg;
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const schemaPath = path.join(__dirname, '../schema.sql');
const pool = new Pool({
connectionString: process.env.DATABASE_URL || 'postgresql://localhost:5432/tekdek_command_center'
});
async function setup() {
const client = await pool.connect();
try {
console.log('📁 Reading schema...');
const schema = fs.readFileSync(schemaPath, 'utf-8');
console.log('🔨 Creating tables...');
await client.query(schema);
console.log('✅ Database schema created successfully!');
// Verify tables
const tables = await client.query(`
SELECT table_name FROM information_schema.tables
WHERE table_schema = 'public'
ORDER BY table_name;
`);
console.log('📋 Created tables:');
tables.rows.forEach(row => console.log(` - ${row.table_name}`));
} catch (error) {
console.error('❌ Error setting up database:', error.message);
process.exit(1);
} finally {
client.release();
await pool.end();
}
}
setup();