|
| 1 | +import pkg from 'pg'; |
| 2 | +const { Client } = pkg; |
| 3 | + |
| 4 | +const client = new Client({ |
| 5 | + host: 'db.xomasbwwhhcxrptfdees.supabase.co', |
| 6 | + user: 'postgres', |
| 7 | + database: 'postgres', |
| 8 | + password: 'pluto1234!@#$%^_', |
| 9 | + port: 6543, |
| 10 | + ssl: { rejectUnauthorized: false } |
| 11 | +}); |
| 12 | + |
| 13 | +async function main() { |
| 14 | + await client.connect(); |
| 15 | + |
| 16 | + // List all tables in public schema |
| 17 | + const tables = await client.query(` |
| 18 | + SELECT tablename FROM pg_tables WHERE schemaname = 'public' ORDER BY tablename; |
| 19 | + `); |
| 20 | + console.log('Tables:', tables.rows.map(r => r.tablename)); |
| 21 | + |
| 22 | + // Check columns in merchants table if it exists |
| 23 | + const merchantTables = tables.rows.filter(r => r.tablename === 'merchants'); |
| 24 | + if (merchantTables.length > 0) { |
| 25 | + const cols = await client.query(` |
| 26 | + SELECT column_name FROM information_schema.columns |
| 27 | + WHERE table_schema = 'public' AND table_name = 'merchants' |
| 28 | + ORDER BY ordinal_position; |
| 29 | + `); |
| 30 | + console.log('merchants columns:', cols.rows.map(r => r.column_name)); |
| 31 | + } |
| 32 | + |
| 33 | + // Check migration history |
| 34 | + const migTables = tables.rows.filter(r => r.tablename === 'knex_migrations'); |
| 35 | + if (migTables.length > 0) { |
| 36 | + const migs = await client.query('SELECT * FROM knex_migrations ORDER BY id'); |
| 37 | + console.log('Completed migrations:', migs.rows); |
| 38 | + } |
| 39 | + |
| 40 | + await client.end(); |
| 41 | +} |
| 42 | + |
| 43 | +main().catch(err => console.error(err.message)); |
0 commit comments