mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-29 16:31:18 +00:00
SCHEMA 17 - crude deletion of relays ending in slash (it's not critical data)
This commit is contained in:
parent
9527fa78d6
commit
f38cc472c8
@ -103,7 +103,7 @@ macro_rules! apply_sql {
|
||||
}
|
||||
|
||||
fn upgrade(db: &Connection, mut version: u16) -> Result<(), Error> {
|
||||
let current_version = 16;
|
||||
let current_version = 17;
|
||||
if version > current_version {
|
||||
panic!(
|
||||
"Database version {} is newer than this binary which expects version {}.",
|
||||
@ -129,6 +129,7 @@ fn upgrade(db: &Connection, mut version: u16) -> Result<(), Error> {
|
||||
apply_sql!(db, version, 14, "schema14.sql");
|
||||
apply_sql!(db, version, 15, "schema15.sql");
|
||||
apply_sql!(db, version, 16, "schema16.sql");
|
||||
apply_sql!(db, version, 17, "schema17.sql");
|
||||
tracing::info!("Database is at version {}", version);
|
||||
Ok(())
|
||||
}
|
||||
|
11
src/db/schema17.sql
Normal file
11
src/db/schema17.sql
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
-- I tried to merge records with relays ending in '/' to records where they didn't, but SQLITE makes it very hard to update joins (you can't do it directly, and I think the join ON clause is too complex to use EXISTS tricks).
|
||||
-- So I'm just going to delete such records. The data lost is statistical and not critical.
|
||||
|
||||
DELETE FROM event_seen WHERE SUBSTR(relay, LENGTH(relay), 1) == '/';
|
||||
DELETE FROM person_relay WHERE SUBSTR(relay, LENGTH(relay), 1) == '/';
|
||||
DELETE FROM relay WHERE SUBSTR(url, LENGTH(url), 1) == '/';
|
||||
|
||||
DELETE FROM event_seen WHERE SUBSTR(relay, 0, 15) == 'wss://127.0.0.1';
|
||||
DELETE FROM person_relay WHERE SUBSTR(relay, 0, 15) == 'wss://127.0.0.1';
|
||||
DELETE FROM relay WHERE SUBSTR(url, 0, 15) == 'wss://127.0.0.1';
|
Loading…
Reference in New Issue
Block a user