Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Migration

Having a database is one thing, having it being setup automatically and it being migrated during updates is the other thing. While this can be done in the run_setup_job method, you can simple act on the MigrationState and run the add_migrator method on it.

To run database migrations you have to load the quokka::migration::MigrationPouch.

Example

use quokka::migration::{MigrationState, MigrationStateExt};

fn configure_state<S: Clone + Send + Sync + 'static + ProvideStateRef<MigrationState>>(state: &mut S) -> quokka::pouch::Result<()> {
    state.add_migrator(sqlx::migrate!());

    Ok(())
}