Product perspective / Context
We consider the Donor data stored in the data field of the spenden table (as an base64-encoded serialized PHP array) legacy, with drawbacks outlined in ADR 27 - Donor Database Structure. We want to be able to change and migrate the data structure more easily. To achieve that, we will extract the donor data into normalized tables.
Acceptance criteria
- Donor data is stored in normalized database tables
- Fundraising Application and FOC continue to work and inter-operate during the transition
Technical perspective
Context
We distinguish between Domain Objects and Doctrine Entities. Both are called Donation. We have a "Translation layer" that converts one into the other. In the course of this ticket, we will store the different subclasses of the Donor Domain object as relations of the Donation Doctrine entity.
General implementation approach:
- For writing donations, we will add Doctrine Table ineritance to our Donation Doctrine entity definition.
- As long as the FOC uses the legacy data, we need to store both the legacy data and the new entities.
- When creating , the reading code must read from the entities.
Entity Relationship Diagram
Affected Repositories
- Donation bounded context: Entity changes, 2 major releases (adding new feature, removing legacy feature)
- Fundraising Application: should use new releases, might need changes for dependencies in FunFunFactory, no other changes should be necessary
- Fundraising Operation Center: Major refactoring in queries
Deployment notes
- Database structure migrations (adding new tables and new donor_id column in spenden)
- A Data migration script that creates scrubbed donor entries for all donations is necessary for changing historical data that we use in the FOC. We can still deploy the changed Fundraising Application without this script, as new donations will automatically use the new tables.
- Backup script changes in infrastructure repository
Order of changes / sub-tickets
- Change donation bounded context :
- Introduce entities (T390618: Write Donor entities when saving donation)
- create entities with IDs
- change storage layer
- change "Add Donation" use case
- change "Update Donor" use case - switch donors, generate new IDs for new entities
- Add entity switch to "scrubbing" code
- add structure migration
- Introduce entities (T390618: Write Donor entities when saving donation)
- Integrate address changes in Fundraising Application (T369160: Change Fundraising Application to support individual street name and house number fields)
- add data migration script
- FOC changes (can be done in parallel)
- Change export code
- Change analysis code
- Change AnonymousDonationsReportUseCase
- Change Data collection in FOC overview / detail controllers (complete rewrite)
- Drop (doctrine) translation layer
- Drop columns and data from donation table (with structure and data migration script)
