Conversation
|
| Branch | custom-migrations |
| Testbed | github-ubuntu-latest |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result microseconds (µs) (Result Δ%) | Upper Boundary microseconds (µs) (Limit %) |
|---|---|---|---|
| empty_router/empty_router | 📈 view plot 🚷 view threshold | 5,923.50 µs(-0.94%)Baseline: 5,979.72 µs | 7,004.32 µs (84.57%) |
| json_api/json_api | 📈 view plot 🚷 view threshold | 1,040.50 µs(+1.90%)Baseline: 1,021.15 µs | 1,152.04 µs (90.32%) |
| nested_routers/nested_routers | 📈 view plot 🚷 view threshold | 958.76 µs(+1.90%)Baseline: 940.90 µs | 1,054.35 µs (90.93%) |
| single_root_route/single_root_route | 📈 view plot 🚷 view threshold | 922.85 µs(+2.27%)Baseline: 902.34 µs | 1,012.51 µs (91.14%) |
| single_root_route_burst/single_root_route_burst | 📈 view plot 🚷 view threshold | 17,520.00 µs(-0.55%)Baseline: 17,617.34 µs | 20,861.92 µs (83.98%) |
This adds support for user-defined migrations that might contain arbitrary code in them. This is primarily useful for data migrations which do not modify the schema, but fill in the data in the database instead. This extends the migration engine to support a new type of migrations, as well as cot-cli with a new command that creates a new custom migration.
ca9e1b8 to
2104d84
Compare
11d8817 to
4475202
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for custom migrations to the Cot ORM, allowing developers to define data migrations with arbitrary code that don't modify the database schema.
Changes:
- Added
MigrationContext,CustomOperationFn, andCustomBuilderto the migration engine for defining custom migration operations - Implemented
migration_opattribute macro to transform async functions into migration operations - Added
cot migration newCLI command to create custom migrations with a user-defined name
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| cot/src/db/migrations.rs | Core implementation of custom migrations including the context type, operation builder, and execution logic |
| cot-macros/src/migration_op.rs | Macro implementation that transforms async functions to return pinned boxed futures |
| cot-macros/src/lib.rs | Export of the new migration_op macro |
| cot-macros/tests/ui/attr_migration_op.rs | UI test for correct usage of the macro |
| cot-macros/tests/ui/attr_migration_op_not_async.stderr | Expected error output for non-async functions |
| cot-macros/tests/ui/attr_migration_op_not_async.rs | UI test for error case |
| cot-macros/tests/compile_tests.rs | Test registration for macro compile tests |
| cot-cli/src/migration_generator.rs | Generator for custom migration files and refactored naming logic |
| cot-cli/src/main.rs | CLI command routing for the new migration command |
| cot-cli/src/handlers.rs | Handler implementation for creating custom migrations |
| cot-cli/src/args.rs | CLI argument definitions for the new command |
| cot-cli/tests/migration_generator.rs | Tests for custom migration generation and compilation |
| cot-cli/tests/snapshot_testing/help/snapshots/*.snap | Updated help text snapshots showing the new command |
| cot-cli/tests/snapshot_testing/cli/snapshots/*.snap | Updated shell completion snapshots for the new command |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files with indirect coverage changes 🚀 New features to boost your workflow:
|
seqre
reviewed
Jan 28, 2026
seqre
approved these changes
Jan 29, 2026
Member
seqre
left a comment
There was a problem hiding this comment.
Overall it LGTM, please write more tests before merging
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds support for user-defined migrations that might contain arbitrary code in them. This is primarily useful for data migrations which do not modify the schema, but fill in the data in the database instead.
This extends the migration engine to support a new type of migrations, as well as cot-cli with a new command that creates a new custom migration.
Fixes #211.