mirror of
https://github.com/austinried/subtracks.git
synced 2025-12-27 00:59:28 +01:00
fix temp db seed
This commit is contained in:
parent
805e6fff7a
commit
c3bb14edbf
@ -1,4 +1,4 @@
|
||||
import 'package:drift/drift.dart' show Value;
|
||||
import 'package:drift/drift.dart' show InsertMode, Value;
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
import '../../database/database.dart';
|
||||
@ -7,17 +7,24 @@ final databaseInitializer = FutureProvider<SubtracksDatabase>((ref) async {
|
||||
final db = SubtracksDatabase();
|
||||
|
||||
await db
|
||||
.into(db.sources)
|
||||
.insertOnConflictUpdate(
|
||||
.batch((batch) {
|
||||
batch.insertAll(
|
||||
db.sources,
|
||||
[
|
||||
SourcesCompanion.insert(
|
||||
id: Value(1),
|
||||
name: 'test subsonic',
|
||||
// isActive: Value(true),
|
||||
isActive: Value(true),
|
||||
),
|
||||
SourcesCompanion.insert(
|
||||
id: Value(2),
|
||||
name: 'test navidrome',
|
||||
isActive: Value(null),
|
||||
),
|
||||
],
|
||||
mode: InsertMode.insertOrIgnore,
|
||||
);
|
||||
await db
|
||||
.into(db.subsonicSettings)
|
||||
.insertOnConflictUpdate(
|
||||
batch.insertAllOnConflictUpdate(db.subsonicSettings, [
|
||||
SubsonicSettingsCompanion.insert(
|
||||
sourceId: Value(1),
|
||||
address: Uri.parse('http://demo.subsonic.org'),
|
||||
@ -25,19 +32,6 @@ final databaseInitializer = FutureProvider<SubtracksDatabase>((ref) async {
|
||||
password: 'guest',
|
||||
useTokenAuth: Value(true),
|
||||
),
|
||||
);
|
||||
await db
|
||||
.into(db.sources)
|
||||
.insertOnConflictUpdate(
|
||||
SourcesCompanion.insert(
|
||||
id: Value(2),
|
||||
name: 'test navidrome',
|
||||
// isActive: Value(null),
|
||||
),
|
||||
);
|
||||
await db
|
||||
.into(db.subsonicSettings)
|
||||
.insertOnConflictUpdate(
|
||||
SubsonicSettingsCompanion.insert(
|
||||
sourceId: Value(2),
|
||||
address: Uri.parse('http://10.0.2.2:4533'),
|
||||
@ -45,7 +39,11 @@ final databaseInitializer = FutureProvider<SubtracksDatabase>((ref) async {
|
||||
password: 'password',
|
||||
useTokenAuth: Value(true),
|
||||
),
|
||||
);
|
||||
]);
|
||||
})
|
||||
.onError((error, stack) {
|
||||
print(error);
|
||||
});
|
||||
|
||||
return db;
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user