-
Notifications
You must be signed in to change notification settings - Fork 200
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
Migrate DB to SQLite #793
Comments
I was checking sqlx and it's like pg for Js. We could create a class based on it and then make the configuration so we just need to import and use it. But the boilerplate is quite big and when the queries get bigger it doesn't get any easier. Would be nice something like sqlc, that generates code while we write plain old sql still. But I don't know if it works with rust. SQLite doesn't get corrupt? There should be a way to check the DB status and then be able to restore it from backup. |
I really like the level of abstraction Sequelite provides (https://github.com/siddiqus/sequelite), but I played a bit with it and it's a bit immature (all ints need to be signed, no support for JSON field, etc. Going for a more complex solution like an ORM like seaorm, diesel is also feasible, but it's quite heavy for the simplicity of Museeks' DB. Regarding corruption, we should be fine, it depends on the Pragma we use with SQLite iiuc. |
So far, I'm playing with Rusqlite (basically like sqlx, but a bit more simple and more tailored for SQLite). In the end, using raw sql for now is ok, and switching to something higher level later would be a cherry on top. |
Check this Prisma. |
Yep, I looked at it and it looks great on paper, unfortunately, it does not seem maintained: Brendonovich/prisma-client-rust#468 (comment) Maybe it's stable enough to use though. Ah, and this is an issue imho:
|
are interesting options |
Diesel is broadly used, actively maintained, and has stood the test of time. Platform-agnostic when enabling the With Rusqlite you have to manage migrations yourself. |
Well, I liked |
I really like ormlite too, I'll need to check two things though: run migrations on startup, and connect to a local DB without an env car (or set the env car on startup) |
Will it run on memory or on a file in disk? |
It needs to be persisted, so on disk. |
Boom. Everything should be working as before. I'll test things more extensively in the next days. It should be possible to unit test all the DB helpers, which would be great to add. |
I would like to migrate our DB (again!) to SQLite. Possible before the final release for Museeks Tauri.
SQLite would allow us to fully separate the back-end from the storage layer, as the back-end could be re-written in something else. Also, it would mean people could query the database themselves, etc.
I had a look at many crates to handle SQLite, from diesel to sea_orm to raw sqlite, and I was satisfied with none:
If anyone has experience with SQLite and rust, please wave :)
This is all assuming performances are ok.
The text was updated successfully, but these errors were encountered: