Skip to main content

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

  1. Go to Supabase Dashboard → SQL Editor
  2. Open the migration file
  3. Review the SQL
  4. 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

  1. Take a database backup
  2. Test migration in staging first
  3. Document rollback SQL

Rollback Example

Best Practices

  • Apply migrations to staging before production
  • Verify application works correctly
  • Check query performance
  • Keep migration files in version control
  • Include rollback procedures
  • Document purpose of each change
  • Create point-in-time backup
  • Verify backup is restorable
  • Keep backup until change is verified
  • Watch for query performance issues
  • Monitor error rates
  • Check audit logs for issues