const { Client } = require('pg'); const client = new Client({ user: 'sergei', host: 'eluxnetworks.net', database: 'wellnuo_app', password: 'W31153Rg31', port: 5432, ssl: { rejectUnauthorized: false } }); async function run() { try { await client.connect(); console.log('Connected to database'); // Check tables const res = await client.query(` SELECT table_schema, table_name FROM information_schema.tables WHERE table_schema IN ('public', 'auth') AND table_name IN ('users', 'otp_codes'); `); console.log('Tables found:', res.rows); // Inspect otp_codes schema to know columns const otpSchema = await client.query(` SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'otp_codes'; `); console.log('otp_codes columns:', otpSchema.rows); // Inspect auth.users schema // If auth.users exists, we use it. If public.users exists, check columns. // Based on create-tables.sql: REFERENCES auth.users(id) // Let's assume we need to insert into auth.users (if it's Supabase) // OR maybe public.users if custom auth mimicking Supabase. // Let's check public.users columns too. const usersSchema = await client.query(` SELECT column_name, data_type FROM information_schema.columns WHERE table_schema = 'public' AND table_name = 'users'; `); console.log('public.users columns:', usersSchema.rows); // Create Test User const TEST_PHONE = '+15555555555'; const TEST_OTP = '123456'; // Logic will depend on schemas found, but let's try to be smart. // If public.users has 'phone', we insert there? // If auth.users exists, we probably need a UUID. // Placeholder for insertion logic - I will run this to see schemas first // then update the script to insert. } catch (err) { console.error('Database error:', err); } finally { await client.end(); } } run();