Do not auto migrate database.

This commit is contained in:
2019-12-07 18:08:11 +00:00
parent e6f5b0f9ca
commit e55eeb5ed7

View File

@@ -37,10 +37,7 @@ namespace DiscImageChef.Database
{ {
public sealed class DicContext : DbContext public sealed class DicContext : DbContext
{ {
public DicContext(DbContextOptions options) : base(options) public DicContext(DbContextOptions options) : base(options) { }
{
Database.Migrate();
}
public DbSet<Device> Devices { get; set; } public DbSet<Device> Devices { get; set; }
public DbSet<Report> Reports { get; set; } public DbSet<Report> Reports { get; set; }
@@ -56,12 +53,14 @@ namespace DiscImageChef.Database
public DbSet<UsbVendor> UsbVendors { get; set; } public DbSet<UsbVendor> UsbVendors { get; set; }
public DbSet<UsbProduct> UsbProducts { get; set; } public DbSet<UsbProduct> UsbProducts { get; set; }
public DbSet<CdOffset> CdOffsets { get; set; } public DbSet<CdOffset> CdOffsets { get; set; }
// Note: If table does not appear check that last migration has been REALLY added to the project // Note: If table does not appear check that last migration has been REALLY added to the project
public static DicContext Create(string dbPath) public static DicContext Create(string dbPath)
{ {
DbContextOptionsBuilder optionsBuilder = new DbContextOptionsBuilder(); var optionsBuilder = new DbContextOptionsBuilder();
optionsBuilder.UseSqlite($"Data Source={dbPath}"); optionsBuilder.UseSqlite($"Data Source={dbPath}");
return new DicContext(optionsBuilder.Options); return new DicContext(optionsBuilder.Options);
} }
} }