mirror of
https://github.com/bitbaum/orangecat.git
synced 2026-12-05 03:27:40 +01:00
- Bump version to 0.1.1 for tracking - Add webpack-bundle-optimizer script for Next.js config - Simplify ESLint configuration to resolve missing dependencies - Prepare for production deployment with proper version control This deployment includes: - Profile update fixes with banner_url support - LN address validation - Auth cookie fixes for profile updates - Various documentation and testing improvements 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
import { createClient } from '@supabase/supabase-js'
|
|
import dotenv from 'dotenv'
|
|
|
|
dotenv.config()
|
|
|
|
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL
|
|
const supabaseKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY
|
|
|
|
if (!supabaseUrl || !supabaseKey) {
|
|
throw new Error('Missing Supabase environment variables')
|
|
}
|
|
|
|
const supabase = createClient(supabaseUrl, supabaseKey)
|
|
|
|
async function applyMigrations() {
|
|
try {
|
|
// REMOVED: console.log statement
|
|
|
|
// Enable UUID extension
|
|
await supabase.rpc('enable_uuid_extension')
|
|
|
|
// Create profiles table
|
|
await supabase.rpc('create_profiles_table')
|
|
|
|
// Create funding_pages table
|
|
await supabase.rpc('create_funding_pages_table')
|
|
|
|
// Create transactions table
|
|
await supabase.rpc('create_transactions_table')
|
|
|
|
// Enable RLS
|
|
await supabase.rpc('enable_rls', { table_name: 'profiles' })
|
|
await supabase.rpc('enable_rls', { table_name: 'funding_pages' })
|
|
await supabase.rpc('enable_rls', { table_name: 'transactions' })
|
|
|
|
// Create policies
|
|
await supabase.rpc('create_profile_policies')
|
|
await supabase.rpc('create_funding_pages_policies')
|
|
await supabase.rpc('create_transactions_policies')
|
|
|
|
// Create trigger function and trigger
|
|
await supabase.rpc('create_user_trigger_function')
|
|
await supabase.rpc('create_user_trigger')
|
|
|
|
if (process.env.NODE_ENV === 'development') console.log('✅ Migrations applied successfully')
|
|
} catch (error) {
|
|
console.error('Error applying migrations:', error)
|
|
process.exit(1)
|
|
}
|
|
}
|
|
|
|
applyMigrations()
|