-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Core: Migrate from sqflite
to drift
packages
#1266
Conversation
Alright, this should be ready now! I believe I've tested as many cases as I could (both on emulator and on my physical device). Everything seems to look okay from what I can see. For now, I've opted to not remove the original database just in case it needs to be restored. The "Delete Local Database" action in Settings only deletes the new database (for now) as a way to test migration. @micahmo If you are able to, could you try this out and let me know if you encounter any issues on your end? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code LGTM! I did a very brief test (basically just running the app) and things seem to be working ok!
I'll go ahead and merge this in. I'll generate a nightly build with the current changes, and give a week for any last minute fixes before I finalize 0.3.0 for general release! |
@hjiangsu I noticed one issue so far. If you use the temporary account switcher, it seems to lose the actual account afterwards on the account page. The drawer and switcher are still correct. qemu-system-x86_64_5h5YEyvBbp.mp4Let me know if you want me to look at this (since I worked on the temp account switcher) or you (since you added the new db). |
Hmm, I can take a quick look at this! |
Update: I don't think this is directly related to the DB changes. It seems like it's an issue with the When we switch accounts, this line triggers in emit(state.copyWith(status: AuthStatus.loading, isLoggedIn: false)); Since When we restore the original user, |
I believe the easiest solution for now would be to remove the I did try some other alternatives but they caused issues with reloading the proper user when temporarily switching accounts, etc. I think a longer term solution for this would likely have to do with merging AccountBloc and AuthBloc together into one to make it easier to manage changes in account states. |
Thanks so much for taking a look at this! If it's not related to the db upgrade then I can look further as well. I think I had added Here's what it looks like now. qemu-system-x86_64_7TSFpuN5oL.mp4And here's what it looks like with those lines. Not the end of the world, but not super clean either. qemu-system-x86_64_XSIYNpo7tM.mp4Do you think it's worth my time to do any further investigation, or should we just remove those lines? |
You can give it a shot if you'd like to find an alternate solution! I don't think its a particularly large issue since this use-case won't be triggered often, but having smoother transitions is always good. |
Quick update! First, you are right that this doesn't seem to be related to the new db. I was able to repro in a commit before that change. It's just a very specific sequence of steps that I might have never tried before.
Lastly, I think you were right that the initial |
Pull Request Description
This PR migrates our use of
sqflite
to drift. In short, Drift is a library that builds on top of SQLite to provide some really useful features, including:This is part of a bigger picture which will allow us to provide an offline experience (#322) and other improvements. While using the existing
sqflite
would work for these purposes, it's much more difficult to accomplish due to the fact that we have to write raw SQL queries, and create classes for each of the associated tables. Having to do this hinders the DX and makes it more tedious to accomplish.I'm hoping that this solution will help mitigate those issues.
This migration will likely happen in multiple stages:
Account
,Favorite
, andLocalCommunity
models in favour of the autogen classes provided by drift, and refactoring parts of the code to use the new autogenerated classes.Update: I've created some tests to check proper migration
Issue Being Fixed
Issue Number: N/A
Screenshots / Recordings
Checklist
semanticLabel
s where applicable for accessibility?