Backend features: - Express.js API server - Supabase database integration - Stripe Checkout for payments ($249 kit + $9.99/mo premium) - Stripe webhooks for payment events - Admin panel with order management - Auth middleware with JWT - Email service via Brevo API endpoints: - /api/stripe/* - Payment processing - /api/webhook/stripe - Stripe webhooks - /api/admin/* - Admin operations - /function/well-api/api - Legacy API proxy Database migrations: - orders, subscriptions, push_tokens tables Schemes updated: - Removed updatedAt from all schemes - Updated credentials section with live values - Added Stripe configuration details 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Run SQL migration in Supabase
|
|
*
|
|
* This script requires direct PostgreSQL connection to Supabase.
|
|
* Get your database password from Supabase Dashboard:
|
|
* Settings → Database → Connection string → Password
|
|
*
|
|
* Usage:
|
|
* PGPASSWORD=your_password node run-migration.js
|
|
*/
|
|
|
|
const { createClient } = require('@supabase/supabase-js');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const SUPABASE_URL = process.env.SUPABASE_URL || 'https://bfzizknbxbsfrffqityf.supabase.co';
|
|
const SUPABASE_KEY = process.env.SUPABASE_SERVICE_KEY || 'sb_secret_N7TN930UzzXGgFgrAaozqA_Y4b0DKlM';
|
|
|
|
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
|
|
|
|
async function runMigration() {
|
|
console.log('Checking if password_resets table exists...');
|
|
|
|
// Try to query the table
|
|
const { data, error } = await supabase
|
|
.from('password_resets')
|
|
.select('id')
|
|
.limit(1);
|
|
|
|
if (!error) {
|
|
console.log('✓ password_resets table already exists');
|
|
return;
|
|
}
|
|
|
|
if (error.code === 'PGRST205') {
|
|
console.log('Table does not exist. Please run the following SQL in Supabase Dashboard:');
|
|
console.log('\n--- SQL to execute in Supabase Dashboard (SQL Editor) ---\n');
|
|
|
|
const sql = fs.readFileSync(
|
|
path.join(__dirname, 'migrations/001_password_resets.sql'),
|
|
'utf8'
|
|
);
|
|
console.log(sql);
|
|
console.log('\n--- End of SQL ---\n');
|
|
console.log('URL: https://supabase.com/dashboard/project/bfzizknbxbsfrffqityf/sql');
|
|
} else {
|
|
console.error('Error:', error);
|
|
}
|
|
}
|
|
|
|
runMigration().catch(console.error);
|