-
Notifications
You must be signed in to change notification settings - Fork 127
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
Add DatabaseReplayProvider #400
Conversation
757face
to
469f333
Compare
@alvarosevilla95 @agiera Do you guys have any thoughts or comments on this PR and the database schema? |
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.
Hey @vinceau, been a while! Awesome to see this getting added.
The PR looks fantastic tbh. I really like all the decisions on the schema and db manteinance. I wasn't familiar with kysely before, but it looks great honestly. The typings and the query builders are cool, and so is the migration support it seems. Not much to comment on the schema itself, it looks very reasonable (although you know I'd love to eventually add game stats to the schema :D), and the indexing happens very fast even on a large folder.
I only noticed one small slow point. Fetching players by gameId one by one takes about 4 seconds on my 10k games, which is visible when clicking Refresh. Changing the code to do the join in the db using 'folder' speeds it up to 200ms. I pushed a commit to alvarosevilla95@c9dccc1 if you want to cherry-pick
Great stuff, looking forward to seeing this live!
src/replays/database_replay_provider/database_replay_provider.ts
Outdated
Show resolved
Hide resolved
9364ca9
to
43141c3
Compare
Description
This PR aims to finally address #178 by adding the foundation for a database in SQLite3 to store replay information. It uses the implementation
better-sqlite3
and the query builderkysely
. This PR has been made possible by the contributors of the past works in #364 #383 #384. Many thanks to those involved.Notable Changes
Run jest via Electron
Since
better-sqlite3
is a native node module, we need to update the command used to run tests. See this comment to know why. This allows us to run the jest tests with the same node version as Electron.Migrations Handling
We need to package all schema migrations into the package itself for it to be run by
kysely
on the user's machine. To do this:yarn run build:migrations
command, with the process defined inwebpack.config.migrations.prod.ts
release/app/dist/migrations/*.js
files into the extraResources folder, seeelectron-builder.json
extraResources/migrations
folder, otherwise we run it directly from thesrc/database/migrations
folder. See thecreate_database.ts
file for the implementation.Remaining tasks