[−][src]Function places::db::schema::migration
fn migration<F>(
db: &PlacesDb,
from: i64,
to: i64,
stmts: &[&str],
extra_logic: F
) -> Result<()> where
F: FnOnce() -> Result<()>,
Helper for upgrade. Intended use:
ⓘThis example is not tested
migration(db, 2, 3, &[stuff, to, migrate, version2, to, version3], || Ok(()))?; migration(db, 3, 4, &[stuff, to, migrate, version3, to, version4], || Ok(()))?; migration(db, 4, 5, &[stuff, to, migrate, version4, to, version5], || Ok(()))?; assert_eq!(get_current_schema_version(), 5);
The callback parameter is if any extra logic is needed for the migration (for example, creating bookmark roots). In an ideal world, this would be an Option, but sadly, that can't typecheck.