Files
cannaiq/backend/list-stores.ts
2025-11-28 19:45:44 -07:00

28 lines
770 B
TypeScript

import { Pool } from 'pg';
const pool = new Pool({
connectionString: 'postgresql://sail:password@localhost:5432/dutchie_menus'
});
async function listStores() {
try {
const result = await pool.query('SELECT id, name, slug, dutchie_url FROM stores ORDER BY id LIMIT 10');
console.log('\nStores in database:');
console.log('─'.repeat(80));
result.rows.forEach(store => {
console.log(`ID: ${store.id} | Slug: ${store.slug}`);
console.log(`Name: ${store.name}`);
console.log(`URL: ${store.dutchie_url}`);
console.log('─'.repeat(80));
});
console.log(`Total: ${result.rowCount} stores\n`);
} catch (error: any) {
console.error('Error:', error.message);
} finally {
await pool.end();
}
}
listStores();