🚀 How It Works
When the AI generates a database migration:- A blue alert appears with migration details (tables, RLS policies)
- Click “Run Migration” button
- The SQL is executed directly on your Supabase database ✅
- Your tables are ready to use immediately!
- ✅ Supabase integration configured
- ✅ Access Token and Project ID added to your integration
📝 Configure Access Token & Project ID
For automatic migrations to work, you need your Supabase Access Token and Project ID:Getting Your Access Token
- Go to your Supabase Dashboard
- Click on your profile (top right) → Account
- Go to Access Tokens tab
- Click “Generate new token”
- Give it a name (e.g., “CodeRocket Migrations”)
- Copy the token (starts with
sbp_...)
Getting Your Project ID
- Look at your project URL:
https://XXXXX.supabase.co - The Project ID is the part before
.supabase.co(e.g.,abcdefghijklmnop) - Or find it in Supabase Dashboard → Settings → General → Reference ID
Adding to CodeRocket
- Go to Account → Integrations
- Edit your Supabase integration (or create a new one)
- Paste the Access Token and Project ID
- Save
✨ Using Automatic Migrations
Step 1: Enable Supabase Integration
When creating a project, select your Supabase integration from the database dropdown. Or enable it later:- Open the sidebar → Integrations tab
- Toggle ON your Supabase integration
Step 2: Generate with Database Features
Ask the AI to create something with a database:Step 3: Run the Migration
When the AI generates a migration:- A blue alert appears: “Database Migration Detected”
- Review the tables and policies listed
- Click “Run Migration”
- ✅ Done! Tables are created instantly
🔒 Security & Safety
- Migrations run via Supabase Management API for maximum reliability
- Access Token required - uses official Supabase API with proper authentication
- Tokens are encrypted at rest using AES-256
- Only authenticated users can run migrations on their own projects
- Authorization check: You must own the chat to run its migrations
- All connections use HTTPS/TLS encryption
💡 Migration Features
The migration alerts show:- 📊 Tables: List of tables being created
- 🔒 RLS Policies: Number of Row Level Security policies
- ▶️ Run Migration: Execute migration automatically
- 📝 View SQL: View the complete migration code
- 📋 Copy SQL: Copy SQL to clipboard
🐛 Troubleshooting
”Supabase Access Token and Project ID required for migrations”
Solution:- Generate an access token in Supabase Dashboard → Account → Access Tokens
- Get your Project ID from your project URL (the part before .supabase.co)
- Add both in Account → Integrations → Edit Supabase Integration
”Migration failed: [error message]”
Common causes:- Table already exists → Safe to ignore if intentional
- Permission issues → Check your access token is valid and has correct permissions
- Invalid Project ID → Verify the Project ID matches your project URL
- Connection issues → Verify your Supabase project is online
- SQL syntax error → Review the SQL code and report to AI
Connection timeout
If migration takes too long:- The database might be slow to respond
- Try running the SQL manually in Supabase Dashboard
- Check your Supabase project status

