20 lines
598 B
JavaScript
20 lines
598 B
JavaScript
#!/usr/bin/env node
|
|
const Database = require('better-sqlite3');
|
|
const path = require('path');
|
|
|
|
const dbPath = path.join(__dirname, '..', 'data', 'database.sqlite');
|
|
const db = new Database(dbPath);
|
|
|
|
console.log('📋 Database Schema:\n');
|
|
|
|
// Get all tables
|
|
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name").all();
|
|
|
|
tables.forEach(table => {
|
|
console.log(`\n━━━ Table: ${table.name} ━━━`);
|
|
const schema = db.prepare(`SELECT sql FROM sqlite_master WHERE type='table' AND name=?`).get(table.name);
|
|
console.log(schema.sql);
|
|
});
|
|
|
|
db.close();
|