Skip to main content

CustomSqlBuilder

Struct CustomSqlBuilder 

Source
pub struct CustomSqlBuilder { /* private fields */ }
Expand description

Builder for constructing custom SQL migrations

Implementations§

Source§

impl CustomSqlBuilder

Source

pub fn new() -> Self

Create a new custom SQL migration builder

Source

pub fn with_id(id: impl Into<String>) -> Self

Create a custom SQL migration with a specific ID

Source

pub fn id(self, id: impl Into<String>) -> Self

Set the migration ID

Source

pub fn name(self, name: impl Into<String>) -> Self

Set the migration name

Source

pub fn up_sql(self, sql: impl Into<String>) -> Self

Set the up migration SQL

Source

pub fn down_sql(self, sql: impl Into<String>) -> Self

Set the down migration SQL (rollback)

Source

pub fn description(self, description: impl Into<String>) -> Self

Set a description for the migration

Source

pub fn tag(self, tag: impl Into<String>) -> Self

Add a tag to the migration

Source

pub fn tags(self, tags: impl IntoIterator<Item = impl Into<String>>) -> Self

Add multiple tags to the migration

Source

pub fn requires_manual_review(self) -> Self

Mark the migration as requiring manual review

Source

pub fn destructive(self) -> Self

Mark the migration as destructive (will cause data loss)

Source

pub fn non_destructive(self) -> Self

Mark the migration as non-destructive

Source

pub fn depends_on(self, migration_id: impl Into<String>) -> Self

Add a dependency on another migration

Source

pub fn dependencies( self, deps: impl IntoIterator<Item = impl Into<String>>, ) -> Self

Add multiple dependencies

Source

pub fn rollback_safe(self) -> Self

Mark the migration as rollback-safe

Source

pub fn not_rollback_safe(self) -> Self

Mark the migration as not rollback-safe

Source

pub fn data_migration(id: impl Into<String>, name: impl Into<String>) -> Self

Convenience method for creating a data migration

Source

pub fn schema_patch(id: impl Into<String>, name: impl Into<String>) -> Self

Convenience method for creating a schema patch

Source

pub fn destructive_migration( id: impl Into<String>, name: impl Into<String>, ) -> Self

Convenience method for creating a destructive migration

Source

pub fn performance_optimization( id: impl Into<String>, name: impl Into<String>, ) -> Self

Convenience method for creating a performance optimization

Source

pub fn security_patch(id: impl Into<String>, name: impl Into<String>) -> Self

Convenience method for creating a security patch

Source

pub fn get_id(&self) -> Option<&String>

Get the migration ID

Source

pub fn get_name(&self) -> Option<&String>

Get the migration name

Source

pub fn get_up_sql(&self) -> Option<&String>

Get the up SQL

Source

pub fn get_down_sql(&self) -> Option<&String>

Get the down SQL

Source

pub fn is_destructive(&self) -> bool

Check if the migration is destructive

Source

pub fn is_manual_review_required(&self) -> bool

Check if the migration requires manual review

Source

pub fn is_rollback_safe(&self) -> bool

Check if the migration is rollback-safe

Source

pub fn get_tags(&self) -> &[String]

Get all tags

Source

pub fn get_dependencies(&self) -> &[String]

Get all dependencies

Trait Implementations§

Source§

impl Clone for CustomSqlBuilder

Source§

fn clone(&self) -> CustomSqlBuilder

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 ConditionalBuilder for CustomSqlBuilder

Source§

fn when<F>(self, condition: bool, config_fn: F) -> Self
where F: FnOnce(&mut Self), Self: Sized,

Apply configuration conditionally Read more
Source§

fn when_else<F, G>(self, condition: bool, if_true: F, if_false: G) -> Self
where F: FnOnce(&mut Self), G: FnOnce(&mut Self), Self: Sized,

Apply configuration conditionally with a default fallback Read more
Source§

impl Debug for CustomSqlBuilder

Source§

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

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

impl InspectableBuilder for CustomSqlBuilder

Source§

fn debug_info(&self) -> String

Get a debug representation of the current builder state Read more
Source§

fn summary(&self) -> String

Get a summary of the current configuration Read more
Source§

impl SchemaBuilder for CustomSqlBuilder

Source§

type Output = Migration

The type of schema object that this builder produces
Source§

type Error = CustomSqlBuildError

The type of error that can occur during building
Source§

fn build(self) -> Result<Self::Output, Self::Error>

Build the final schema object from the builder configuration Read more
Source§

impl ValidatableBuilder for CustomSqlBuilder

Source§

fn is_valid(&self) -> bool

Check if the current builder configuration is valid Read more
Source§

fn validation_errors(&self) -> Vec<String>

Get a list of validation errors for the current configuration 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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more