29 lines
945 B
TypeScript
29 lines
945 B
TypeScript
import { createClient } from '@supabase/supabase-js';
|
|
import * as dotenv from 'dotenv';
|
|
import path from 'path';
|
|
|
|
dotenv.config({ path: path.resolve(process.cwd(), '.env') });
|
|
const supabase = createClient(process.env.SUPABASE_URL!, process.env.SUPABASE_KEY!);
|
|
|
|
const userId = '8d5efd9e-0760-4859-8c07-0930ab3ede5a';
|
|
|
|
async function testQueryConflict() {
|
|
console.log(`Testing query with UUID (${userId}) and string (global)...`);
|
|
|
|
// This is what HistoryTab.tsx is doing
|
|
const { data, error } = await supabase
|
|
.from('trade_history')
|
|
.select('*')
|
|
.or(`user_id.eq.${userId},user_id.eq.global`);
|
|
|
|
if (error) {
|
|
console.error('❌ Query FAILED:', error.message);
|
|
console.error('Details:', error.details);
|
|
console.error('Code:', error.code);
|
|
} else {
|
|
console.log('✅ Query SUCCEEDED:', data?.length, 'rows found.');
|
|
}
|
|
}
|
|
|
|
testQueryConflict();
|