mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-31 12:00:06 -07:00
Fixed the migration
This commit is contained in:
parent
a40af63a9c
commit
5ecceec06e
3 changed files with 21 additions and 14 deletions
|
@ -17,6 +17,7 @@ namespace Ombi.Store.Context
|
|||
}
|
||||
|
||||
public DbSet<PlexServerContent> PlexServerContent { get; set; }
|
||||
public DbSet<PlexSeasonsContent> PlexSeasonsContent { get; set; }
|
||||
public DbSet<PlexEpisode> PlexEpisode { get; set; }
|
||||
public DbSet<RadarrCache> RadarrCache { get; set; }
|
||||
public DbSet<CouchPotatoCache> CouchPotatoCache { get; set; }
|
||||
|
@ -37,7 +38,7 @@ namespace Ombi.Store.Context
|
|||
{
|
||||
i.StoragePath = string.Empty;
|
||||
}
|
||||
optionsBuilder.UseSqlite($"Data Source={Path.Combine(i.StoragePath, "ExternalOmbi.db")}");
|
||||
optionsBuilder.UseSqlite($"Data Source={Path.Combine(i.StoragePath, "OmbiExternal.db")}");
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace Ombi.Store.Context
|
|||
public DbSet<NotificationTemplates> NotificationTemplates { get; set; }
|
||||
public DbSet<ApplicationConfiguration> ApplicationConfigurations { get; set; }
|
||||
public DbSet<PlexServerContent> PlexServerContent { get; set; }
|
||||
public DbSet<PlexSeasonsContent> PlexSeasonsContent { get; set; }
|
||||
public DbSet<PlexEpisode> PlexEpisode { get; set; }
|
||||
public DbSet<GlobalSettings> Settings { get; set; }
|
||||
public DbSet<RadarrCache> RadarrCache { get; set; }
|
||||
|
|
|
@ -144,9 +144,9 @@ namespace Ombi
|
|||
|
||||
// Now delete the old stuff
|
||||
if (doneGlobal)
|
||||
ombi.Database.ExecuteSqlCommand("TRUNCATE TABLE GlobalSettings");
|
||||
ombi.Database.ExecuteSqlCommand("DELETE FROM GlobalSettings");
|
||||
if (doneConfig)
|
||||
ombi.Database.ExecuteSqlCommand("TRUNCATE TABLE ApplicationConfiguration");
|
||||
ombi.Database.ExecuteSqlCommand("DELETE FROM ApplicationConfiguration");
|
||||
|
||||
}
|
||||
|
||||
|
@ -160,59 +160,64 @@ namespace Ombi
|
|||
if (ombi.PlexEpisode.Any())
|
||||
{
|
||||
external.PlexEpisode.AddRange(ombi.PlexEpisode.ToList());
|
||||
ombi.Database.ExecuteSqlCommand("TRUNCATE TABLE PlexEpisode");
|
||||
ombi.Database.ExecuteSqlCommand("DELETE FROM PlexEpisode");
|
||||
}
|
||||
|
||||
if (ombi.PlexSeasonsContent.Any())
|
||||
{
|
||||
external.PlexSeasonsContent.AddRange(ombi.PlexSeasonsContent.ToList());
|
||||
ombi.Database.ExecuteSqlCommand("DELETE FROM PlexSeasonsContent");
|
||||
}
|
||||
if (ombi.PlexServerContent.Any())
|
||||
{
|
||||
external.PlexServerContent.AddRange(ombi.PlexServerContent.ToList());
|
||||
ombi.Database.ExecuteSqlCommand("TRUNCATE TABLE PlexServerContent");
|
||||
ombi.Database.ExecuteSqlCommand("DELETE FROM PlexServerContent");
|
||||
}
|
||||
if (ombi.EmbyEpisode.Any())
|
||||
{
|
||||
external.EmbyEpisode.AddRange(ombi.EmbyEpisode.ToList());
|
||||
ombi.Database.ExecuteSqlCommand("TRUNCATE TABLE EmbyEpisode");
|
||||
ombi.Database.ExecuteSqlCommand("DELETE FROM EmbyEpisode");
|
||||
}
|
||||
|
||||
if (ombi.EmbyContent.Any())
|
||||
{
|
||||
external.EmbyContent.AddRange(ombi.EmbyContent.ToList());
|
||||
ombi.Database.ExecuteSqlCommand("TRUNCATE TABLE EmbyContent");
|
||||
ombi.Database.ExecuteSqlCommand("DELETE FROM EmbyContent");
|
||||
}
|
||||
if (ombi.RadarrCache.Any())
|
||||
{
|
||||
external.RadarrCache.AddRange(ombi.RadarrCache.ToList());
|
||||
ombi.Database.ExecuteSqlCommand("TRUNCATE TABLE RadarrCache");
|
||||
ombi.Database.ExecuteSqlCommand("DELETE FROM RadarrCache");
|
||||
}
|
||||
if (ombi.SonarrCache.Any())
|
||||
{
|
||||
external.SonarrCache.AddRange(ombi.SonarrCache.ToList());
|
||||
ombi.Database.ExecuteSqlCommand("TRUNCATE TABLE SonarrCache");
|
||||
ombi.Database.ExecuteSqlCommand("DELETE FROM SonarrCache");
|
||||
}
|
||||
if (ombi.LidarrAlbumCache.Any())
|
||||
{
|
||||
external.LidarrAlbumCache.AddRange(ombi.LidarrAlbumCache.ToList());
|
||||
ombi.Database.ExecuteSqlCommand("TRUNCATE TABLE LidarrAlbumCache");
|
||||
ombi.Database.ExecuteSqlCommand("DELETE FROM LidarrAlbumCache");
|
||||
}
|
||||
if (ombi.LidarrArtistCache.Any())
|
||||
{
|
||||
external.LidarrArtistCache.AddRange(ombi.LidarrArtistCache.ToList());
|
||||
ombi.Database.ExecuteSqlCommand("TRUNCATE TABLE LidarrArtistCache");
|
||||
ombi.Database.ExecuteSqlCommand("DELETE FROM LidarrArtistCache");
|
||||
}
|
||||
if (ombi.SickRageEpisodeCache.Any())
|
||||
{
|
||||
external.SickRageEpisodeCache.AddRange(ombi.SickRageEpisodeCache.ToList());
|
||||
ombi.Database.ExecuteSqlCommand("TRUNCATE TABLE SickRageEpisodeCache");
|
||||
ombi.Database.ExecuteSqlCommand("DELETE FROM SickRageEpisodeCache");
|
||||
}
|
||||
if (ombi.SickRageCache.Any())
|
||||
{
|
||||
external.SickRageCache.AddRange(ombi.SickRageCache.ToList());
|
||||
ombi.Database.ExecuteSqlCommand("TRUNCATE TABLE SickRageCache");
|
||||
ombi.Database.ExecuteSqlCommand("DELETE FROM SickRageCache");
|
||||
}
|
||||
if (ombi.CouchPotatoCache.Any())
|
||||
{
|
||||
external.CouchPotatoCache.AddRange(ombi.CouchPotatoCache.ToList());
|
||||
ombi.Database.ExecuteSqlCommand("TRUNCATE TABLE CouchPotatoCache");
|
||||
ombi.Database.ExecuteSqlCommand("DELETE FROM CouchPotatoCache");
|
||||
}
|
||||
|
||||
external.SaveChanges();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue