AeThex-Connect/scripts/check-schema.js
2026-02-28 23:50:09 -07:00

19 lines
838 B
JavaScript

const { Pool } = require('pg');
require('dotenv').config();
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
async function check() {
const pool = new Pool({ connectionString: process.env.DATABASE_URL?.replace('?sslmode=require', ''), ssl: true });
// Check existing columns in users table
const cols = await pool.query(`SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'users' ORDER BY ordinal_position`);
console.log('Users table columns:');
cols.rows.forEach(r => console.log(' -', r.column_name, '(' + r.data_type + ')'));
// Check existing tables
const tables = await pool.query(`SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'`);
console.log('\nExisting tables:', tables.rows.map(r => r.table_name).join(', '));
await pool.end();
}
check();