What problem does it solve?
This Skill ensures that your Supabase PostgreSQL database migrations are created, tested, and applied safely, preventing data loss, security vulnerabilities, and schema inconsistencies. It enforces best practices like idempotency and Row-Level Security (RLS), saving you from critical database errors.
Core Features & Use Cases
- Idempotent Migrations: Guides in writing SQL that can be run multiple times without error, using
IF NOT EXISTS and conditional logic.
- RLS Security Enforcement: Ensures every new table includes RLS policies, enforcing data security by default.
- Foreign Key Conventions: Promotes using
profile_id instead of user_id for robust data relationships.
- Use Case: When adding a new table to your database, use this skill to generate a migration file that includes RLS, proper foreign keys, and indexes, then verify its application and security policies.
Quick Start
1. Create Migration File
cd /home/sk/template-copilot-kit-py/supabase/migrations
touch $(date +%Y%m%d%H%M%S)_description.sql
2. Apply Migration
supabase db push