Fixed the issue where exisitng databases would now fail due to the DB structure changes

pull/3250/head
tidusjar 5 years ago
parent c773f06d2c
commit 713c0de5f0

@ -25,6 +25,8 @@ namespace Ombi.Store.Context
public DbSet<GlobalSettings> Settings { get; set; } public DbSet<GlobalSettings> Settings { get; set; }
public DbSet<ApplicationConfiguration> ApplicationConfigurations { get; set; } public DbSet<ApplicationConfiguration> ApplicationConfigurations { get; set; }
public void Seed() public void Seed()
{ {
using (var tran = Database.BeginTransaction()) using (var tran = Database.BeginTransaction())

@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore; using System;
using Microsoft.EntityFrameworkCore;
namespace Ombi.Store.Context.Sqlite namespace Ombi.Store.Context.Sqlite
{ {
@ -10,8 +11,23 @@ namespace Ombi.Store.Context.Sqlite
if (_created) return; if (_created) return;
_created = true; _created = true;
Upgrade();
Database.SetCommandTimeout(60); Database.SetCommandTimeout(60);
Database.Migrate(); Database.Migrate();
} }
private void Upgrade()
{
try
{
Database.ExecuteSqlCommand(@"INSERT INTO __EFMigrationsHistory (MigrationId,ProductVersion)
VALUES('20191103205133_Inital', '2.2.6-servicing-10079'); ");
}
catch (Exception)
{
// ignored
}
}
} }
} }

@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore; using System;
using Microsoft.EntityFrameworkCore;
namespace Ombi.Store.Context.Sqlite namespace Ombi.Store.Context.Sqlite
{ {
@ -11,8 +12,23 @@ namespace Ombi.Store.Context.Sqlite
_created = true; _created = true;
Upgrade();
Database.SetCommandTimeout(60); Database.SetCommandTimeout(60);
Database.Migrate(); Database.Migrate();
} }
private void Upgrade()
{
try
{
Database.ExecuteSqlCommand(@"INSERT INTO __EFMigrationsHistory (MigrationId,ProductVersion)
VALUES('20191102235658_Inital', '2.2.6-servicing-10079'); ");
}
catch (Exception)
{
// ignored
}
}
} }
} }

@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore; using System;
using Microsoft.EntityFrameworkCore;
namespace Ombi.Store.Context.Sqlite namespace Ombi.Store.Context.Sqlite
{ {
@ -10,8 +11,22 @@ namespace Ombi.Store.Context.Sqlite
if (_created) return; if (_created) return;
_created = true; _created = true;
Upgrade();
Database.SetCommandTimeout(60); Database.SetCommandTimeout(60);
Database.Migrate(); Database.Migrate();
} }
private void Upgrade()
{
try
{
Database.ExecuteSqlCommand(@"INSERT INTO __EFMigrationsHistory (MigrationId,ProductVersion)
VALUES('20191103205204_Inital', '2.2.6-servicing-10079'); ");
}
catch (Exception)
{
// ignored
}
}
} }
} }
Loading…
Cancel
Save