Parse MySQL ALTER TABLE DROP FOREIGN KEY syntax (#1762)

This commit is contained in:
Michael Victor Zink 2025-03-11 23:34:18 -07:00 committed by GitHub
parent 6ec5223f50
commit 1e54a34acd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 27 additions and 4 deletions

View file

@ -2273,6 +2273,16 @@ fn parse_alter_table_drop_primary_key() {
);
}
#[test]
fn parse_alter_table_drop_foreign_key() {
assert_matches!(
alter_table_op(
mysql_and_generic().verified_stmt("ALTER TABLE tab DROP FOREIGN KEY foo_ibfk_1")
),
AlterTableOperation::DropForeignKey { name } if name.value == "foo_ibfk_1"
);
}
#[test]
fn parse_alter_table_change_column() {
let expected_name = ObjectName::from(vec![Ident::new("orders")]);