Skip to content

Commit

Permalink
Merge pull request #1729 from taozhi8833998/fix-alter-table-modify-co…
Browse files Browse the repository at this point in the history
…lumn-mysql

fix: alter table modify column keyword is optional in mysql
  • Loading branch information
taozhi8833998 authored Dec 20, 2023
2 parents 239bdcd + a3bf84d commit 8de34cb
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 8de34cb

Please sign in to comment.