frc5183 / Oatmeal

MIT License
2 stars 0 forks source link

ORM Database Upgrade #18

Closed Trip-kun closed 9 months ago

Trip-kun commented 9 months ago

When the Object Relational Mapper gets updated to include new data within existing tables, it cannot handle that upgrade. We need to create a system to upgrade existing tables to include/(re)move changes in data. A proposal I wrote up for this: (ORM_UPGRADES.md)

Occasionally the Object Relational Mapper system will need updates to include new data or to restructure old data.

To achieve these upgrades, Oatmeal keeps an internal copy of a database "Version".
This version is different than the version used for different versions of Oatmeal. 
This version is a simply incrementing integer, and will increase only when the ORM changes.

This allows for upgrade scripts to be written efficiently.
An ORM version number is finalized when it is pushed to master.
In the rare case where this conflicts with ongoing PRs, those PRs should increment their version number accordingly.
Baconing commented 9 months ago

Personally, I think that we should have a migrations table which keeps track of all migrations that have been done on the database.

From there, we can manually write classes that will run and verify if a migration has been completed.

With that we can look at individual migrations quicker then comparing version numbers.