Skip to main content

AlterColumnOperation

Enum AlterColumnOperation 

Source
pub enum AlterColumnOperation {
    SetType {
        data_type: DbType,
    },
    SetMaxLength {
        max_length: i32,
    },
    DropMaxLength,
}
Expand description

Representation of a single change to an existing column.

Each variant renders into exactly one ALTER TABLE statement, or into none at all in sqlite: it has no ALTER COLUMN, and none of these changes are observable in a STRICT table - DbType::VarChar and DbType::Text are both TEXT, every integer is INTEGER, both floats are REAL, and a maximum length is never enforced.

Variants§

§

SetType

Set the column’s type

The type has to be one which is fully described by itself. A DbType::VarChar carries its maximum length and a DbType::Choices its enum, so neither can be rendered from the type alone.

Fields

§data_type: DbType

The type to change the column to

§

SetMaxLength

Add the check constraint enforcing the column’s maximum length

A column which already has one has to drop it first: a constraint can’t be redefined, only replaced.

Fields

§max_length: i32

The maximum number of characters the column may hold

§

DropMaxLength

Drop the check constraint enforcing the column’s maximum length

Trait Implementations§

Source§

impl Clone for AlterColumnOperation

Source§

fn clone(&self) -> AlterColumnOperation

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for AlterColumnOperation

Source§

impl Debug for AlterColumnOperation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.