Enum AlterSpecification

Source
pub enum AlterSpecification<'a> {
    AddColumn {
        add_span: Span,
        if_not_exists_span: Option<Span>,
        identifier: Identifier<'a>,
        data_type: DataType<'a>,
    },
    AddIndex {
        add_span: Span,
        index_type: IndexType,
        if_not_exists: Option<Span>,
        name: Option<Identifier<'a>>,
        constraint: Option<(Span, Option<Identifier<'a>>)>,
        cols: Vec<IndexCol<'a>>,
        index_options: Vec<IndexOption<'a>>,
    },
    AddForeignKey {
        add_span: Span,
        constraint: Option<(Span, Option<Identifier<'a>>)>,
        foreign_key_span: Span,
        if_not_exists: Option<Span>,
        name: Option<Identifier<'a>>,
        cols: Vec<IndexCol<'a>>,
        references_span: Span,
        references_table: Identifier<'a>,
        references_cols: Vec<Identifier<'a>>,
        ons: Vec<ForeignKeyOn>,
    },
    Modify {
        modify_span: Span,
        if_exists: Option<Span>,
        col: Identifier<'a>,
        definition: DataType<'a>,
    },
    DropColumn {
        drop_column_span: Span,
        column: Identifier<'a>,
        cascade: Option<Span>,
    },
    AlterColumn {
        alter_column_span: Span,
        column: Identifier<'a>,
        alter_column_action: AlterColumnAction<'a>,
    },
    OwnerTo {
        span: Span,
        owner: Identifier<'a>,
    },
}
Expand description

Enum of alterations to perform on a table

Variants§

§

AddColumn

Fields

§add_span: Span
§if_not_exists_span: Option<Span>
§identifier: Identifier<'a>
§data_type: DataType<'a>
§

AddIndex

Add an index

Fields

§add_span: Span

Span of “ADD”

§index_type: IndexType

The type of index to add

§if_not_exists: Option<Span>

Span of “IF NOT EXISTS” if specified

§name: Option<Identifier<'a>>

Named of index if specified

§constraint: Option<(Span, Option<Identifier<'a>>)>

Optional “CONSTRAINT” with symbol if specified

§cols: Vec<IndexCol<'a>>

Columns to add the index over

§index_options: Vec<IndexOption<'a>>

Options on the index

§

AddForeignKey

Add a foreign key

Fields

§add_span: Span

Span of “ADD”

§constraint: Option<(Span, Option<Identifier<'a>>)>

Optional “CONSTRAINT” with symbol if specified

§foreign_key_span: Span

Span of “FOREIGN KEY”

§if_not_exists: Option<Span>

Span of “IF NOT EXISTS” if specified

§name: Option<Identifier<'a>>

Named of index if specified

§cols: Vec<IndexCol<'a>>

Columns to add the index over

§references_span: Span

Span of “REFERENCES”

§references_table: Identifier<'a>

Refereed table

§references_cols: Vec<Identifier<'a>>

Columns in referred table

§ons: Vec<ForeignKeyOn>

List of what should happen at specified events

§

Modify

Modify a column

Fields

§modify_span: Span

Span of “MODIFY”

§if_exists: Option<Span>

Span of “IF EXISTS” if specified

§col: Identifier<'a>

Name of column to modify

§definition: DataType<'a>

New definition of column

§

DropColumn

Fields

§drop_column_span: Span

Span of “DROP COLUMN”

§column: Identifier<'a>

Name of column to drop

§cascade: Option<Span>

Span of “CASCADE” if specified

§

AlterColumn

Fields

§alter_column_span: Span

Span of “ALTER COLUMN”

§column: Identifier<'a>

Name of column to drop

§alter_column_action: AlterColumnAction<'a>
§

OwnerTo

Modify a column

Fields

§span: Span
§owner: Identifier<'a>

Name of owner

Trait Implementations§

Source§

impl<'a> Clone for AlterSpecification<'a>

Source§

fn clone(&self) -> AlterSpecification<'a>

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for AlterSpecification<'a>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a> Spanned for AlterSpecification<'a>

Source§

fn span(&self) -> Span

Compute byte span of an ast fragment
Source§

fn join_span(&self, other: &impl OptSpanned) -> Span

Compute the minimal span containing both self and other

Auto Trait Implementations§

§

impl<'a> Freeze for AlterSpecification<'a>

§

impl<'a> RefUnwindSafe for AlterSpecification<'a>

§

impl<'a> Send for AlterSpecification<'a>

§

impl<'a> Sync for AlterSpecification<'a>

§

impl<'a> Unpin for AlterSpecification<'a>

§

impl<'a> UnwindSafe for AlterSpecification<'a>

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> OptSpanned for T
where T: Spanned,

Source§

fn opt_span(&self) -> Option<Range<usize>>

Compute an optional byte span of an ast fragment
Source§

fn opt_join_span(&self, other: &impl OptSpanned) -> Option<Span>

Compute the minimal span containing both self and other if either is missing return the other
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 = Infallible

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.