mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-13 13:22:28 +00:00
* Abstract config design and update logging pattern Also drops legacy config support * Fix unit tests * Make backup of config file when upgrading * Use shared process semaphore to fix migration race conditions * Use mutex because semaphore isn't supported * Make startup wait for configs to load * Move mutex to config load instead of constructor * Add debug logging * Make mutex static * Change mutex name format * Make mutex use global namespace * Remove debug logging and fix config upgrading * Rename lambda variable
22 lines
No EOL
675 B
C#
22 lines
No EOL
675 B
C#
using LBPUnion.ProjectLighthouse.Configuration;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Xunit;
|
|
|
|
namespace LBPUnion.ProjectLighthouse.Tests;
|
|
|
|
public sealed class DatabaseFactAttribute : FactAttribute
|
|
{
|
|
private static readonly object migrateLock = new();
|
|
|
|
public DatabaseFactAttribute()
|
|
{
|
|
ServerConfiguration.Instance.DbConnectionString = "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse";
|
|
if (!ServerStatics.DbConnected) this.Skip = "Database not available";
|
|
else
|
|
lock (migrateLock)
|
|
{
|
|
using Database database = new();
|
|
database.Database.Migrate();
|
|
}
|
|
}
|
|
} |