Commit Graph

1084 Commits

Author SHA1 Message Date
6ddd2d59d3 Remove EF helper methods 2022-01-18 20:44:26 +09:00
519f7e6ad2 Don't bother with removing from EF as the file is going to be deleted anyway 2022-01-18 19:17:47 +09:00
3b0977903b Use IQueryable directly to avoid insane overheads 2022-01-18 19:17:47 +09:00
49fcff190a Merge branch 'master' into realm-integration/reinit-on-corrupt 2022-01-18 18:02:23 +09:00
7baada2fa6 Merge branch 'master' into realm-integration/safer-migration 2022-01-18 18:01:46 +09:00
246a4a4bfe Add support for starting with a fresh realm database if the existing one is not usable
The most common scenario is switching between schema versions when
testing. This should alleviate the manual overhead of that for the
majority of cases.

For users, this will show a notification on startup if their database
was purged, similar to what we had with EF.
2022-01-18 16:05:13 +09:00
9a43ed742b Update automapper spec in line with v11
See https://docs.automapper.org/en/latest/11.0-Upgrade-Guide.html for
 more details.
2022-01-18 15:23:28 +09:00
1b62a685f3 Merge branch 'master' into realm-integration/score-and-beatmaps 2022-01-18 15:07:59 +09:00
3429fd8768 Fix transaction scope and add even more logging 2022-01-18 14:47:00 +09:00
bf50a9b8f8 Also backup the realm database before migration 2022-01-18 14:30:41 +09:00
2b1c15b6cc Allow BlockAllOperations to be called from a non-update thread if update has never run 2022-01-18 14:30:32 +09:00
cf30d48721 Add more logging during migration process 2022-01-18 14:21:33 +09:00
798482c941 Create backups before deleting scores and beatmaps from EF database 2022-01-18 14:21:33 +09:00
b1a75ce480 Permanently delete client.db after migration completes 2022-01-18 14:17:43 +09:00
a714941f93 Rename EF variable to make reading code easier 2022-01-18 14:06:22 +09:00
a7db793d8c Specify realm pipe path location
I can't confirm this works yet, since I'm not sure what the
preconditions are for the `.note` file to be created. What I can confirm
is that a `.note` file hasn't appeared in my game data directory yet.
2022-01-18 11:43:23 +09:00
2f2c498477 Fix importer not considering that some EF beatmaps have no local metadata 2022-01-14 23:31:42 +09:00
2840a71dda Uncomment EF deletion lines in migrations 2022-01-13 18:28:00 +09:00
b610d2db12 Add EF to realm beatmap migration 2022-01-13 18:23:18 +09:00
45a23e5a43 Add EF to realm score migration 2022-01-13 18:23:18 +09:00
c61419dfe5 Fix scores not using correct filename/display strings
I've updated all cases where we should have been using
`GetDisplayString()` anyway, but left the `ToString()` implementations
in place for safety. They should probably be removed in the future.
2022-01-13 16:56:11 +09:00
dcc354aa7c Fix deleted scores not being cleaned up on next startup 2022-01-13 13:40:09 +09:00
7a81fe19f6 Bump realm schema version to allow upgrades 2022-01-13 13:28:46 +09:00
7baff18764 Add back PerformRead return safety by checking IsManaged status of returned data 2022-01-13 13:14:44 +09:00
085893c9b4 Fix stray bracket 2022-01-13 13:03:57 +09:00
e12025dd48 Cascade delete metadata when beatmaps are deleted 2022-01-12 17:49:11 +09:00
5f7365e8f3 Ensure scores are cleaned up alongside beatmap so they don't have a null reference 2022-01-12 17:49:11 +09:00
f24b2b1be3 Make copying detached changes to realm only exposed for BeatmapSet
Also fixes remaining issues with the copy process.
2022-01-12 17:49:11 +09:00
a4de0f93fa Move manager Update methods to be explicit to where they are still used by legacy code
Also fixes skin hash repopulation being completely broken.
2022-01-12 17:49:11 +09:00
580ad03f8d Combine mapper configurations and add more explanation about special cases 2022-01-12 17:49:11 +09:00
6db3c32dd1 Handle automapper realm cyclic references via AfterMaps
This may not be the cleanest solution, but there don't seem to be any
way towards this either.

