Skip to content

Commit ff7c964

Browse files
committed
fix: fix for updating the MySQL tables if upgrading from the dev build
1 parent 421f1fd commit ff7c964

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/databases/mysql.rs

+6
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,17 @@ impl Database for MysqlDatabase {
5454
UNIQUE (`key`)
5555
);", AUTH_KEY_LENGTH as i8);
5656

57+
// When upgrading from < v2.3.0
58+
let alter_whitelist_table = "ALTER TABLE `whitelist` MODIFY `info_hash` VARCHAR(40);".to_string();
59+
let alter_torrents_table = "ALTER TABLE `torrents` MODIFY `info_hash` VARCHAR(40);".to_string();
60+
5761
let mut conn = self.pool.get().map_err(|_| database::Error::DatabaseError)?;
5862

5963
conn.query_drop(&create_torrents_table).expect("Could not create torrents table.");
6064
conn.query_drop(&create_keys_table).expect("Could not create keys table.");
6165
conn.query_drop(&create_whitelist_table).expect("Could not create whitelist table.");
66+
conn.query_drop(&alter_whitelist_table).expect("Could not alter whitelist table.");
67+
conn.query_drop(&alter_torrents_table).expect("Could not alter torrents table.");
6268

6369
Ok(())
6470
}

0 commit comments

Comments
 (0)