Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt

Use this file to discover all available pages before exploring further.

Version: 2.0.0
Last Updated: 2026-01-15
Purpose: Complete documentation and tooling for migrating from Lovable Cloud to Supabase Cloud

Quick Start Verification Checklist

Before starting the migration, verify your setup:

✅ 1. MCP Connection

mcp_supabase_get_project_url()
// Expected: https://<project-ref>.supabase.co

✅ 2. CLI Installation

supabase --version
# Expected: Supabase CLI 1.x.x or higher

✅ 3. Project Linked

supabase status
# Expected: Shows linked project details

✅ 4. Migration Files Present

Get-ChildItem "supabase/migrations/*.sql" | Measure-Object
# Expected: Count >= 393

✅ 5. Staging Branch Available

mcp_supabase_list_branches()
// Expected: Shows 'staging' branch
All checks passed? Proceed to Completion Plan

Migration Status Tracker

Current Phase: Phase 6 - Documentation Updates

PhaseStatusNotes
Phase 0: Pre-Setup Verification✅ CompleteMCP connection verified
Phase 1: Staging Branch Setup✅ CompleteStaging branch created
Phase 2: Apply Migrations✅ Complete393+ migrations applied
Phase 3: Run SQL Audits✅ CompleteAudits executed, issues documented
Phase 4: Create Fix Migrations✅ CompleteTemplates prepared
Phase 5: Apply and Validate Fixes✅ CompleteFixes validated
Phase 6: Documentation Updates🔄 In ProgressUpdating AGENTS.md, guides
Phase 7: Application Testing⏳ Pending
Phase 8: Pre-Production Checklist⏳ Pending
Phase 9: Production Migration⏳ Pending

Issue Tracker

IssuePriorityStatusFix Migration
UPDATE policies missing WITH CHECKP0Template ReadyTEMPLATE_fix_rls_with_check.sql
Storage bucket namingP1Template ReadyTEMPLATE_fix_storage_bucket_names.sql
Missing audit columnsP1Template ReadyTEMPLATE_fix_missing_audit_columns.sql
TypeScript types emptyP0PendingGenerate after migrations

Documentation Index

Primary Guides

DocumentPurposeWhen to Use
Completion PlanStep-by-step migration planPrimary migration guide
Pre-Production ChecklistFinal validation checklistBefore production migration
MCP Usage GuideMCP vs CLI decision matrixWhen using Supabase tools

Migration plans (feature-specific)

DocumentPurpose
MIGRATION_SUMMARY.mdHR-09-P5 phase summary and status
plans/MIGRATION_PLAN_HR-09-P5.mdHR-09-P5 detailed migration guide
plans/PRE_MIGRATION_CODE_CHECKLIST.mdDeveloper checklist before migration day

Setup Guides

DocumentPurpose
Staging Setup GuideCreate and configure staging branch
SQL Audit InstructionsRun audit scripts against database
Type Generation GuideGenerate TypeScript types

Reports

ReportLocationPurpose
Migration Readiness Reportreports/MIGRATION_READINESS_REPORT.mdOverall assessment
RLS Policy Inventoryreports/audits/RLS_POLICY_INVENTORY.mdRLS policy analysis
Column Compliance Reportreports/audits/COLUMN_COMPLIANCE_REPORT.mdColumn standards
Migration Inventoryreports/audits/migration-inventory.jsonRaw analysis data

Tool Usage Quick Reference

When to Use MCP

TaskMCP Tool
Get project URLmcp_supabase_get_project_url()
List branchesmcp_supabase_list_branches()
List tablesmcp_supabase_list_tables()
List migrationsmcp_supabase_list_migrations()
Search docsmcp_supabase_search_docs()
Run SQL queriesmcp_supabase_execute_sql()
Check advisorsmcp_supabase_get_advisors()
Generate typesmcp_supabase_generate_typescript_types()

When to Use CLI

TaskCLI Command
Create migrationsupabase migration new <name>
Apply migrationssupabase db push
Generate typessupabase gen types typescript
Start localsupabase start
Create branchsupabase --experimental branches create
Link projectsupabase link --project-ref <id>
Deploy functionssupabase functions deploy
Full Guide: MCP Usage Guide

Scripts Reference

Analysis Scripts (Local)

# Parse migration files and generate inventory
npx ts-node scripts/lint-migrations.ts

# Generate markdown reports from inventory
npx ts-node scripts/generate-migration-reports.ts

# Count tables by module
npx ts-node scripts/count-tables-by-module.ts

SQL Audit Scripts (Run in Supabase)

ScriptPurposeRun Via
scripts/audit-rls-policies.sqlFind UPDATE policies missing WITH CHECKDashboard SQL Editor or MCP
scripts/audit-table-columns.sqlFind missing audit columnsDashboard SQL Editor or MCP
scripts/audit-storage-buckets.sqlFind non-compliant bucket namesDashboard SQL Editor or MCP

Utility Scripts

# Generate TypeScript types (use CLI)
./scripts/generate-types.sh

# Or manually:
supabase gen types typescript --project-id <id> > src/integrations/supabase/types.ts

Migration Templates

Templates for creating fix migrations (in supabase/migrations/):
TemplatePurpose
TEMPLATE_fix_rls_with_check.sqlAdd WITH CHECK to UPDATE policies
TEMPLATE_fix_storage_bucket_names.sqlRename non-compliant buckets
TEMPLATE_fix_missing_audit_columns.sqlAdd missing audit columns
Usage:
  1. Copy template with timestamp: supabase migration new fix_<issue>
  2. Fill with generated SQL from audit scripts
  3. Apply: supabase db push

Key Statistics

MetricCountVerification
Migration Files393+Get-ChildItem "supabase/migrations/*.sql" | Measure-Object
Total Tables~465mcp_supabase_list_tables()
RLS Policies~1,685See RLS Policy Inventory
Database Functions~575See migration inventory
Storage Buckets7mcp_supabase_execute_sql() on storage.buckets
Triggers~762See migration inventory

Tables by Module

ModulePrefixExpected Tables
Platform Foundationpf_74
Human Resourceshr_94
Finance & Accountingfa_46
Forms & Workflowfw_54
Recovery Housingrh_51
Governance & Riskgr_49
Facilities Managementfm_22
Leadership OSlo_29
IT Service Managementit_35
Other-11
Total~465

Critical Issues Summary

P0 (Must Fix Before Migration)

IssueImpactStatus
UPDATE policies missing WITH CHECKSecurity vulnerability - multi-tenant breachTemplate Ready
TypeScript types emptyNo type safety for database operationsPending type generation

P1 (Should Fix Before Migration)

IssueImpactStatus
SECURITY DEFINER functions missing search_pathSecurity best practice15 functions identified
Non-compliant storage bucketsNaming convention violation4 buckets need renaming
Missing audit columnsData governance gap~60 tables need updated_by

Migration Workflow


Supabase Documentation

Project Documentation


Support

For questions or issues:
  1. Review the Completion Plan
  2. Check the Pre-Production Checklist
  3. Search Supabase docs via MCP: mcp_supabase_search_docs()
  4. Review audit reports in reports/audits/

Last Updated: 2026-01-15
Version: 2.0.0