Epic: Database-per-Club Multi-Tenancy Split & Data Migration #105
Labels
No labels
architecture
backend
bug
ci
config
database
docker
documentation
duplicate
enhancement
frontend
help wanted
invalid
issue-25
issue-26
issue-42
issue-65
issue-67
issue-82
migrations
p0-critical
p1-high
p2-medium
p3-low
performance
quality
question
security
state-management
testing
timezone
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
fastie81/honbu-manager#105
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Epic: Database-per-Club Multi-Tenancy Split & Data Migration
Type: Refactoring / Architecture
Priority: High
Status: Planning / Ready for Implementation
1. Goal & Objectives
To improve tenant data isolation, compliance (GDPR/privacy), database performance, and security, we are migrating the Honbu Manager application from a shared-database multi-tenancy model to a database-per-club multi-tenant model.
honbu_central): Contains system-level configuration, users, OAuth configurations, and club-to-database routing metadata.honbu_club_<id>): Contains club-scoped data (members, attendance, notes, gradings, schedules, etc.), completely isolated physically from other clubs.content_itemsandcontent_club_approvals) reside locally in each club database.2. Dynamic Routing Architecture
We will implement dynamic connection routing in Flask & SQLAlchemy using Python's
contextvarsto set the active database on a per-request basis.3. Implementation Phases & Issues
We have structured the implementation into 6 distinct, sequential, and testable phases to ensure maximum stability and zero-downtime path:
Build thread-safe routing context (
contextvars) and dynamic SQLAlchemy engine switching.Organize migrations into central tables vs club-specific tables.
Refactor cross-DB JOINs (e.g.
get_users_by_club), adapt dashboard aggregation, adjust club deletion, and add logical FK constraints.Implement backup and recovery for multiple SQL databases.
Create production migration scripts and E2E security verification tests.
Validation on staging, production data migration checklist, and rollback protocols.
4. Security & Tenant Isolation Controls