Files
Craze-Data-check/api/debug-db.js
T
Christian Vidal Wolf 54dfc24239 Fix: Re-align database indices after column insertion in Excel.
- Created a migration API route to shift data indices >= 12.
- Resolved discrepancy where UVP was showing LP Onl values due to column shift.
2026-04-23 15:43:40 +02:00

27 lines
953 B
JavaScript

import { createClient } from '@supabase/supabase-js';
const SUPABASE_URL = process.env.SUPABASE_URL || 'https://hwithddwaapyhnfwcesj.supabase.co';
const SUPABASE_KEY = process.env.SUPABASE_SERVICE_KEY || process.env.SUPABASE_ANON_KEY;
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
export default async function handler(req, res) {
try {
const { data: products } = await supabase.from('products').select('*').limit(5);
const { data: history } = await supabase.from('products_history').select('*').limit(5);
const { count } = await supabase.from('products').select('*', { count: 'exact', head: true });
return res.json({
productsCount: count,
sampleProducts: products,
sampleHistory: history,
env: {
hasUrl: !!process.env.SUPABASE_URL,
hasKey: !!process.env.SUPABASE_SERVICE_KEY
}
});
} catch (err) {
return res.status(500).json({ error: err.message });
}
}