2020-11-27 22:52:52 -05:00
|
|
|
|
using System;
|
2021-03-22 12:09:25 -04:00
|
|
|
|
using Data.Context;
|
|
|
|
|
using Data.Extensions;
|
2020-11-27 22:52:52 -05:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
2021-03-22 12:09:25 -04:00
|
|
|
|
namespace Data.MigrationContext
|
2020-11-27 22:52:52 -05:00
|
|
|
|
{
|
|
|
|
|
public class MySqlDatabaseContext : DatabaseContext
|
|
|
|
|
{
|
|
|
|
|
public MySqlDatabaseContext()
|
|
|
|
|
{
|
2021-03-22 12:09:25 -04:00
|
|
|
|
if (!MigrationExtensions.IsMigration)
|
2020-11-27 22:52:52 -05:00
|
|
|
|
{
|
|
|
|
|
throw new InvalidOperationException();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-29 17:01:52 -05:00
|
|
|
|
public MySqlDatabaseContext(DbContextOptions options) : base(options)
|
2020-11-27 22:52:52 -05:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
|
|
|
{
|
2021-03-22 12:09:25 -04:00
|
|
|
|
if (MigrationExtensions.IsMigration)
|
2020-11-27 22:52:52 -05:00
|
|
|
|
{
|
|
|
|
|
optionsBuilder.UseMySql("Server=127.0.0.1;Database=IW4MAdmin_Migration;Uid=root;Pwd=password;")
|
|
|
|
|
.EnableDetailedErrors(true)
|
|
|
|
|
.EnableSensitiveDataLogging(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|