Overview
Risk Legion uses Supabase PostgreSQL for data storage. Schema changes are managed through Supabase Dashboard and SQL migration files.Migration Approach
Risk Legion currently uses a manual migration approach via Supabase SQL Editor. Automated migration tools can be added as the project scales.
Applying Migrations
Via Supabase Dashboard
- Go to Supabase Dashboard → SQL Editor
- Open the migration file
- Review the SQL
- Execute
Via Supabase CLI
Index Migrations
Performance indexes have been applied to the database:RLS Policy Setup
Enable Row Level Security on all tables:Trigger Setup
Risk Score Calculation
Verifying Migrations
Check Indexes
Check RLS Status
Check Triggers
Rollback Procedures
Before Applying
- Take a database backup
- Test migration in staging first
- Document rollback SQL
Rollback Example
Best Practices
Always Test First
Always Test First
- Apply migrations to staging before production
- Verify application works correctly
- Check query performance
Document Changes
Document Changes
- Keep migration files in version control
- Include rollback procedures
- Document purpose of each change
Backup Before Changes
Backup Before Changes
- Create point-in-time backup
- Verify backup is restorable
- Keep backup until change is verified
Monitor After Deploy
Monitor After Deploy
- Watch for query performance issues
- Monitor error rates
- Check audit logs for issues