mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
Fixed the issue where exisitng databases would now fail due to the DB structure changes
This commit is contained in:
parent
c773f06d2c
commit
713c0de5f0
4 changed files with 52 additions and 3 deletions
|
@ -25,6 +25,8 @@ namespace Ombi.Store.Context
|
|||
public DbSet<GlobalSettings> Settings { get; set; }
|
||||
public DbSet<ApplicationConfiguration> ApplicationConfigurations { get; set; }
|
||||
|
||||
|
||||
|
||||
public void Seed()
|
||||
{
|
||||
using (var tran = Database.BeginTransaction())
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Ombi.Store.Context.Sqlite
|
||||
{
|
||||
|
@ -10,8 +11,23 @@ namespace Ombi.Store.Context.Sqlite
|
|||
if (_created) return;
|
||||
|
||||
_created = true;
|
||||
Upgrade();
|
||||
Database.SetCommandTimeout(60);
|
||||
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
|
||||
{
|
||||
|
@ -11,8 +12,23 @@ namespace Ombi.Store.Context.Sqlite
|
|||
|
||||
|
||||
_created = true;
|
||||
Upgrade();
|
||||
Database.SetCommandTimeout(60);
|
||||
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
|
||||
{
|
||||
|
@ -10,8 +11,22 @@ namespace Ombi.Store.Context.Sqlite
|
|||
if (_created) return;
|
||||
|
||||
_created = true;
|
||||
Upgrade();
|
||||
Database.SetCommandTimeout(60);
|
||||
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…
Add table
Add a link
Reference in a new issue