import pkg from 'pg'; const { Pool } = pkg; const pool = new Pool({ connectionString: process.env.DATABASE_URL }); async function main() { const result = await pool.query(` SELECT COUNT(*) as total_products, COUNT(CASE WHEN discount_type IS NOT NULL AND discount_value IS NOT NULL THEN 1 END) as products_with_discounts FROM products `); console.log('Product Count:'); console.log(result.rows[0]); // Get a sample of products with discounts const sample = await pool.query(` SELECT name, brand, regular_price, sale_price, discount_type, discount_value FROM products WHERE discount_type IS NOT NULL AND discount_value IS NOT NULL LIMIT 5 `); console.log('\nSample Products with Discounts:'); console.log(sample.rows); await pool.end(); } main().catch(console.error);