# Supabase Migrations

## Applying Migrations

Since Supabase JS client doesn't support raw SQL execution, migrations must be applied manually via the Supabase Dashboard.

### Steps to Apply Migration

1. **Go to Supabase Dashboard**
   - Navigate to: https://supabase.com/dashboard/project/dwdytxxqcvlrmyemonxz
   - Login if needed

2. **Open SQL Editor**
   - Click on "SQL Editor" in the left sidebar
   - Click "New Query"

3. **Copy Migration SQL**
   - Open: `20251012_create_active_bots.sql`
   - Copy all the SQL content

4. **Run Migration**
   - Paste the SQL into the SQL Editor
   - Click "Run" or press `Cmd+Enter`

5. **Verify Success**
   - Check for success message
   - Verify table exists:
     ```sql
     SELECT * FROM active_bots LIMIT 1;
     ```

### Migration Files

- `202512_create_active_bots.sql` - Creates active_bots table for bot process tracking

### Rollback

If you need to rollback this migration:

```sql
DROP TABLE IF EXISTS active_bots CASCADE;
DROP FUNCTION IF EXISTS update_updated_at_column() CASCADE;
```

## After Migration

Once the migration is applied, the bot management steps will use the `active_bots` table to:
- Store bot metadata (PID, session_id, status)
- Track bot lifecycle
- Enable stateless Motia architecture
