feat: add DB migration for members table (Closes #18) #67

Merged
shahondin1624 merged 1 commits from feature/issue-18-set-up-db-migrations-for-members-table into main 2026-04-07 11:29:54 +02:00
Owner

Summary

  • Creates oc_mv_members table migration (Version000001Date20260407000000) with all 22 columns from requirements section 5.2
  • Includes all data types as specified: personal data (vorname, nachname, geburtsdatum, geschlecht), organisational fields (rolle, stufe_id, eintritt, austritt, status), sensitive fields (allergien_encrypted), health insurance (kv_typ, kv_name), family relation (family_id), fee snapshot (frozen_fee_rate), Nextcloud integration URIs, and timestamp columns with soft-delete support
  • Adds 6 indexes for common query patterns: status, family_id, stufe_id, nachname, deleted_at, and composite (status, deleted_at)
  • FK constraints for stufe_id and family_id are deferred to Issues #30 and #27 respectively

Design Decisions

  • ENUM columns stored as STRING: Doctrine DBAL does not have a portable ENUM type; using VARCHAR with application-level validation (standard Nextcloud practice)
  • Idempotent migration: hasTable() check prevents errors on re-run
  • Deferred FK constraints: Referenced tables (stufen, families) don't exist yet; FK columns are created as nullable unsigned BIGINT now, constraints will be added by later migrations
  • frozen_fee_rate as DECIMAL(10,2): Stores the exact fee amount at time of status change, avoiding floating-point precision issues

Test Plan

  • Migration runs successfully on a Nextcloud 28+ instance with MySQL/MariaDB
  • Table oc_mv_members is created with all 22 columns
  • Column types, nullability, and defaults match specification
  • All 6 indexes are created
  • Migration is idempotent (running twice does not error)

Closes #18

## Summary - Creates `oc_mv_members` table migration (`Version000001Date20260407000000`) with all 22 columns from requirements section 5.2 - Includes all data types as specified: personal data (vorname, nachname, geburtsdatum, geschlecht), organisational fields (rolle, stufe_id, eintritt, austritt, status), sensitive fields (allergien_encrypted), health insurance (kv_typ, kv_name), family relation (family_id), fee snapshot (frozen_fee_rate), Nextcloud integration URIs, and timestamp columns with soft-delete support - Adds 6 indexes for common query patterns: status, family_id, stufe_id, nachname, deleted_at, and composite (status, deleted_at) - FK constraints for stufe_id and family_id are deferred to Issues #30 and #27 respectively ## Design Decisions - **ENUM columns stored as STRING**: Doctrine DBAL does not have a portable ENUM type; using VARCHAR with application-level validation (standard Nextcloud practice) - **Idempotent migration**: `hasTable()` check prevents errors on re-run - **Deferred FK constraints**: Referenced tables (stufen, families) don't exist yet; FK columns are created as nullable unsigned BIGINT now, constraints will be added by later migrations - **frozen_fee_rate as DECIMAL(10,2)**: Stores the exact fee amount at time of status change, avoiding floating-point precision issues ## Test Plan - [ ] Migration runs successfully on a Nextcloud 28+ instance with MySQL/MariaDB - [ ] Table `oc_mv_members` is created with all 22 columns - [ ] Column types, nullability, and defaults match specification - [ ] All 6 indexes are created - [ ] Migration is idempotent (running twice does not error) Closes #18
shahondin1624 added 1 commit 2026-04-07 11:29:50 +02:00
Create oc_mv_members table with all columns from requirements section 5.2:
personal data fields, organisational fields (rolle, stufe, status),
health insurance (kv_typ, kv_name), family relation, frozen fee rate,
Nextcloud integration URIs, and timestamp columns with soft-delete support.

Includes indexes on status, family_id, stufe_id, nachname, deleted_at,
and a composite index on (status, deleted_at) for common query patterns.

FK constraints for stufe_id and family_id are deferred to Issues #30 and #27.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
shahondin1624 merged commit 71f23372b7 into main 2026-04-07 11:29:54 +02:00
shahondin1624 deleted branch feature/issue-18-set-up-db-migrations-for-members-table 2026-04-07 11:29:54 +02:00
Sign in to join this conversation.