mirror of
https://github.com/tranxuanthang/lrcget.git
synced 2025-12-23 22:58:21 -05:00
Remove DROP TABLE when migrate
This commit is contained in:
821
package-lock.json
generated
821
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,6 @@
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tailwindcss/line-clamp": "^0.4.4",
|
||||
"@tanstack/vue-virtual": "^3.1.2",
|
||||
"@tauri-apps/api": "^1.6.0",
|
||||
"codemirror": "^6.0.1",
|
||||
|
||||
@@ -35,16 +35,6 @@ pub fn upgrade_database_if_needed(db: &mut Connection, existing_version: u32) ->
|
||||
println!("Existing database version: {}", existing_version);
|
||||
|
||||
if existing_version < CURRENT_DB_VERSION {
|
||||
if existing_version <= 4 {
|
||||
// Completely reset the database
|
||||
db.execute("DROP TABLE IF EXISTS tracks", ())?;
|
||||
db.execute("DROP TABLE IF EXISTS albums", ())?;
|
||||
db.execute("DROP TABLE IF EXISTS artists", ())?;
|
||||
db.execute("DROP TABLE IF EXISTS directories", ())?;
|
||||
db.execute("DROP TABLE IF EXISTS library_data", ())?;
|
||||
db.execute("DROP TABLE IF EXISTS config_data", ())?;
|
||||
}
|
||||
|
||||
if existing_version <= 0 {
|
||||
println!("Mirgate database version 1...");
|
||||
db.pragma_update(None, "journal_mode", "WAL")?;
|
||||
@@ -161,8 +151,14 @@ pub fn upgrade_database_if_needed(db: &mut Connection, existing_version: u32) ->
|
||||
ALTER TABLE albums ADD album_artist_name TEXT;
|
||||
ALTER TABLE albums ADD album_artist_name_lower TEXT;
|
||||
ALTER TABLE config_data ADD theme_mode TEXT DEFAULT 'auto';
|
||||
ALTER TABLE config_data ADD lrclib_instance_url TEXT DEFAULT 'https://lrclib.net';
|
||||
CREATE INDEX idx_albums_album_artist_name_lower ON albums(album_artist_name_lower);
|
||||
CREATE INDEX idx_tracks_track_number ON tracks(track_number);
|
||||
|
||||
DELETE FROM tracks WHERE 1;
|
||||
DELETE FROM albums WHERE 1;
|
||||
DELETE FROM artists WHERE 1;
|
||||
UPDATE library_data SET init = 0 WHERE 1;
|
||||
"})?;
|
||||
|
||||
tx.commit()?;
|
||||
|
||||
@@ -51,6 +51,5 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
},
|
||||
plugins: [require('@tailwindcss/line-clamp')],
|
||||
darkMode: 'class',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user