Struct rusqlite_migration::M
source · [−]pub struct M<'u> { /* private fields */ }
Expand description
One migration
Implementations
sourceimpl<'u> M<'u>
impl<'u> M<'u>
sourcepub fn up(sql: &'u str) -> Self
pub fn up(sql: &'u str) -> Self
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 inup
).
- Multiple SQL commands contaning
PRAGMA
are not working with theextra_check
feature of rusqlite.
- a PRAGMA executed this way may not be applied consistently. For instance:
- SQL commands should end with a “;”.
Example
use rusqlite_migration::M;
M::up("CREATE TABLE animals (name TEXT);");
Trait Implementations
impl<'u> StructuralPartialEq for M<'u>
Auto Trait Implementations
impl<'u> RefUnwindSafe for M<'u>
impl<'u> Send for M<'u>
impl<'u> Sync for M<'u>
impl<'u> Unpin for M<'u>
impl<'u> UnwindSafe for M<'u>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more