IW4M-Admin/Data/MigrationContext/PostgresqlDatabaseContext.cs
RaidMax c5375b661b huge commit for advanced stats feature.
broke data out into its own library.
may be breaking changes with existing plugins
2021-03-22 11:09:25 -05:00

34 lines
1.0 KiB
C#

using System;
using Data.Context;
using Data.Extensions;
using Microsoft.EntityFrameworkCore;
namespace Data.MigrationContext
{
public class PostgresqlDatabaseContext : DatabaseContext
{
public PostgresqlDatabaseContext()
{
if (!MigrationExtensions.IsMigration)
{
throw new InvalidOperationException();
}
}
public PostgresqlDatabaseContext(DbContextOptions options) : base(options)
{
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (MigrationExtensions.IsMigration)
{
optionsBuilder.UseNpgsql(
"Host=127.0.0.1;Database=IW4MAdmin_Migration;Username=postgres;Password=password;",
options => options.SetPostgresVersion(new Version("9.4")))
.EnableDetailedErrors(true)
.EnableSensitiveDataLogging(true);
}
}
}
}