docs.rs failed to build switchy_schema_test_utils-0.2.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Switchy Schema Test Utils
Test utilities for switchy_schema that provide comprehensive migration testing capabilities.
Overview
This package provides testing utilities for validating database migrations:
verify_migrations_full_cycle- Basic up/down migration testingverify_migrations_with_state- Migration testing with pre-seeded stateverify_migrations_with_mutations- Testing with data mutations between migration stepsMigrationTestBuilder- Builder pattern for complex migration scenarios with breakpoints (requiressqlitefeature)MigrationSnapshotTest- Schema snapshot comparison testing (requiressnapshotsfeature)assertionsmodule - Database schema and state assertion helpers (requiressqlitefeature)create_empty_in_memory- Create an in-memory SQLite database for testing (requiressqlitefeature)
Features
- Database Support: SQLite support via feature flags (additional databases planned)
- Comprehensive Testing: Full migration lifecycle validation
- State Preservation: Verify data integrity during migrations
- Mutation Testing: Test against various database states and scenarios
- Async Support: Full async/await support for modern Rust applications
- Snapshot Testing: Schema snapshot comparison (optional
snapshotsfeature)
Usage
Add to your Cargo.toml:
[]
= { = true, = ["sqlite"] }
Creating a Test Database
Use create_empty_in_memory to create an in-memory SQLite database for testing (requires sqlite feature):
use create_empty_in_memory;
async
Basic Migration Testing
use verify_migrations_full_cycle;
async
State Preservation Testing
use verify_migrations_with_state;
async
Mutation Testing
use verify_migrations_with_mutations;
use MutationBuilder;
async
Advanced: Migration Test Builder (requires sqlite feature)
use MigrationTestBuilder;
async
Schema and State Assertions (requires sqlite feature)
use *;
async
Snapshot Testing (requires snapshots feature)
use MigrationSnapshotTest;
async
Cargo Features
sqlite- Enable SQLite support (included in default features)snapshots- Enable schema snapshot testing capabilitiesdecimal- Enable decimal type support (included in default features)uuid- Enable UUID type support (included in default features)fail-on-warnings- Treat warnings as errors during compilation
Examples
See the examples/ directory in the parent switchy_schema package for complete working examples of each testing utility.