Version: 2.0.0Documentation Index
Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
Use this file to discover all available pages before exploring further.
Last Updated: 2026-01-15
Purpose: Final validation checklist before migrating to Supabase Cloud production
Phase 0: Setup Verification
Purpose: Verify all tools and environments are correctly configured before proceeding.
MCP Connection
- MCP server is running and responsive
-
mcp_supabase_get_project_url()returns valid URL -
mcp_supabase_list_branches()shows expected branches
CLI Installation
- Supabase CLI installed (
supabase --versionreturns version) - CLI version is 1.0.0 or higher
- CLI is authenticated (
supabase logincompleted)
Project Linking
- Local project linked to Supabase (
supabase statusshows project) - Correct project ID in link
- Correct environment (staging vs production)
Migration Files
- Migration files exist in
supabase/migrations/ - 393+ migration files present
- Files are properly named with timestamps
GitHub Integration (if applicable)
- Repository connected to Supabase
- Branch mapping configured (staging Git → staging Supabase)
- Auto-deploy enabled for migrations
Phase 1: Staging Validation
Database Schema
Expected Counts:| Metric | Expected | Verification |
|---|---|---|
| Total Tables | ~465 | mcp_supabase_list_tables() |
| Migrations Applied | 393+ | mcp_supabase_list_migrations() |
Table Counts by Module
| Module | Prefix | Expected Tables | Status |
|---|---|---|---|
| Platform Foundation | pf_ | 74 | [ ] Verified |
| Human Resources | hr_ | 94 | [ ] Verified |
| Finance & Accounting | fa_ | 46 | [ ] Verified |
| Forms & Workflow | fw_ | 54 | [ ] Verified |
| Recovery Housing | rh_ | 51 | [ ] Verified |
| Governance & Risk | gr_ | 49 | [ ] Verified |
| Facilities Management | fm_ | 22 | [ ] Verified |
| Leadership OS | lo_ | 29 | [ ] Verified |
| IT Service Management | it_ | 35 | [ ] Verified |
| Total | ~465 | [ ] Verified |
Phase 2: RLS Policy Validation
Critical: UPDATE Policies WITH CHECK
- 0 UPDATE policies missing WITH CHECK clause (P0 requirement)
- All policies use SECURITY DEFINER helper functions
- Multi-tenant isolation verified with test accounts
- Cross-organization data access blocked (tested)
RLS Coverage
- All business tables have RLS enabled
- RLS policies cover SELECT, INSERT, UPDATE, DELETE
Phase 3: Column Compliance
Audit Columns
- All business tables have
created_atandupdated_at - Tables with
created_byalso haveupdated_by(P1) -
custom_fieldspresent on all business entities (where applicable)
Organization ID Column
- All multi-tenant tables have
organization_id -
organization_idis NOT NULL where required - Foreign key to
pf_organizationsexists
Phase 4: Storage Bucket Validation
Naming Convention
- 0 buckets with non-compliant names (should follow
{core}-{purpose}) - All renamed buckets:
avatars→pf-avatars, etc.
Storage RLS
- RLS policies on storage.objects configured
- Bucket permissions verified
- File uploads/downloads work
Phase 5: Database Functions
SECURITY DEFINER Functions
- All SECURITY DEFINER functions have
SET search_path = public - Function naming follows
{core}_{action}_{entity}()pattern - Functions tested and working correctly
Phase 6: TypeScript Types
Type Generation
- Types generated from staging database
-
npm run typecheckpasses with 0 errors - All table definitions present in types file
- No
[_ in never]: neverempty type definitions
Phase 7: Security Advisors
Get Advisors
- Security advisors reviewed
- Performance advisors reviewed
- All critical issues addressed
Phase 8: Application Testing
Authentication
- User login/logout works
- Session refresh works
- Password reset works
- OAuth providers configured (if applicable)
Multi-Tenant Isolation
- Users can only access their organization’s data
- Cross-organization queries return empty results
- RLS policies prevent unauthorized access
- Test with multiple organizations and users
Critical Flows
- Data creation (INSERT) works correctly
- Data updates (UPDATE) respect RLS policies
- Data deletion (DELETE) works correctly
- Soft deletes work where implemented
Edge Functions
- All edge functions deployed to staging
- Edge functions can access database
- Edge functions respect RLS policies
- Error handling works correctly
Storage Operations
- File uploads work (with new bucket names)
- File downloads work
- File deletions work
- Storage RLS policies enforced
Phase 9: Performance Validation
Query Performance
- No queries taking > 5 seconds
- Indexes present on foreign keys
- Indexes present on frequently queried columns
- No N+1 query patterns
Application Performance
- Page load times acceptable (< 3s)
- API response times acceptable (< 1s)
- No memory leaks
- No excessive database connections
Phase 10: Final Sign-Off
Documentation Updated
-
AGENTS.mdupdated with Supabase MCP usage patterns -
docs/integrations/SUPABASE_SETUP.mdhas branching setup -
docs/development/MCP_USAGE.mdcomplete - Migration completion plan updated
Team Review
- Database team reviewed and approved
- Security team reviewed and approved
- Application team reviewed and approved
- Product team reviewed and approved
Go/No-Go Decision
- All P0 issues resolved
- All P1 issues resolved or documented
- Staging validation complete
- Team ready for migration
Migration Day Checklist
Pre-Migration
- Final backup of Lovable database
- Maintenance mode enabled
- All users logged out
- Final data export completed
During Migration
- Supabase project created/configured
- Migrations applied (
supabase db push) - Data imported
- Edge functions deployed
- Environment variables configured
- DNS/URL updated
Post-Migration Validation
Use MCP:- All migrations applied successfully
- Data import complete (row counts match)
- TypeScript types generated and validated
- Application connects successfully
- Critical flows tested
- Multi-tenant isolation verified
- Performance validated
- Monitoring confirmed working
Success Criteria Summary
| Criterion | Target | Verification |
|---|---|---|
| Migrations Applied | 393+ | mcp_supabase_list_migrations() |
| Tables Created | ~465 | mcp_supabase_list_tables() |
| UPDATE Policies with WITH CHECK | 100% | SQL query returns 0 missing |
| Compliant Storage Buckets | 100% | SQL query returns 0 non-compliant |
| TypeScript Type Check | 0 errors | npm run typecheck |
| Security Advisors | 0 critical | mcp_supabase_get_advisors() |
| Application Tests | All pass | npm run test |
Last Updated: 2026-01-15
Version: 2.0.0
Next Review: After staging validation complete