INNER CODE UNIT · Rust

repair_migrate_from

aannoo/hcom · src/db/mod.rs:705

    fn repair_migrate_from(&self, version: i32) -> i32 {
        let columns: std::collections::HashSet<String> = self
            .conn
            .prepare("PRAGMA table_info(instances)")
            .and_then(|mut s| {
                Ok(s.query_map([], |row| row.get::<_, String>(1))?
                    .filter_map(|r| r.ok())
                    .collect())
            })
            .unwrap_or_default();

        // (migration version, a column that migration introduces)
        const COLUMN_MIGRATIONS: &[(i32, &str)] =
            &[(17, "terminal_preset_requested"), (18, "last_seen")];
        for (migration, column) in COLUMN_MIGRATIONS {
            if !columns.contains(*column) {
                return migration - 1;
            }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…