Struct barrel::migration::Migration[][src]

pub struct Migration { /* fields omitted */ }
Expand description

Represents a schema migration on a database

Implementations

Specify a database schema name for this migration

Creates the SQL for this migration for a specific backend

This function copies state and does not touch the original migration layout. This allows you to call revert later on in the process to auto-infer the down-behaviour

The same as make but making a run-time check for sql variant

The SqlVariant type is populated based on the backends that are being selected at compile-time.

This function panics if the provided variant is empty!

Inject a line of custom SQL into the top-level migration scope

This is a bypass to the barrel typesystem, in case there is something your database supports that barrel doesn’t, or if there is an issue with the way that barrel represents types. It does however mean that the SQL provided needs to be specific for one database, meaning that future migrations might become cumbersome.

Automatically infer the down step of this migration

Will thrown an error if behaviour is ambiguous or not possible to infer (e.g. revert a drop_table)

Pass a reference to a migration toolkit runner which will automatically generate and execute

Create a new table with a specific name

Create a new table only if it doesn’t exist yet

Change fields on an existing table

Rename a table

Drop an existing table

Only drop a table if it exists

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.