- `UseDestinationValue` has been inherited by default as noted in
https://docs.automapper.org/en/stable/10.0-Upgrade-Guide.html#usedestinationvalue-is-now-inherited-by-default, and its behaviour in this case would be using the nested **managed** realm object for the destination member rather than creating an unmanaged version.

- `MaxDepth` already sets `PreserveReferences` so there's no point of using it.

- `MaxDepth` should probably not be set for all maps, only for those with
cyclic references, to avoid the expensive overhead of `PreserveReferences`, as mentioned in https://docs.automapper.org/en/stable/5.0-Upgrade-Guide.html#circular-references.

That aside, `MaxDepth` should actually only be set to `1` for
`BeatmapSetInfo` mapping, because we don't want AutoMapper to create a
nested instance of `BeatmapSetInfo` in each mapped/detached beatmap, but
for some reason, doing that will cause automapper to not map any beatmap
inside the set and leave it with 0 beatmaps.

While on the other hand, using `MaxDepth(2)` for `BeatmapSetInfo` works,
but creates an unused instance of a `BeatmapSetInfo` inside each mapped
beatmap, which may not be ideal.

For `BeatmapInfo`, it has to be `MaxDepth(2)`, in which the first
`BeatmapInfo` depth would be itself (when detaching a beatmap), and the
second would be nested beatmaps inside the mapped/detached
`BeatmapSetInfo` within the beatmap. (note that when detaching a beatmap
set, the unused instance of `BeatmapSetInfo` within each beatmap of that
beatmap set doesn't also have a list of unused beatmaps as one might expect from the depth specification, it surprisingly has 0 beatmaps)

This causes it to create an unused instance of `BeatmapInfo` in the beatmap set resembling the root mapped/detached beatmap, but that one might be inevitable.
2022-01-12 17:49:11 +09:00
e0c59f4b3c Localise EF context factory usage to migration only 2022-01-12 17:49:11 +09:00
f986c3ebd4 Add basic write support via automapper 2022-01-12 17:49:11 +09:00
aaefd72c69 Handle ignored mappings locally in Detach configuration 2022-01-12 17:00:17 +09:00
2b8706b6ce Detach and reattach scores to make work 2022-01-12 17:00:16 +09:00
8461eaab46 BeatmapSetInfo detach support 2022-01-12 17:00:16 +09:00
fe8a5e867d Remove updated/removed flow method mapping 2022-01-12 17:00:16 +09:00
8d943b5709 Fix many shortcomings and compatibility issues with EF classes post-rename 2022-01-12 17:00:16 +09:00
00e3af3366 Update model manager and many related classes to get things compiling again 2022-01-12 17:00:00 +09:00
d70e292828 Remove old EF classes 2022-01-12 16:57:27 +09:00
2a4bee61dd Update many score-related classes to move closer to being able to persist to realm 2022-01-12 16:57:27 +09:00
3da762e145 Replace EF ScoreInfo with realm version
May contain errors.
2022-01-12 16:57:27 +09:00
b8cd3cdbbc Various updates to ruleset and primary key usages to move closer to realm support 2022-01-12 16:57:13 +09:00
3ecd889fef Replace EF RulesetStore with realm version
Pass full EF context factory to `RealmContextFactory` for migration purposes
2022-01-12 16:39:36 +09:00
618903c217 Rename realm to become imposter classes 2022-01-12 16:39:36 +09:00
0b6c4497bd Rename EF classes to allow for shit to hit the fan 2022-01-12 16:39:36 +09:00
af9fad00c3 Merge branch 'master' into async-deadlock-safety 2022-01-10 16:11:09 +09:00
d072f1d08d Add mention to detach methods of only running once 2022-01-10 13:09:26 +09:00
00177a3ae1 Update usages to new naming 2022-01-06 22:54:43 +09:00
3ea7588a91 Update continuation usages to use GetCompletedResult 2022-01-06 22:53:07 +09:00