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 SqliteDatabaseContext : DatabaseContext
|
|
|
|
|
{
|
|
|
|
|
public SqliteDatabaseContext()
|
|
|
|
|
{
|
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 SqliteDatabaseContext(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.UseSqlite("Data Source=IW4MAdmin_Migration.db")
|
|
|
|
|
.EnableDetailedErrors(true)
|
|
|
|
|
.EnableSensitiveDataLogging(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|