Skip to content

Commit

Permalink
feat: Add MariaDB/MySQL ADD|CHANGE|MODIFY ... FIRST|AFTER ...
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoniePhiline committed Feb 17, 2023
1 parent 409be47 commit 393e0d3
Show file tree
Hide file tree
Showing 5 changed files with 147,563 additions and 146,364 deletions.
18 changes: 14 additions & 4 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ module.exports = grammar({
keyword_over: _ => make_keyword("over"),
keyword_nulls: _ => make_keyword("nulls"),
keyword_first: _ => make_keyword("first"),
keyword_after: _ => make_keyword("after"),
keyword_last: _ => make_keyword("last"),
keyword_window: _ => make_keyword("window"),
keyword_range: _ => make_keyword("range"),
Expand Down Expand Up @@ -730,6 +731,7 @@ module.exports = grammar({
),
optional($._if_not_exists),
$.column_definition,
optional($.column_position),
),

alter_column: $ => seq(
Expand Down Expand Up @@ -776,8 +778,8 @@ module.exports = grammar({
$.keyword_column,
),
optional($._if_exists),
$.column_definition
// TODO: FIRST | AFTER col_name
$.column_definition,
optional($.column_position),
),

change_column: $ => seq(
Expand All @@ -787,8 +789,16 @@ module.exports = grammar({
),
optional($._if_exists),
field('old_name', $.identifier),
$.column_definition
// TODO: FIRST | AFTER col_name
$.column_definition,
optional($.column_position),
),

column_position: $ => choice(
$.keyword_first,
seq(
$.keyword_after,
field('col_name', $.identifier),
),
),

drop_column: $ => seq(
Expand Down
66 changes: 66 additions & 0 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 393e0d3

Please sign in to comment.