pub enum ColumnAnnotation {
Check(Check),
Unique(UniqueConstraint),
PrimaryKey(PrimaryKey),
Index(Index),
Default(Sql),
InitializeAs(Sql),
}Variants§
Check(Check)
Moved to table.
Unique(UniqueConstraint)
Moved to table.
PrimaryKey(PrimaryKey)
Moved to table.
Index(Index)
Moved to table.
Default(Sql)
Column default annotation.
InitializeAs(Sql)
If column is created, then this attribute is used to prefill it, treat it as one-time, much more powerful DEFAULT value. It can be implemented as an UPDATE statement, or with SET TYPE … USING, but not as one-time DEFAULT, because it can reference other columns.
If column is updated, then it is just passed to USING expression, allowing to refernce older column value, just be careful with that. Initially this expression was only usable for new column creation, but after further consideration I decided there is no harm of allowing it for upgrades. Yes, this is a semi-imperative action, however it is pretty isolated and subtle to make it actually work.
After all, it doesn’t allow access to old schema version fields directly (except for the current field), thus not breaking isolation of a standalone schema definition.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ColumnAnnotation
impl RefUnwindSafe for ColumnAnnotation
impl Send for ColumnAnnotation
impl Sync for ColumnAnnotation
impl Unpin for ColumnAnnotation
impl UnwindSafe for ColumnAnnotation
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
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>
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>
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