-
Notifications
You must be signed in to change notification settings - Fork 217
feat: add support for alter table with check in mssql ast generator #806
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
huydo862003
merged 4 commits into
master
from
fix/alter-table-with-check-add-constraint-in-mssql
Jan 29, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
bd9800e
feat: add support for alter table with check in mssql ast generator
huydo862003 8ef4597
fix: more precise checking for WITH CHECK/NOCHECK
huydo862003 4ecbf3a
fix: WITH NOCHECK/CHECK FK name should be undefined if not defined
huydo862003 4c4940b
fix: return in visit CHECK/NOCHECK
huydo862003 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
...es/dbml-core/__tests__/examples/parser/mssql-parse/input/with_check_add_constraint.in.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| CREATE TABLE [users] ( | ||
| [id] int PRIMARY KEY, | ||
| [name] varchar(255) | ||
| ) | ||
| GO | ||
|
|
||
| CREATE TABLE [orders] ( | ||
| [id] int PRIMARY KEY, | ||
| [user_id] int | ||
| ) | ||
| GO | ||
|
|
||
| CREATE TABLE [audit_logs] ( | ||
| [id] int PRIMARY KEY, | ||
| [order_id] int | ||
| ) | ||
| GO | ||
|
|
||
| ALTER TABLE [orders] WITH CHECK ADD CONSTRAINT [FK_orders_users] FOREIGN KEY ([user_id]) REFERENCES [users] ([id]) ON DELETE CASCADE ON UPDATE SET NULL | ||
| GO | ||
|
|
||
| ALTER TABLE [audit_logs] WITH NOCHECK ADD CONSTRAINT [FK_audit_logs_orders] FOREIGN KEY ([order_id]) REFERENCES [orders] ([id]) | ||
| GO |
100 changes: 100 additions & 0 deletions
100
...dbml-core/__tests__/examples/parser/mssql-parse/output/with_check_add_constraint.out.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| { | ||
| "tables": [ | ||
| { | ||
| "name": "users", | ||
| "fields": [ | ||
| { | ||
| "name": "id", | ||
| "type": { | ||
| "type_name": "int" | ||
| }, | ||
| "pk": true | ||
| }, | ||
| { | ||
| "name": "name", | ||
| "type": { | ||
| "type_name": "varchar(255)" | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "orders", | ||
| "fields": [ | ||
| { | ||
| "name": "id", | ||
| "type": { | ||
| "type_name": "int" | ||
| }, | ||
| "pk": true | ||
| }, | ||
| { | ||
| "name": "user_id", | ||
| "type": { | ||
| "type_name": "int" | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "audit_logs", | ||
| "fields": [ | ||
| { | ||
| "name": "id", | ||
| "type": { | ||
| "type_name": "int" | ||
| }, | ||
| "pk": true | ||
| }, | ||
| { | ||
| "name": "order_id", | ||
| "type": { | ||
| "type_name": "int" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "refs": [ | ||
| { | ||
| "name": "FK_orders_users", | ||
| "endpoints": [ | ||
| { | ||
| "tableName": "orders", | ||
| "fieldNames": [ | ||
| "user_id" | ||
| ], | ||
| "relation": "*" | ||
| }, | ||
| { | ||
| "tableName": "users", | ||
| "fieldNames": [ | ||
| "id" | ||
| ], | ||
| "relation": "1" | ||
| } | ||
| ], | ||
| "onDelete": "CASCADE", | ||
| "onUpdate": "SET NULL" | ||
| }, | ||
| { | ||
| "name": "FK_audit_logs_orders", | ||
| "endpoints": [ | ||
| { | ||
| "tableName": "audit_logs", | ||
| "fieldNames": [ | ||
| "order_id" | ||
| ], | ||
| "relation": "*" | ||
| }, | ||
| { | ||
| "tableName": "orders", | ||
| "fieldNames": [ | ||
| "id" | ||
| ], | ||
| "relation": "1" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
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 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.
Uh oh!
There was an error while loading. Please reload this page.