Releases: bitalizer/db-migrator
v0.3.2 - Type-safe schema mapping
What's Changed since v0.2.5
Bug Fixes
- Fix binary value quoting — was
'0x...', now correctly0x...without quotes - Fix
BitandU8NULL handling — was outputting0for NULL, now correctlyNULL - Fix float/real values being string-quoted —
F32/F64now output as bare numbers - Fix
datetime2/time/datetimeoffsetlosing sub-second precision — now uses%.fformat - Fix
SmallDateTimecrash from multiplyingseconds_fragmentsby 60 (was already in minutes) - Fix SQL injection risk — all dynamic SQL identifiers now properly escaped (#18)
- Fix error swallowing — migration errors now propagate correctly instead of being silently ignored
- Fix
formatted_tablesbug in migrator - Fix
format_snake_caseto handle acronyms correctly (e.g.,HTTPSStatus→https_status) - Fix missing
.awaitcalls and preserve error context in inserter - Fix fail-fast behavior — migration now stops on first table error
- Fix safe fallback for
available_parallelism - Fix exit code — errors now propagate to process exit code
Type-safe Schema Mapping (#21)
- Replace all stringly-typed schema handling with type-safe enums (
MssqlTypewith 29 variants,MySqlBaseTypewith 18 variants) - Add
TypeRegistrywith built-in exhaustive defaults for all MSSQL types — zero config needed - Separate source (
ColumnSchema) from target (TargetColumn) with validatedMySqlType MySqlType.to_sql()renders correct MySQL type declarations with length, precision, scale, unsigned, zerofill- Validate length limits, MAX handling (-1), precision overflow, safe i32→u8 scale conversion
- Share
TypeRegistryacross concurrent tasks viaArc
Configuration Improvements
mappings.tomlis now optional — all defaults are built in- Simplified override format:
nvarchar = "varchar(500)"instead of verbose[[mappings]]blocks - Bare type overrides like
"varchar"auto-carry source length with safe defaults - Length/precision types without params get sensible fallbacks (varchar → 255, decimal → 10,2)
Error Handling & Safety (#17)
- Add structured
MigrationErrorenum replacing panics with properResultpropagation - Replace all
.unwrap()andpanic!()in extractor, inserter, format, and schema parsing - Replace
Constraint::from_strerror type()withMigrationError - Typed errors throughout the codebase with proper context via
anyhow
Architecture (#19)
- Make
DatabaseMigratorandTableMigratorgeneric overExtractor/Insertertraits - Enables mock-based testing without real database connections
Testing (#20)
- 179 unit tests (up from ~10)
- Mock-based orchestration tests for
DatabaseMigratorandTableMigrator - Tests cover: type mapping, schema conversion, SQL rendering, override parsing, query building, config parsing, batching, error propagation, snake_case formatting, constraint handling
CI/CD
- Update GitHub Actions to non-deprecated versions
- Update release workflow to support Rust 2024 edition
- Add format check (
cargo fmt --check) and clippy (-D warnings) to CI
Dependencies
- Update all dependencies to latest compatible versions
- Rust edition upgraded to 2024 (requires Rust 1.85+)
Contributors
Full Changelog: v0.2.5...v0.3.2
db-migrator 0.2.5
🚀 Release v0.2.5 - Database Integrity and Code Quality Enhancements 🛠️
In this release, we're introducing several critical improvements to enhance the overall reliability, maintainability, and performance of our database tool. Here's a breakdown of the key changes:
-
🐞 Fixed a bug by ensuring transactional table creation: We've resolved a critical issue related to table creation operations. Now, all table creation operations utilize transactional queries, effectively preventing foreign key-related problems and ensuring data integrity during database operations.
-
🧩 Improved foreign key reference creation: To reduce unnecessary dependencies and enhance database performance, we've optimized the creation of foreign key references. They are now generated only for whitelisted tables, streamlining the database structure.
-
🏢 Table existence check before resetting: We've introduced a table existence check. This simple yet crucial addition enhances the safety of database operations.
-
💼 Code formatting adjustments: We've maintained coding style consistency by making necessary formatting adjustments throughout the codebase. This ensures cleaner and more readable code
-
🧰 Enhanced error handling in the inserter: We've made significant enhancements to error handling within the inserter component. This improvement provides better feedback in case of data insertion failures, making debugging and troubleshooting more efficient.
These changes collectively represent our commitment to delivering a robust and dependable database tool. We encourage all users to upgrade to version 0.2.5 to benefit from these enhancements.
db-migrator 0.2.4
🚀 Release v0.2.4 - Streamlined Insights and Enhanced Debugging
We're thrilled to introduce version 0.2.4, a release that elevates your debugging experience by streamlining insights and providing enhanced context. In this version, we've made the following update:
🔧 Refined Error Message Display:
Improved the error message display within transactional query execution error handling. We've removed the previous 100-character truncation limit, allowing the complete query to be included in the error message. This alteration provides comprehensive context for debugging and issue resolution.
Stay tuned for more advancements in our ongoing commitment to refining your development proces
db-migrator v0.2.3
🚀 Release v0.2.3 - Enhanced Control and Improved CLI Options
We are excited to announce the release of version 0.2.3, packed with improvements to the database migration process and optimization for better performance and data consistency. This release introduces the following key enhancements:
🔧 Database Migration Enhancements:
- Statement logging for sqlx has been disabled to reduce log noise and improve logging readability (large queries caused thread crashes).
- Fixed bug causing more tasks to be created than available SQL connections has been fixed.
- Migration continuation from the last offset has been removed, ensuring a fresh and consistent migration of data.
📚 Code Refactor and Readability:
- The codebase has undergone significant refactoring, enhancing code readability and maintainability.
✔️ Data Integrity Check:
- Checks have been implemented to ensure that each output database table is empty before migration process, preventing broken data.
db-migrator v0.2.2
🚀 Release v0.2.2 - Enhanced Control and Improved CLI Options
What's New:
Constraints Creation Control 📏
Now you can exercise greater control over constraints creation with the new -c or --constraints command-line argument. Define custom constraints for your project effortlessly.
Parallelism Specification 🚀
We understand the importance of optimized performance. To address this, we've added the -p flag, allowing you to specify the desired parallelism level. By default, it will intelligently utilize your system's logical cores for improved execution speed.
Improved CLI Parameters 🛠️
As part of our commitment to a streamlined experience, we've made some changes to the CLI parameters:
The format_snake_case configuration option has been removed in favor of the new -f or --format command-line argument. Modify your output formatting on-the-fly.
The reset_tables configuration option has been eliminated and replaced with the -d or --drop command-line argument. Easily control table resets via the CLI.
db-migrator v0.2.1
🚀 Release v0.2.1 - Enhanced Database Migrations and Improved Error Output
What's New:
Table Constraints Export 📊
Managing table constraints is now a breeze! With this update, you can create and export table constraints directly from your input database, saving you time and effort. Enjoy a more efficient migration process with this enhanced functionality.
Resuming Migrations ⏩
No more starting from scratch! We've added a new feature that allows you to continue from the last migration offset.
Quiet Mode for Error Output 🔇
For those who prefer a more concise output, we've introduced the -q or --quiet flag. Enabling this option will output only errors, reducing unnecessary noise and providing a cleaner view of any potential issues.