c5375b661b
broke data out into its own library. may be breaking changes with existing plugins
33 lines
903 B
C#
33 lines
903 B
C#
using System;
|
|
using Data.Context;
|
|
using Data.Extensions;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Data.MigrationContext
|
|
{
|
|
public class MySqlDatabaseContext : DatabaseContext
|
|
{
|
|
public MySqlDatabaseContext()
|
|
{
|
|
if (!MigrationExtensions.IsMigration)
|
|
{
|
|
throw new InvalidOperationException();
|
|
}
|
|
}
|
|
|
|
public MySqlDatabaseContext(DbContextOptions options) : base(options)
|
|
{
|
|
|
|
}
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (MigrationExtensions.IsMigration)
|
|
{
|
|
optionsBuilder.UseMySql("Server=127.0.0.1;Database=IW4MAdmin_Migration;Uid=root;Pwd=password;")
|
|
.EnableDetailedErrors(true)
|
|
.EnableSensitiveDataLogging(true);
|
|
}
|
|
}
|
|
}
|
|
} |