Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It uses TypeORM. I opted to go with that one because it supports enum. So there's really minimal changes made to the ipc logic currently. But I think it's a good start that keeps things flexible. It still needs to support player stats before it's PR ready, but I wanted to check if this is the direction we want to go before investing more time.
One thing to note is that I have the sqlite db live in the replays folder. I'm not sure where a good place for it is. It might be nice to have it in replays so that if you copy slippi replay dirs to another computer the cache still works. It doesn't currently update without a restart though.
TypeORM doesn't handle nested queries as well as I hoped it would. I might try rewriting this solution using prisma and just use Int as the type instead of enum. Hopefully that will work out of the box instead of casting.
Another question that was brought up is if we should use a query builder like https://github.com/kysely-org/kysely instead. I'm not sure I understand the advantages. Is it easier to maintain?
Some things I think this solution needs before merging are:
a. Filtering the filenames by whether their in the db and then doing a bulk insert for the ones that aren't in there. Right now it's using bad form and just spamming queries.
b. Support for player stats (create entity and integrate into ipc code)
c. Deciding on where to put db file. If it's staying with replays we should change the filename to
.index.sqlite3
so it's hidden and also use relative paths as the primary key.Is there anything I'm missing?
a. Modify UI to use ORM and change workers to return void
b. Implement infinite scrolling to avoid loading all data at once
c. Global stats
d. ect.