Confirmed users
595
edits
| Line 181: | Line 181: | ||
When we change schema we have to ensure tables are compatible with previous version, this is blocking us from doing big/important changes to how we store our dataset. | When we change schema we have to ensure tables are compatible with previous version, this is blocking us from doing big/important changes to how we store our dataset. | ||
We should create a new downgrade path able to manage any kind of schema change and backport it to any supported version (3.6, 3.5, 3.0, ...) | We should create a new downgrade path able to manage any kind of schema change and backport it to any supported version (3.6, 3.5, 3.0, ...) | ||
Initial idea was to backup history, guaranteing some column to persist. | |||
Better and newer idea is to use a migration component similar to the migration components in Rails and Django. The component will be ported to all supported versions and will stay frozen on schema changes. | |||
Instead the changes will be described in diff structures, that we can store in a schema_diffs table. the diff would be a JSON string with properties to describe the change, or pre-built SQL queries. | |||
On init the service will read the schema version, if it differs it will pass the connection to the migration component. This should in some case export data, rebuild schema, and reimport data. other additive cases could be simpler. | |||
This | Since all schema steps are self contained in the database, the migrator can walk through them regardless application version. | ||
NOTE: This should be a Storage Component, so that anyone can use it to migrate his SQLite database. | |||
*'''PROS:''' no downgrade restrictions for schema | *'''PROS:''' no downgrade restrictions for schema | ||
*'''CONS:''' have to | *'''CONS:''' have to design and implement the migration component in an abstract enough fashion to handle many cases. | ||
*'''EST:''' | *'''EST:''' | ||
*'''BUG:''' | *'''BUG:''' | ||
*'''DEPENDS:''' | *'''DEPENDS:''' | ||