Spaces:
Running
Running
| require('dotenv').config(); | |
| const { createClient } = require('@supabase/supabase-js'); | |
| const supabaseUrl = process.env.SUPABASE_URL; | |
| const supabaseKey = process.env.SUPABASE_SERVICE_ROLE_KEY; | |
| if (!supabaseUrl || !supabaseKey) { | |
| console.error('Missing SUPABASE_URL or SUPABASE_SERVICE_ROLE_KEY in .env'); | |
| process.exit(1); | |
| } | |
| const supabase = createClient(supabaseUrl, supabaseKey); | |
| async function main() { | |
| try { | |
| console.log('Deleting all data from Supabase...'); | |
| const { error } = await supabase | |
| .from('price_records') | |
| .delete() | |
| .gt('date', '1970-01-01'); | |
| if (error) { | |
| console.error('Error deleting data:', error); | |
| } else { | |
| console.log('✅ Synthetic data deleted!'); | |
| } | |
| } catch (err) { | |
| console.error('Error:', err); | |
| } | |
| } | |
| main(); | |