drift icon indicating copy to clipboard operation
drift copied to clipboard

drift_flutter force to use ".sqlite" suffix

Open lucasdidur opened this issue 1 year ago • 1 comments

Because of

return File(p.join(dbFolder.path, '$name.sqlite'));

Old databases can't not be changed or reused if the old file does not contains .sqlite. So old database and data is lost (my case).

Solution:

Add a named parameter extension or remove the '.sqlite' part.

lucasdidur avatar Dec 03 '24 18:12 lucasdidur

You can use driftDatabase(native: DriftNativeOptions(databasePath: () async => ...)) to migrate to drift_flutter while otherwise keeping your existing database path.

I will update the documentation to mention how to migrate from the old setup to drift_flutter, but I'm not sure where to put it yet.

simolus3 avatar Dec 04 '24 11:12 simolus3