b29a268b1d
- Move completed plan files to .plans/done/ - Move 18 open plan files to .plans/open/ - Update .gitignore to exclude .verified_plans temp file - Verified all 18 open plans still describe unimplemented issues
2.4 KiB
2.4 KiB
Plan: Issue #19 - DB migrations for addresses, phones, emails
Summary
Create a new Nextcloud migration class (Version000002Date20260407000001) that creates three tables:
oc_mv_addresses, oc_mv_phones, and oc_mv_emails. Each table has a foreign key reference
to oc_mv_members(id) with CASCADE delete. Follow the exact same pattern as the existing
Version000001Date20260407000000.php migration.
Steps
- Create
lib/Migration/Version000002Date20260407000001.php - Implement
changeSchema()method that creates three tables:mv_addresses: id, member_id (FK), label, strasse, plz, ort, land, is_primarymv_phones: id, member_id (FK), label, number_e164mv_emails: id, member_id (FK), label, email
- Add appropriate indexes on member_id for each table
- Each table guards with
hasTable()check before creating
Schema Details
mv_addresses
| Column | Type | Constraints |
|---|---|---|
| id | BIGINT | PK, autoincrement, unsigned |
| member_id | BIGINT | NOT NULL, unsigned, FK -> mv_members(id) CASCADE |
| label | STRING(100) | nullable (e.g. "Hauptadresse", "Zweitadresse") |
| strasse | STRING(255) | NOT NULL |
| plz | STRING(10) | NOT NULL |
| ort | STRING(255) | NOT NULL |
| land | STRING(100) | default 'Deutschland' |
| is_primary | BOOLEAN | NOT NULL, default false |
mv_phones
| Column | Type | Constraints |
|---|---|---|
| id | BIGINT | PK, autoincrement, unsigned |
| member_id | BIGINT | NOT NULL, unsigned, FK -> mv_members(id) CASCADE |
| label | STRING(100) | nullable (e.g. "Mobil", "Festnetz") |
| number_e164 | STRING(20) | NOT NULL |
mv_emails
| Column | Type | Constraints |
|---|---|---|
| id | BIGINT | PK, autoincrement, unsigned |
| member_id | BIGINT | NOT NULL, unsigned, FK -> mv_members(id) CASCADE |
| label | STRING(100) | nullable (e.g. "Privat", "Arbeit") |
| STRING(255) | NOT NULL |
AC Verification Checklist
- Migration file exists at
lib/Migration/Version000002Date20260407000001.php - All three tables (mv_addresses, mv_phones, mv_emails) are created
- All columns match the schema in the issue
- Foreign keys reference mv_members(id) with CASCADE delete
- Tables have proper indexes on member_id
- Migration class follows Nextcloud SimpleMigrationStep pattern
- Each table creation is guarded with hasTable() check
- PHP syntax is valid