Migration Endpoints
Database migration management.
Get Migration SQL
GET /migration
Get migration SQL for current config.
bash
curl http://localhost:3000/migrationResponse:
json
{
"sql": "CREATE TABLE users (...);",
"tables": ["users", "posts"],
"instructions": "Apply in Supabase SQL Editor"
}Check Status
GET /migration/status
Check if tables exist.
bash
curl http://localhost:3000/migration/statusResponse:
json
{
"ready": true,
"tables": {
"users": true,
"posts": true,
"comments": false
}
}Quick Fix
GET /migration/quick-fix
Get SQL with RLS disabled (dev only).
bash
curl http://localhost:3000/migration/quick-fixResponse:
json
{
"sql": "CREATE TABLE users (...); ALTER TABLE users DISABLE ROW LEVEL SECURITY;",
"warning": "For development only"
}Apply Migration
POST /migration/apply
Apply pending migrations.
bash
curl -X POST http://localhost:3000/migration/apply \
-H "Authorization: Bearer <token>"Response:
json
{
"success": true,
"applied": ["001_create_users", "002_create_posts"]
}CLI Commands
bash
# Generate migration
npm run generate-migration
# Apply migration
npm run apply-migration
# Auto-migrate (generate + apply)
npm run auto-migratePublishing
POST /publish/init
Initialize publishing system.
bash
curl -X POST http://localhost:3000/publish/init \
-H "Content-Type: application/json" \
-d '{
"checkTables": ["users", "posts"]
}'POST /publish/verify
Verify database setup.
bash
curl -X POST http://localhost:3000/publish/verifyPOST /publish/entity
Publish entity with auto-check.
bash
curl -X POST http://localhost:3000/publish/entity \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"table": "users",
"data": {
"name": "John",
"email": "john@example.com"
}
}'