mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
chore: fix insert failing to invalid conflict check
This commit is contained in:
parent
ccea4a003d
commit
86f5b80177
@ -97,7 +97,7 @@ class AuthenticationNotifier extends AsyncNotifier<AuthenticationTableData?> {
|
||||
|
||||
await database
|
||||
.into(database.authenticationTable)
|
||||
.insertOnConflictUpdate(refreshedCredentials);
|
||||
.insert(refreshedCredentials, mode: InsertMode.replace);
|
||||
}
|
||||
|
||||
Future<AuthenticationTableCompanion> credentialsFromCookie(
|
||||
|
@ -152,11 +152,12 @@ class SyncedLyricsNotifier extends FamilyAsyncNotifier<SubtitleSimple, Track?> {
|
||||
}
|
||||
|
||||
if (cachedLyrics == null || cachedLyrics.lyrics.isEmpty) {
|
||||
await database.into(database.lyricsTable).insertOnConflictUpdate(
|
||||
await database.into(database.lyricsTable).insert(
|
||||
LyricsTableCompanion.insert(
|
||||
trackId: track.id!,
|
||||
data: lyrics,
|
||||
),
|
||||
mode: InsertMode.replace,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ library spotify;
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:spotube/models/database/database.dart';
|
||||
import 'package:spotube/provider/database/database.dart';
|
||||
import 'package:spotube/provider/spotify/utils/json_cast.dart';
|
||||
|
@ -35,13 +35,14 @@ Future<void> migrateAuthenticationInfo() async {
|
||||
|
||||
if (credentials == null) return;
|
||||
|
||||
await _database.into(_database.authenticationTable).insertOnConflictUpdate(
|
||||
await _database.into(_database.authenticationTable).insert(
|
||||
AuthenticationTableCompanion.insert(
|
||||
accessToken: DecryptedText(credentials.accessToken),
|
||||
cookie: DecryptedText(credentials.cookie),
|
||||
expiration: credentials.expiration,
|
||||
id: const Value(0),
|
||||
),
|
||||
mode: InsertMode.insertOrReplace,
|
||||
);
|
||||
|
||||
AppLogger.log.i("✅ Migrated authentication info");
|
||||
@ -58,7 +59,7 @@ Future<void> migratePreferences() async {
|
||||
|
||||
if (preferences == null) return;
|
||||
|
||||
await _database.into(_database.preferencesTable).insertOnConflictUpdate(
|
||||
await _database.into(_database.preferencesTable).insert(
|
||||
PreferencesTableCompanion.insert(
|
||||
id: const Value(0),
|
||||
accentColorScheme: Value(preferences.accentColorScheme),
|
||||
@ -108,6 +109,7 @@ Future<void> migratePreferences() async {
|
||||
systemTitleBar: Value(preferences.systemTitleBar),
|
||||
themeMode: Value(preferences.themeMode),
|
||||
),
|
||||
mode: InsertMode.replace,
|
||||
);
|
||||
|
||||
AppLogger.log.i("✅ Migrated preferences");
|
||||
@ -235,12 +237,13 @@ Future<void> migrateLastFmCredentials() async {
|
||||
|
||||
if (data == null) return;
|
||||
|
||||
await _database.into(_database.scrobblerTable).insertOnConflictUpdate(
|
||||
await _database.into(_database.scrobblerTable).insert(
|
||||
ScrobblerTableCompanion.insert(
|
||||
id: const Value(0),
|
||||
passwordHash: DecryptedText(data.passwordHash),
|
||||
username: data.username,
|
||||
),
|
||||
mode: InsertMode.replace,
|
||||
);
|
||||
|
||||
AppLogger.log.i("✅ Migrated Last.fm credentials");
|
||||
|
Loading…
Reference in New Issue
Block a user