drift icon indicating copy to clipboard operation
drift copied to clipboard

initialization of DRIFT database on Windows platform

Open francisnnumbi opened this issue 1 year ago • 2 comments

Hi, How do I open connection of sqlite database with drift on Windows platform ? Whenever I run the app, there is an error that tables do not exist. But everything is fine on mobile platform. Thanks

francisnnumbi avatar Jul 06 '23 11:07 francisnnumbi

there is an error that tables do not exist

That sounds like the database file exists already (probably before you've first launched your drift app). Could you check whether the path you've chosen for your drift database may already be in use by another app?

simolus3 avatar Jul 06 '23 20:07 simolus3

I had the same issue, because I copy pasted the "connections/" folder from the example/app into my project. Fix:

Future<File> get databaseFile async {
  // We use `path_provider` to find a suitable path to store our data in.
  final appDir = await getApplicationDocumentsDirectory();
  final dbPath = p.join(appDir.path, 'todos.db');
  return File(dbPath);
}

Rename todos.db to your db name

DonSqualo avatar Jul 19 '23 12:07 DonSqualo

This issue has not had any activity in over a year, closing

dickermoshe avatar Aug 16 '24 06:08 dickermoshe