-
-
Notifications
You must be signed in to change notification settings - Fork 40
Declarative database schema together with migrator unification #131
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
Draft
oskardudycz
wants to merge
48
commits into
main
Choose a base branch
from
migrator_and_schema_unification
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
…omponents They're yet dummy, but more will come then
We'll need to find a marter way for migration, probably hash calculated automatically as it's handled eventually or some id.
… factory We'll use composition instead
…use their names isntead of urns Thanks to that we'll be able to easier define the schema in the pongo like way. Made also migrations unique by adding schema component key to them.
…ns and schema components
…ccidental overrides
…ke column type etc.
8637d15 to
076a035
Compare
fb2bace to
50ff2a3
Compare
- Add RelationshipName parameter to ValidateRelationship type - Wrap validation errors with relationship context including relationship name and errors array - Update CollectRelationshipErrors to pass relationship key as name - Update validateRelationship.type.spec.ts with relationship field expectations - Update collectRelationshipErrors.type.spec.ts to match new nested error structure
Wrap relationship validation errors with table context to provide better error tracing: - Modified ValidateTableRelationships to wrap errors with table name - Created validateTableRelationships.type.spec.ts with comprehensive tests - Error structure now includes table name and nested relationship errors - Tests verify error detection for various failure scenarios 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…type merging Fixed table-level validation bug where multiple relationship errors were being merged into union types instead of staying as separate array items. Changes: - Removed redundant ValidateRelationshipLength check in ValidateTableRelationships (lines 426-432) - The check was already performed inside ValidateRelationship, making this duplicate check unnecessary - The redundant check was causing Relationships[keyof Relationships] to create unions, which merged error properties - Added type_mismatch table to test schemas to properly test type validation - Added comprehensive test for type mismatch errors at relationship level - Updated all test expectations to use readonly modifiers for columns/references arrays - Cleaned up debug code from test files The fix ensures each relationship's errors are validated independently and maintain proper structure as separate array items, not unions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Added hierarchical error context at schema level, wrapping table and relationship errors with schema name.
Changes:
- Modified ValidateSchemaTables to use MapRecordCollectErrors instead of ExtractTypeValidationErrors
- Updated ValidateSchemaTables to accept SchemaName parameter and wrap errors with schema context
- Modified ValidateDatabaseSchema to extract SchemaName from DatabaseSchemaSchemaComponent and pass to ValidateSchemaTables
- Added comprehensive tests in validateSchemaTables.type.spec.ts covering:
* Success case when all tables are valid
* Single invalid table with proper schema wrapping
* Multiple invalid tables with nested context (schema → table → relationship)
* Empty schema success case
The schema-level wrapping follows the same pattern as table-level:
- Errors maintain structure: TypeValidationResult<false, { schema, errors: [...] }>
- Each table's errors appear as separate array items with full context chain
- Success cases return TypeValidationSuccess instead of empty arrays
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
50ff2a3 to
77e30dd
Compare
Completed hierarchical error context by implementing database-level error collection that aggregates schema errors as an array.
Changes:
- Modified ValidateDatabaseSchemas to use MapRecordCollectErrors instead of ExtractTypeValidationErrors
- Database-level validation now collects errors from all schemas as an array
- Removed unused ExtractTypeValidationErrors import
- Added comprehensive tests in validateDatabaseSchemas.type.spec.ts covering:
* Success case when all schemas are valid
* Single invalid schema with full context chain (schema → table → relationship)
* Multiple invalid schemas with errors collected as separate array items
* Empty database success case
The complete error hierarchy is now:
- Database level: Array of schema errors
- Schema level: { schema, errors: [...table errors] }
- Table level: { table, errors: [...relationship errors] }
- Relationship level: { relationship, errors: [...validation errors] }
All validation errors maintain proper TypeValidationResult structure throughout the chain, enabling precise error reporting with full context at every level.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
77e30dd to
2a3738f
Compare
649f945 to
ec7db8e
Compare
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.
No description provided.