Commit 713c0de5 authored by tidusjar's avatar tidusjar

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

parent c773f06d
......@@ -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())
......
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
}
}
}
}
\ No newline at end of file
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
}
}
}
}
\ No newline at end of file
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
}
}
}
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment