pub struct AlterTable {
pub table: String,
pub ops: Vec<AlterOp>,
pub only: bool,
pub if_exists: bool,
}Expand description
Fluent builder for ALTER TABLE statements
Fields§
§table: StringTarget table.
ops: Vec<AlterOp>Queued operations.
only: boolALTER TABLE ONLY.
if_exists: boolIF EXISTS.
Implementations§
Source§impl AlterTable
impl AlterTable
Sourcepub fn add_column(self, col: Column) -> Self
pub fn add_column(self, col: Column) -> Self
ADD COLUMN
Sourcepub fn drop_column(self, name: impl Into<String>) -> Self
pub fn drop_column(self, name: impl Into<String>) -> Self
DROP COLUMN
Sourcepub fn drop_column_cascade(self, name: impl Into<String>) -> Self
pub fn drop_column_cascade(self, name: impl Into<String>) -> Self
DROP COLUMN CASCADE
Sourcepub fn rename_column(
self,
from: impl Into<String>,
to: impl Into<String>,
) -> Self
pub fn rename_column( self, from: impl Into<String>, to: impl Into<String>, ) -> Self
RENAME COLUMN old TO new
Sourcepub fn set_type(self, column: impl Into<String>, new_type: ColumnType) -> Self
pub fn set_type(self, column: impl Into<String>, new_type: ColumnType) -> Self
ALTER COLUMN TYPE.
Sourcepub fn set_type_using(
self,
column: impl Into<String>,
new_type: ColumnType,
using: impl Into<String>,
) -> Self
pub fn set_type_using( self, column: impl Into<String>, new_type: ColumnType, using: impl Into<String>, ) -> Self
ALTER COLUMN TYPE … USING expression.
Sourcepub fn set_not_null(self, column: impl Into<String>) -> Self
pub fn set_not_null(self, column: impl Into<String>) -> Self
ALTER COLUMN SET NOT NULL
Sourcepub fn drop_not_null(self, column: impl Into<String>) -> Self
pub fn drop_not_null(self, column: impl Into<String>) -> Self
ALTER COLUMN DROP NOT NULL
Sourcepub fn set_default(
self,
column: impl Into<String>,
expr: impl Into<String>,
) -> Self
pub fn set_default( self, column: impl Into<String>, expr: impl Into<String>, ) -> Self
ALTER COLUMN SET DEFAULT.
Sourcepub fn drop_default(self, column: impl Into<String>) -> Self
pub fn drop_default(self, column: impl Into<String>) -> Self
ALTER COLUMN DROP DEFAULT.
Sourcepub fn add_constraint(
self,
name: impl Into<String>,
constraint: TableConstraint,
) -> Self
pub fn add_constraint( self, name: impl Into<String>, constraint: TableConstraint, ) -> Self
ADD CONSTRAINT.
Sourcepub fn drop_constraint(self, name: impl Into<String>) -> Self
pub fn drop_constraint(self, name: impl Into<String>) -> Self
DROP CONSTRAINT.
Sourcepub fn drop_constraint_cascade(self, name: impl Into<String>) -> Self
pub fn drop_constraint_cascade(self, name: impl Into<String>) -> Self
DROP CONSTRAINT CASCADE.
Sourcepub fn set_schema(self, schema: impl Into<String>) -> Self
pub fn set_schema(self, schema: impl Into<String>) -> Self
SET SCHEMA.
Sourcepub fn enable_rls(self) -> Self
pub fn enable_rls(self) -> Self
ENABLE ROW LEVEL SECURITY.
Sourcepub fn disable_rls(self) -> Self
pub fn disable_rls(self) -> Self
DISABLE ROW LEVEL SECURITY.
Sourcepub fn no_force_rls(self) -> Self
pub fn no_force_rls(self) -> Self
NO FORCE ROW LEVEL SECURITY — owner bypasses policies (default).
Trait Implementations§
Source§impl Clone for AlterTable
impl Clone for AlterTable
Source§fn clone(&self) -> AlterTable
fn clone(&self) -> AlterTable
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 AlterTable
impl RefUnwindSafe for AlterTable
impl Send for AlterTable
impl Sync for AlterTable
impl Unpin for AlterTable
impl UnsafeUnpin for AlterTable
impl UnwindSafe for AlterTable
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