- match schema {
- SCHEMA_VERSION => {},
- _ => panic!("Unknown schema in db: {}, we support up to {}", schema, SCHEMA_VERSION),
+ if schema == 1 {
+ let tx = client.transaction().await.unwrap();
+ tx.execute("ALTER TABLE channel_updates DROP COLUMN chain_hash", &[]).await.unwrap();
+ tx.execute("ALTER TABLE channel_announcements DROP COLUMN chain_hash", &[]).await.unwrap();
+ tx.execute("UPDATE config SET db_schema = 2 WHERE id = 1", &[]).await.unwrap();
+ tx.commit().await.unwrap();
+ }
+ if schema <= 1 || schema > SCHEMA_VERSION {
+ panic!("Unknown schema in db: {}, we support up to {}", schema, SCHEMA_VERSION);