tensorzero icon indicating copy to clipboard operation
tensorzero copied to clipboard

Test migration rollback instructions

Open Aaron1011 opened this issue 10 months ago • 0 comments

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; apply sequence 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 in migration_trait.rs and various migration files.
    • Cannot rollback BatchRequest.errors in Migration0008 due to data type limitations.
  • Misc:
    • Add NUM_MIGRATIONS constant in mod.rs to ensure test consistency.
    • Update make_all_migrations to assert migration count matches NUM_MIGRATIONS.

This description was created by Ellipsis for f850850337859d102262d6b5911a9e8c978d06c4. You can customize this summary. It will automatically update as commits are pushed.

Aaron1011 avatar May 29 '25 16:05 Aaron1011