-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat(migrations): add compile-time migration generation #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
- Add ColumnConfig for column-level constraints (#[column(...)]) - unique, index, default, check, varchar, sql_type, nullable, name - Add CompositeIndexDef for entity-level indexes - #[entity(index(col1, col2), unique_index(...))] - Add ReferentialAction for ON DELETE/UPDATE actions - Extend StorageConfig with on_delete for #[belongs_to] - Add migrations flag to EntityAttrs and EntityDef - Add parse_index_attrs helper for composite indexes - Add PostgresTypeMapper for Rust -> PostgreSQL type mapping - Create migrations module structure (types/, postgres/)
- Add ColumnConfig parsing for column constraints (unique, index, default, check, varchar, sql_type, nullable) - Add IndexType enum (BTree, Hash, Gin, Gist, Brin) for index types - Add ReferentialAction enum for ON DELETE actions - Add CompositeIndexDef for entity-level composite indexes - Add PostgresTypeMapper for Rust to PostgreSQL type mapping - Generate MIGRATION_UP and MIGRATION_DOWN constants - Support full DDL: CREATE TABLE, CREATE INDEX, DROP TABLE CASCADE - Add column attribute to derive macro
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
- Add unit tests for sql/postgres/helpers.rs (100% coverage) - Add tests for migrations/mod.rs (100% coverage) - Add tests for migrations/postgres/ddl.rs (100% coverage) - Add tests for parse/field/column.rs IndexType::from_str - Add tests for parse/entity/index.rs builder methods - Export IndexType from parse module for test usage
- Remove unused parse_index_meta function from index.rs (duplicate of parse_index_content in helpers.rs) - Fix parse_index_attrs to properly consume all nested meta items (was failing to parse indexes when other attrs like table = "..." came first) - Fix parse_index_content to distinguish between `name` column and `name = "..."` option by checking for `=` sign - Add 19 comprehensive tests for parse_index_attrs covering all index options - Coverage: helpers.rs 47.75% -> 96.01%, index.rs 77.45% -> 100%
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.
Summary
Usage