Enum sqlparser::ast::AlterTableOperation  
source · pub enum AlterTableOperation {
Show 14 variants
    AddConstraint(TableConstraint),
    AddColumn {
        column_keyword: bool,
        if_not_exists: bool,
        column_def: ColumnDef,
    },
    DropConstraint {
        if_exists: bool,
        name: Ident,
        cascade: bool,
    },
    DropColumn {
        column_name: Ident,
        if_exists: bool,
        cascade: bool,
    },
    DropPrimaryKey,
    RenamePartitions {
        old_partitions: Vec<Expr>,
        new_partitions: Vec<Expr>,
    },
    AddPartitions {
        if_not_exists: bool,
        new_partitions: Vec<Expr>,
    },
    DropPartitions {
        partitions: Vec<Expr>,
        if_exists: bool,
    },
    RenameColumn {
        old_column_name: Ident,
        new_column_name: Ident,
    },
    RenameTable {
        table_name: ObjectName,
    },
    ChangeColumn {
        old_name: Ident,
        new_name: Ident,
        data_type: DataType,
        options: Vec<ColumnOption>,
    },
    RenameConstraint {
        old_name: Ident,
        new_name: Ident,
    },
    AlterColumn {
        column_name: Ident,
        op: AlterColumnOperation,
    },
    SwapWith {
        table_name: ObjectName,
    },
}Expand description
An ALTER TABLE (Statement::AlterTable) operation
Variants§
AddConstraint(TableConstraint)
ADD <table_constraint>
AddColumn
Fields
ADD [COLUMN] [IF NOT EXISTS] <column_def>
DropConstraint
DROP CONSTRAINT [ IF EXISTS ] <name>
DropColumn
DROP [ COLUMN ] [ IF EXISTS ] <column_name> [ CASCADE ]
DropPrimaryKey
DROP PRIMARY KEY
Note: this is a MySQL-specific operation.
RenamePartitions
RENAME TO PARTITION (partition=val)
AddPartitions
Add Partitions
DropPartitions
RenameColumn
RENAME [ COLUMN ] <old_column_name> TO <new_column_name>
RenameTable
Fields
§
table_name: ObjectNameRENAME TO <table_name>
ChangeColumn
RenameConstraint
RENAME CONSTRAINT <old_constraint_name> TO <new_constraint_name>
Note: this is a PostgreSQL-specific operation.
AlterColumn
ALTER [ COLUMN ]
SwapWith
Fields
§
table_name: ObjectName‘SWAP WITH <table_name>’
Note: this is Snowflake specific https://docs.snowflake.com/en/sql-reference/sql/alter-table
Trait Implementations§
source§impl Clone for AlterTableOperation
 
impl Clone for AlterTableOperation
source§fn clone(&self) -> AlterTableOperation
 
fn clone(&self) -> AlterTableOperation
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from 
source. Read moresource§impl Debug for AlterTableOperation
 
impl Debug for AlterTableOperation
source§impl<'de> Deserialize<'de> for AlterTableOperation
 
impl<'de> Deserialize<'de> for AlterTableOperation
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,
 
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for AlterTableOperation
 
impl Display for AlterTableOperation
source§impl Hash for AlterTableOperation
 
impl Hash for AlterTableOperation
source§impl Ord for AlterTableOperation
 
impl Ord for AlterTableOperation
source§fn cmp(&self, other: &AlterTableOperation) -> Ordering
 
fn cmp(&self, other: &AlterTableOperation) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
    Self: Sized,
 
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for AlterTableOperation
 
impl PartialEq for AlterTableOperation
source§fn eq(&self, other: &AlterTableOperation) -> bool
 
fn eq(&self, other: &AlterTableOperation) -> bool
This method tests for 
self and other values to be equal, and is used
by ==.source§impl PartialOrd for AlterTableOperation
 
impl PartialOrd for AlterTableOperation
source§fn partial_cmp(&self, other: &AlterTableOperation) -> Option<Ordering>
 
fn partial_cmp(&self, other: &AlterTableOperation) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
 
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for 
self and other) and is used by the <=
operator. Read moresource§impl Serialize for AlterTableOperation
 
impl Serialize for AlterTableOperation
source§impl Visit for AlterTableOperation
 
impl Visit for AlterTableOperation
source§impl VisitMut for AlterTableOperation
 
impl VisitMut for AlterTableOperation
fn visit<V: VisitorMut>(&mut self, visitor: &mut V) -> ControlFlow<V::Break>
impl Eq for AlterTableOperation
impl StructuralEq for AlterTableOperation
impl StructuralPartialEq for AlterTableOperation
Auto Trait Implementations§
impl RefUnwindSafe for AlterTableOperation
impl Send for AlterTableOperation
impl Sync for AlterTableOperation
impl Unpin for AlterTableOperation
impl UnwindSafe for AlterTableOperation
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more