pub struct M<'u> { /* private fields */ }
Expand description

One migration

Implementations

Create a schema update. The SQL command will be executed only when the migration has not been executed on the underlying database.

Please note
  • PRAGMA statements are discouraged here. They are often better applied outside of migrations, because:
    • a PRAGMA executed this way may not be applied consistently. For instance:
      • foreign_keys needs to be executed for each sqlite connection, not just once per database as a migration,
      • journal_mode has no effect when executed inside transactions (that will be the case for the SQL written in up).
    • Multiple SQL commands contaning PRAGMA are not working with the extra_check feature of rusqlite.
  • SQL commands should end with a “;”.
Example
use rusqlite_migration::M;

M::up("CREATE TABLE animals (name TEXT);");

Define a down-migration. This SQL statement should exactly reverse the changes performed in up().

A call to this method is not required.

Example
use rusqlite_migration::M;

M::up("CREATE TABLE animals (name TEXT);")
    .down("DROP TABLE animals;");

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

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.