Existing Migration Classification
This document maps the current BeGreen migration history into Brightweb module ownership buckets.
Historical source:
/Users/leoribeiro/Documents/02_Projects/BeGreen/2025-12_FullIdentity/03_Work/Website/Development/be-green/supabase/migrations
This is a classification document, not a replay plan. Existing BeGreen migrations stay in place; this mapping defines where equivalent Brightweb-owned migrations belong going forward.
Core
20260105213611_remote_schema.sqlShared base schema snapshot. Contains some legacy tables that should be reviewed before adopting wholesale into Brightweb.20260129120000_add_marketing_contact_linked_to_profiles.sqlTransitional profile/contact linkage flag.20260130120000_profiles_marketing_contact_id.sqlProfile-owned marketing contact link.20260210101500_backfill_profile_identity_from_auth.sqlAuth/profile identity backfill.20260210103000_drop_profiles_name_column.sqlProfile cleanup.20260212110000_auth_profile_marketing_sync_triggers.sqlAuth confirmation/profile sync baseline.20260212170000_confirmation_gated_profile_sync.sqlConfirmation-gated profile sync refinement.20260218120000_app_activity_events.sqlShared app activity/alerts foundation.20260219103000_rate_limit_rpc.sqlShared rate-limit helper.20260222110000_notification_preferences_and_language.sqlShared user notification/language preferences.
Admin
20260206133000_allow_admin_for_staff_helpers.sqlTransitional helper broadening for admin recognition.20260218100000_rbac_foundation.sqlRBAC foundation.20260218101000_rbac_backfill_and_guards.sqlRBAC backfill and guarded role mutation.20260218101500_profiles_staff_update_guard.sqlPrivileged profile update guard.20260218102000_rbac_cleanup_drop_profiles_user_type.sqlCleanup after RBAC cutover.20260218110000_rbac_single_assignment_row.sqlSingle active assignment normalization.20260218111000_rbac_drop_assignment_lifecycle_fields.sqlRBAC cleanup.20260309143000_profile_default_role_assignment_trigger.sqlDefault role-assignment trigger/backfill.
CRM
20260206120000_phase2_crm_access_model.sqlOrganizations, CRM contacts, CRM status log, early staff helpers.20260206123000_phase2_org_members_org_courses.sqlOrganization members and org course access.20260206130000_phase2_cleanup_profiles.sqlCleanup of legacy CRM-related profile fields.20260212143000_harden_marketing_contacts_rls.sqlContact subscription write hardening.20260216100000_crm_contacts_updated_at_trigger.sqlCRM contacts updated-at trigger.20260219124500_organizations_address_nif.sqlOrganization details extension.20260309121500_org_primary_contact_admin_membership_sync.sqlOrg primary-contact to admin/member sync.20260309130500_org_primary_contact_sync_remove_old_access.sqlOrg primary-contact sync refinement and cleanup.20260310103000_organization_invitations.sqlOrganization invitation model.
Projects
20260224170000_project_manager_v1.sqlProjects baseline schema and RLS.20260302110000_project_lifecycle_dates.sqlProject lifecycle fields.20260302223000_project_activity_diff_payload.sqlProject activity payload refinement.20260302231000_project_activity_related_entities.sqlRelated entity payload extensions.20260302234500_project_task_description_diff_patch.sqlTask diff tracking patch.20260303001000_project_activity_deletion_events_patch.sqlDeletion activity events.20260303013000_project_cancellation_reason.sqlProject cancellation reason.20260309144500_projects_rls_team_scope.sqlTeam-scoped project RLS.20260309151500_projects_observer_write_restrictions.sqlObserver write restrictions.20260309154500_projects_observer_read_only_policies.sqlObserver read-only baseline.20260309173000_project_activity_payload_project_name.sqlProject-name activity payload patch.
Future Marketing Module
These are shared today in BeGreen but should become their own module instead of living inside CRM long term:
20260222130000_drop_marketing_active_column.sql20260222150000_resend_sync_metadata.sql20260222151000_email_event_log.sql20260222152000_marketing_send_only_cleanup.sql20260222193000_marketing_platform_v1.sql20260223101500_marketing_email_builder_v1.sql
Legacy / Client-Specific / Review
These should be reviewed before inclusion in Brightweb core:
20260302120000_deprecate_engagements_table.sqlLegacy cleanup forengagementsanddeliverables.- learning/catalog tables from
20260105213611_remote_schema.sqlcourses,lessons,enrollments,services,deliverables.
These may eventually become:
- a future learning/services module
- or remain client-specific depending on product direction
Practical rule for new work
When creating a new migration:
- if it affects every client, put it in
core - if it changes RBAC or user governance, put it in
admin - if it changes org/contact/customer workflows, put it in
crm - if it changes projects/tasks/milestones/team access, put it in
projects - if it is one-off, put it in
clients/<slug>
Repo source
docs/architecture/database-migration-classification.mdThis page is rendered directly from the root docs folder. Edit the markdown there, not inside the app.
PreviousDatabase Migration Authoring WorkflowThis document defines how Brightweb should create new database migrations from now on.NextDatabase Migration Safety PolicyThis policy defines how Brightweb evolves client databases safely while moving from BeGreen-first history to Brightweb-owned module migrations.