tensorzero
tensorzero copied to clipboard
Test migration rollback instructions
I've added two different tests:
- Run 'apply; rollback; apply' for each migration in sequence, and check that everything succeeds
- Run a "painter's algorithm"-type test, where we apply all migrations up to N (inclusive), and check that we can rollback N
In order to run the rollback instructions programatically, I modified them to use '/* */'-style comments on the same line as the actual commands, since ClickHouse rejects sending a comment as a standalone query.
The only non-trivial change to rollback instructions is in Migation0008
- we cannot rollback the change to 'BatchRequest.errors', since we cannot convert an Array back to a Map. There should be no data in this table when this particular migration runs, so this is fine
[!IMPORTANT] Add tests for migration rollback instructions and modify rollback comments for compatibility in ClickHouse migration manager.
- Tests:
- Add tests for migration rollback instructions in
clickhouse.rs.- Test
apply; rollback; applysequence for each migration.- Test rollback for all migrations up to N and ensure rollback of N.
- Rollback Instructions:
- Modify rollback instructions to use inline
/* */comments inmigration_trait.rsand various migration files.- Cannot rollback
BatchRequest.errorsinMigration0008due to data type limitations.- Misc:
- Add
NUM_MIGRATIONSconstant inmod.rsto ensure test consistency.- Update
make_all_migrationsto assert migration count matchesNUM_MIGRATIONS.This description was created by
for f850850337859d102262d6b5911a9e8c978d06c4. You can customize this summary. It will automatically update as commits are pushed.