c5375b661b
broke data out into its own library. may be breaking changes with existing plugins
34 lines
1.0 KiB
C#
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);
|
|
}
|
|
}
|
|
}
|
|
} |