Skip to content

Conversation

@chrisdburr
Copy link
Collaborator

No description provided.

   Drop orphaned tables left over from Django migration:
   - 12 Django auth/admin tables (django_*, auth_*, account_*, authtoken_*)
   - 9 social auth tables (social_auth_*, socialaccount_*)
   - 17 legacy API tables (api_eapuser, api_assurancecase, api_evidence, etc.)
   - 1 websockets table

   Data was already migrated to Prisma-managed tables. Old-to-new ID
   mappings preserved in legacy_mappings table.

   Resolves: AssurancePlatform-jdr
  Rename 4 Django-era tables to consistent snake_case naming:
  - api_casestudy → case_studies
  - api_casestudy_assurance_cases → case_study_published_cases
  - api_casestudyfeatureimage → case_study_images
  - api_publishedassurancecase → published_assurance_cases

  Also renames all associated indexes, constraints, and sequences.

  Resolves: AssurancePlatform-at5
  - Rename 4 legacy Django tables to clean conventions:
    api_casestudy → case_studies
    api_casestudy_assurance_cases → case_study_published_cases
    api_casestudyfeatureimage → case_study_images
    api_publishedassurancecase → published_assurance_cases

  - Add comprehensive doc comments to Prisma schema models
  - Configure prisma-dbml-generator for schema documentation
  - Set manyToMany=false to prevent spurious CommentThread table

  Remove unused pessimistic locking feature:
  - Drop lock_uuid, locked_by_id, locked_at columns from assurance_cases
  - Remove /api/cases/[id]/lock API route
  - Remove lock service functions and SSE event types
  - Update types, actions, and test fixtures

  The locking feature was fully implemented but never called from the
  frontend. Real-time collaboration uses SSE events instead.
   The entrypoint script was failing because it tried to query api_eapuser
   to check if data migration was needed, but that table was dropped in
   migration 20260110000000_remove_legacy_django_tables.

   Now checks if api_eapuser exists first via information_schema before
   attempting the data migration check.
@chrisdburr chrisdburr merged commit 3126fb3 into main Jan 9, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants