-
Notifications
You must be signed in to change notification settings - Fork 616
feat: allow multiple actions in one ALTER TABLE
statement
#960
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
Conversation
Pull Request Test Coverage Report for Build 6014479206
💛 - Coveralls |
Could they be represented by a Interestingly #959 is also related to mysql partition syntax |
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.
This looks great -- thank you @ForbesLindesay 🦾
Sorry for the delay in reviewing -- I was away last week.
assert_eq!("foo", column_def.name.to_string()); | ||
assert_eq!("TEXT", column_def.data_type.to_string()); | ||
} | ||
_ => unreachable!(), | ||
}; | ||
|
||
let rename_table = "ALTER TABLE tab RENAME TO new_tab"; | ||
match verified_stmt(rename_table) { |
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.
This is a nice refactoring of the tests -- thank you
@@ -588,6 +584,48 @@ fn parse_alter_table_alter_column() { | |||
} | |||
} | |||
|
|||
#[test] | |||
fn parse_alter_table_add_columns() { |
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.
👍
self.peek_token(), | ||
); | ||
}; | ||
let operations = self.parse_comma_separated(Parser::parse_alter_table_operation)?; |
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.
❤️
ALTER TABLE
statement
Fixes #675
I primarily focused on ensuring this follows the Postgres syntax: https://www.postgresql.org/docs/15/sql-altertable.html
This should largely work for MySql too though: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html
One possible thing that could be worth considering is that MySql supports a list of "partition_options" after the "alter_options" and while the "alter_options" are comma-separated just like Postgres, the "partition_options" are separated by a space. I'm not sure how best to cleanly represent this in our current AST.