mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
d7d87e237a
Add additional logic to allow the local database to be migrated to newer versions.
1.0 KiB
1.0 KiB
How to add a migration to the local storage provider
- Look at the current schema
- Create a file named
vXXXX.sql, the files need to be in order, e.g.v1 v2 ... v9 v10etc. The migration machinery will check that there are no holes - Add the needed migrations, these will probably be comprised of:
- Some
DELETE FROMstatements to clear some tables - One or more
ALTER TABLEstatements
- Some
General logic for the migrations
- Start with the
ALTER TABLEstatements you want to make - Do they introduce nullable columns? If so no additional operations are needed
- If they need non-nullable columns can the data be derived from the existing
data in the database? Note that the pipebox is not available for migrations
so these transformations need to be SQL-only.
If not then it's ok to drop data from the following tables:
objectsdependenciescustom_dependencies
- Usually you want to drop all three tables, they are inter-dependent so the data from one missing usually leads to corrupted data on the other