-
Notifications
You must be signed in to change notification settings - Fork 52
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
fix: add unique constraint #250
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just adopt the tests that we cover both variants
test/corpus/create.txt
Outdated
@@ -30,7 +30,7 @@ Create table multiple columns | |||
|
|||
CREATE TABLE my_table ( | |||
id BIGINT NOT NULL PRIMARY KEY, | |||
date DATE DEFAULT NULL ASC | |||
date DATE DEFAULT NULL UNIQUE ASC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you keep the old line and add a new line like
date DATE DEFAULT NULL ASC,
date2 DATE DEFAULT NULL UNIQUE ASC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tree-sitter changed some thing with regards on query matching order in one of the last releases. Thats why tests are failing for you. We are aware of that and planning to update tree-sitter. The requirement for tree-sitter-cli is pinned in package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you keep the old line and add a new line like
Done!
The requirement for tree-sitter-cli is pinned in package.json
Ohh ok, so there is actually no need to run make test
and instead we should run npm test
?
Strange that both differ:
- make test:
✓ union.sql (13 assertions)
✗ query.sql
Failure - row: 0, column: 7, expected highlight 'function.call', actual highlights: 'type'
make: *** [Makefile:26: test] Error 1
- npm test:
✓ union.sql (13 assertions)
✓ query.sql (14 assertions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can still use make test
but you need tree-sitter-cli 0.20.*
The "fix" for this issue is to change the order of tree-sitter queries highlights.scm. But that is not related to your MR.
This is an attempt to solve #249 .
I updated a test to include the UNIQUE keyword. However, I'm having trouble running the tests (even before making these changes) to verify if everything is correct:
EDIT: found how to run the tests. There is one that is failing (but already was failing before I believe).
Maybe the tree-sitter-cli requirement should be mentioned in CONTRIBUTING.md?
Please let me know if there is something else that I should do/change!