pub struct Migration { /* private fields */ }Expand description
One numbered change to the app’s database, with its declared kind. Clones retain the same callbacks across bootstrap and database opening.
Implementations§
Source§impl Migration
impl Migration
Sourcepub fn addition(version: u32, name: &'static str, sql: &'static str) -> Self
pub fn addition(version: u32, name: &'static str, sql: &'static str) -> Self
SQL that adds tables or columns, or changes only local objects. A runtime breaking classification refuses the whole migration batch.
Sourcepub fn addition_with<F>(version: u32, name: &'static str, f: F) -> Self
pub fn addition_with<F>(version: u32, name: &'static str, f: F) -> Self
Code that adds tables or columns, or changes only local objects.
Sourcepub fn breaking(
version: u32,
name: &'static str,
sql: &'static str,
old_writes: OldWrites,
) -> Self
pub fn breaking( version: u32, name: &'static str, sql: &'static str, old_writes: OldWrites, ) -> Self
Breaking SQL with an explicit choice for late old-version writes. An addition or local-only classification refuses the whole batch.
A breaking migration cannot omit the old-write choice:
ⓘ
use coven_database::Migration;
Migration::breaking(2, "rename", "ALTER TABLE notes RENAME COLUMN title TO name");Sourcepub fn breaking_with<F>(
version: u32,
name: &'static str,
f: F,
old_writes: OldWrites,
) -> Self
pub fn breaking_with<F>( version: u32, name: &'static str, f: F, old_writes: OldWrites, ) -> Self
Breaking code, including backfills and rebuilds, with its old-write choice.
ⓘ
use coven_database::Migration;
Migration::breaking_with(2, "backfill", |context| {
context.execute_batch("UPDATE notes SET title=upper(title)")?;
Ok(())
});Trait Implementations§
Auto Trait Implementations§
impl Freeze for Migration
impl !RefUnwindSafe for Migration
impl Send for Migration
impl Sync for Migration
impl Unpin for Migration
impl UnsafeUnpin for Migration
impl !UnwindSafe for Migration
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
Mutably borrows from an owned value. Read more