✨ feat: enhance schema to adopt `constraints` data
Issue
- resolve: Improve schame expression to adopt
constraintsdata, such as primary key, unique, foreign key and check constraitns.
Why is this change needed?
The current db-structure schema drops the constraints data of tbls schema. Especially, check constraints of the schema can't be expressed with the current schema.
This PR will enhance the schema to adopt constraints data and prepare for implementing the UI using it.
What would you like reviewers to focus on?
- implementation of the constraints schema
- implementation of the
tblsformat parser with constraints
Testing Verification
- add tests for the schema and parser
What was done
🤖 Generated by PR Agent at 8acfdbe30f4d1398773e4ba980733435a5fba548
- Introduced support for database constraints in schema definitions.
- Added support for
PRIMARY KEY,FOREIGN KEY,UNIQUE, andCHECKconstraints. - Enhanced schema parsing to include constraints for various database parsers.
- Added support for
- Updated test cases to validate new constraint functionalities.
- Added tests for
PRIMARY KEY,FOREIGN KEY,UNIQUE, andCHECKconstraints. - Verified error handling for duplicate constraints in overrides.
- Added tests for
- Enhanced override functionality to support adding constraints to existing tables.
- Updated schema definitions to include constraints and their types.
Detailed Changes
| Relevant files | |||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Enhancement | 8 files
| ||||||||||||||||
| Tests | |||||||||||||||||
| Documentation | 1 files
|
Additional Notes
Need help?
Type /help how to ...in the comments thread for any questions about Qodo Merge usage.Check out the documentation for more information.
🦋 Changeset detected
Latest commit: 76f945446fd2e6e3c3cf58c57fecbdec8e4e34bf
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 2 packages
| Name | Type |
|---|---|
| @liam-hq/db-structure | Patch |
| @liam-hq/cli | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
@tnyo43 is attempting to deploy a commit to the ROUTE06 Core Team on Vercel.
A member of the Team first needs to authorize it.
PR Reviewer Guide 🔍
Here are some key observations to aid the review process:
| ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪ |
| 🧪 PR contains tests |
| 🔒 No security concerns identified |
⚡ Recommended focus areas for reviewConstraint Validation
|
PR Code Suggestions ✨
Explore these optional code suggestions:
| Category | Suggestion | Impact |
| Possible issue |
Fix UNIQUE constraint validationThe current condition only allows UNIQUE constraints with exactly one column, frontend/packages/db-structure/src/parser/tbls/parser.ts [162-165]
Suggestion importance[1-10]: 8__ Why: The current code only allows UNIQUE constraints with exactly one column (using === 1), but the comment indicates it should handle constraints with one or more columns. This mismatch could prevent multi-column UNIQUE constraints from being properly processed. | Medium |
| ||