Skip to content

Commit

Permalink
fix: add unique constraint (closes #249)
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhas07 committed Apr 18, 2024
1 parent 2c0e461 commit 0e6c5f8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2553,7 +2553,8 @@ module.exports = grammar({
choice(
$.keyword_stored,
$.keyword_virtual,
)
),
$.keyword_unique
)),

_check_constraint: $ => seq(
Expand Down
12 changes: 11 additions & 1 deletion test/corpus/create.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ Create table multiple columns

CREATE TABLE my_table (
id BIGINT NOT NULL PRIMARY KEY,
date DATE DEFAULT NULL ASC
date DATE DEFAULT NULL ASC,
date2 DATE DEFAULT NULL UNIQUE ASC
);

--------------------------------------------------------------------------------
Expand All @@ -57,6 +58,15 @@ CREATE TABLE my_table (
(keyword_default)
(literal
(keyword_null))
(direction
(keyword_asc)))
(column_definition
name: (identifier)
type: (keyword_date)
(keyword_default)
(literal
(keyword_null))
(keyword_unique)
(direction
(keyword_asc)))))))

Expand Down

0 comments on commit 0e6c5f8

Please sign in to comment.