Skip to content

Commit 821c67c

Browse files
committed
Rename AlterOperation -> AlterTableOperation
Since other ALTER statements will have separate sub-commands.
1 parent 0b148fc commit 821c67c

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/sqlast/ddl.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ use super::{ASTNode, SQLIdent, SQLObjectName};
44

55
/// An `ALTER TABLE` (`SQLStatement::SQLAlterTable`) operation
66
#[derive(Debug, Clone, PartialEq)]
7-
pub enum AlterOperation {
7+
pub enum AlterTableOperation {
88
/// `ADD <table_constraint>`
99
AddConstraint(TableConstraint),
10-
/// TODO: implement `DROP CONSTRAINT name`
10+
/// TODO: implement `DROP CONSTRAINT <name>`
1111
DropConstraint { name: SQLIdent },
1212
}
1313

14-
impl ToString for AlterOperation {
14+
impl ToString for AlterTableOperation {
1515
fn to_string(&self) -> String {
1616
match self {
17-
AlterOperation::AddConstraint(constraint) => format!("ADD {}", constraint.to_string()),
18-
AlterOperation::DropConstraint { name } => format!("DROP CONSTRAINT {}", name),
17+
AlterTableOperation::AddConstraint(c) => format!("ADD {}", c.to_string()),
18+
AlterTableOperation::DropConstraint { name } => format!("DROP CONSTRAINT {}", name),
1919
}
2020
}
2121
}

src/sqlast/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ mod sql_operator;
2020
mod sqltype;
2121
mod value;
2222

23-
pub use self::ddl::{AlterOperation, TableConstraint};
23+
pub use self::ddl::{AlterTableOperation, TableConstraint};
2424
pub use self::query::{
2525
Cte, Join, JoinConstraint, JoinOperator, SQLOrderByExpr, SQLQuery, SQLSelect, SQLSelectItem,
2626
SQLSetExpr, SQLSetOperator, TableFactor,
@@ -399,7 +399,7 @@ pub enum SQLStatement {
399399
SQLAlterTable {
400400
/// Table name
401401
name: SQLObjectName,
402-
operation: AlterOperation,
402+
operation: AlterTableOperation,
403403
},
404404
}
405405

src/sqlparser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ impl Parser {
883883
let table_name = self.parse_object_name()?;
884884
let operation = if self.parse_keyword("ADD") {
885885
if let Some(constraint) = self.parse_optional_table_constraint()? {
886-
AlterOperation::AddConstraint(constraint)
886+
AlterTableOperation::AddConstraint(constraint)
887887
} else {
888888
return self.expected("a constraint in ALTER TABLE .. ADD", self.peek_token());
889889
}

tests/sqlparser_common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ fn parse_alter_table_constraints() {
659659
match verified_stmt(&format!("ALTER TABLE tab ADD {}", constraint_text)) {
660660
SQLStatement::SQLAlterTable {
661661
name,
662-
operation: AlterOperation::AddConstraint(constraint),
662+
operation: AlterTableOperation::AddConstraint(constraint),
663663
} => {
664664
assert_eq!("tab", name.to_string());
665665
assert_eq!(constraint_text, constraint.to_string());

0 commit comments

Comments
 (0)