-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Need for Optimization
As we move forward, the following json schema related requests might arise:
- Add new properties (optional or required)
- Remove old properties (optional or required)
- Update features of existing properties
- Turn property from optional to required
- Turn property from required to optional
- Add/Update constraints on single or multiple properties
- Update type
- Update enum values
- Edit property name
- Mix of above
Describe Desired Optimization
Define and implement a database migration process which makes sure all the existing documents (in db) are consistent with respect to the new schema.
For the existent documents that do not match the updated schema, figure out what's the best way to migrate them. Note that the migration process and the document update decision is likely dependent on the type of schema update.
Describe Alternatives
There are no alternative solutions, we need to have this process in place to take care of future feature requests, bug fixes, and optimizations.
Additional Context
Some notes from NCI R01 Technology Implementation Meeting on April 18 2022:
- Write a new json schema (
BIG OR) to validate if document (json) matches just oneOf all the existing schemas - Introduce the above schema check in collection utils
- Write a migration script which exports the database, validates all the documents against schemas (old and the new updated one(s)), fixes the document(s) that result in schema failure, validates all the documents again, insert all the documents into the database if there are no schema failures