pub enum ParsedStatement {
Show 19 variants
CreateTable {
table: String,
columns: Vec<ColumnInfo>,
foreign_keys: Vec<ForeignKeyInfo>,
has_primary_key: bool,
},
DropTable {
tables: Vec<String>,
if_exists: bool,
cascade: bool,
},
AlterTableAddColumn {
table: String,
column: ColumnInfo,
},
AlterTableDropColumn {
table: String,
column: String,
if_exists: bool,
},
AlterTableAlterColumnType {
table: String,
column: String,
new_type: String,
},
AlterTableSetNotNull {
table: String,
column: String,
},
AlterTableAddForeignKey {
table: String,
fk: ForeignKeyInfo,
},
AlterTableDropConstraint {
table: String,
constraint: String,
cascade: bool,
},
AlterTableRenameColumn {
table: String,
old: String,
new: String,
},
AlterTableRenameTable {
old: String,
new: String,
},
CreateIndex {
index_name: Option<String>,
table: String,
columns: Vec<String>,
unique: bool,
concurrently: bool,
},
DropIndex {
names: Vec<String>,
concurrently: bool,
if_exists: bool,
},
AlterTableAddPrimaryKey {
table: String,
columns: Vec<String>,
},
AlterTableDropPrimaryKey {
table: String,
},
AlterTableAlterColumnDefault {
table: String,
column: String,
drop_default: bool,
},
Reindex {
target_type: String,
target_name: String,
concurrently: bool,
},
Cluster {
table: Option<String>,
index: Option<String>,
},
Truncate {
tables: Vec<String>,
cascade: bool,
},
Other {
raw: String,
},
}Expand description
Normalised view of every SQL statement we care about.
Variants§
CreateTable
DropTable
AlterTableAddColumn
AlterTableDropColumn
AlterTableAlterColumnType
AlterTableSetNotNull
AlterTableAddForeignKey
AlterTableDropConstraint
AlterTableRenameColumn
AlterTableRenameTable
CreateIndex
Fields
DropIndex
AlterTableAddPrimaryKey
AlterTableDropPrimaryKey
AlterTableAlterColumnDefault
Reindex
REINDEX INDEX/TABLE/DATABASE — can take hours with ACCESS EXCLUSIVE (without CONCURRENTLY)
Cluster
CLUSTER table — full table rewrite with ACCESS EXCLUSIVE
Truncate
TRUNCATE TABLE — instant but irreversible
Other
Catch-all for statements we don’t inspect in detail.
Trait Implementations§
Source§impl Clone for ParsedStatement
impl Clone for ParsedStatement
Source§fn clone(&self) -> ParsedStatement
fn clone(&self) -> ParsedStatement
Returns a duplicate 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 moreAuto Trait Implementations§
impl Freeze for ParsedStatement
impl RefUnwindSafe for ParsedStatement
impl Send for ParsedStatement
impl Sync for ParsedStatement
impl Unpin for ParsedStatement
impl UnsafeUnpin for ParsedStatement
impl UnwindSafe for ParsedStatement
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more