Skip to content

Commit

Permalink
fix: alter table modify column keyword is optional in mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
taozhi8833998 committed Dec 19, 2023
1 parent c9c5192 commit a3bf84d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pegjs/mariadb.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -875,9 +875,11 @@ ALTER_ADD_COLUMN

ALTER_MODIFY_COLUMN
= KW_MODIFY __
kc:KW_COLUMN? __
cd:create_column_definition {
return {
action: 'modify',
keyword: kc,
...cd,
resource: 'column',
type: 'alter',
Expand Down
2 changes: 2 additions & 0 deletions pegjs/mysql.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -1076,9 +1076,11 @@ ALTER_ADD_COLUMN

ALTER_MODIFY_COLUMN
= KW_MODIFY __
kc:KW_COLUMN? __
cd:create_column_definition {
return {
action: 'modify',
keyword: kc,
...cd,
resource: 'column',
type: 'alter',
Expand Down
4 changes: 2 additions & 2 deletions test/mysql-mariadb.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,8 @@ describe('mysql', () => {
{
title: 'alter table modify column',
sql: [
"ALTER TABLE gifshow.reporter MODIFY update_at BIGINT UNSIGNED NOT NULL COMMENT 'update_at';",
"ALTER TABLE `gifshow`.`reporter` MODIFY `update_at` BIGINT UNSIGNED NOT NULL COMMENT 'update_at'"
"ALTER TABLE gifshow.reporter MODIFY Column update_at BIGINT UNSIGNED NOT NULL COMMENT 'update_at';",
"ALTER TABLE `gifshow`.`reporter` MODIFY COLUMN `update_at` BIGINT UNSIGNED NOT NULL COMMENT 'update_at'"
]
},
{
Expand Down

0 comments on commit a3bf84d

Please sign in to comment.