WellNuo/backend/scripts/inspect-db.js
Sergei 7105bb72f7 Stable Light version - App Store submission
WellNuo Lite architecture:
- Simplified navigation flow with NavigationController
- Profile editing with API sync (/auth/profile endpoint)
- OTP verification improvements
- ESP WiFi provisioning setup (espProvisioning.ts)
- E2E testing infrastructure (Playwright)
- Speech recognition hooks (web/native)
- Backend auth enhancements

This is the stable version submitted to App Store.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-12 20:28:18 -08:00

69 lines
2.1 KiB
JavaScript

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();