mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Separate out startup tasks to ensure they run after migrations
This commit is contained in:
@ -51,14 +51,30 @@ namespace osu.Game.Database
|
||||
PerformMigration(reportedVersion.Version, reportedVersion.Version = StoreVersion);
|
||||
|
||||
Connection.InsertOrReplace(reportedVersion);
|
||||
|
||||
StartupTasks();
|
||||
}
|
||||
|
||||
protected virtual void PerformMigration(int currentVersion, int newVersion)
|
||||
/// <summary>
|
||||
/// Called when the database version of this store doesn't match the local version.
|
||||
/// Any manual migration operations should be performed in this.
|
||||
/// </summary>
|
||||
/// <param name="currentVersion">The current store version. This will be zero on a fresh database initialisation.</param>
|
||||
/// <param name="targetVersion">The target version which we are migrating to (equal to the current <see cref="StoreVersion"/>).</param>
|
||||
protected virtual void PerformMigration(int currentVersion, int targetVersion)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prepare this database for use.
|
||||
/// Perform any common startup tasks. Runs after <see cref="Prepare(bool)"/> and <see cref="PerformMigration(int, int)"/>.
|
||||
/// </summary>
|
||||
protected virtual void StartupTasks()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prepare this database for use. Tables should be created here.
|
||||
/// </summary>
|
||||
protected abstract void Prepare(bool reset = false);
|
||||
|
||||
|
Reference in New Issue
Block a user