import { pool } from './src/db'; import { runWithTenantDataAccess } from './src/services/tenantSchemaService'; async function main() { const branch = process.argv[2] || 'BR002'; await runWithTenantDataAccess(branch, async () => { const cols = await pool.query( `SELECT column_name FROM information_schema.columns WHERE table_name='orders' AND table_schema = current_schema() ORDER BY ordinal_position` ); console.log('orders columns:', cols.rows.map((r) => r.column_name).join(', ')); const itemCols = await pool.query( `SELECT column_name FROM information_schema.columns WHERE table_name='order_items' AND table_schema = current_schema() ORDER BY ordinal_position` ); console.log('\norder_items columns:', itemCols.rows.map((r) => r.column_name).join(', ')); }); await pool.end(); } main().catch((e) => { console.error(e); process.exit(1); });