mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-06 13:11:13 -07:00
feat: Adding postgres support to ombi (beta) (#5050)
This commit is contained in:
parent
8ff7d9995d
commit
f8c61027bf
22 changed files with 5660 additions and 12 deletions
|
@ -300,13 +300,13 @@ namespace Ombi.Core.Tests.Engine
|
|||
{
|
||||
UserId = "id1",
|
||||
RequestType = RequestType.Movie,
|
||||
RequestDate = today.AddHours(-1),
|
||||
RequestDate = today.AddMinutes(-1),
|
||||
},
|
||||
new RequestLog
|
||||
{
|
||||
UserId = "id1",
|
||||
RequestType = RequestType.Movie,
|
||||
RequestDate = today.AddHours(-2),
|
||||
RequestDate = today.AddMinutes(-2),
|
||||
},
|
||||
};
|
||||
var repoMock = _mocker.GetMock<IRepository<RequestLog>>();
|
||||
|
|
|
@ -298,13 +298,13 @@ namespace Ombi.Core.Tests.Engine
|
|||
{
|
||||
UserId = "id1",
|
||||
RequestType = RequestType.Album,
|
||||
RequestDate = today.AddHours(-1),
|
||||
RequestDate = today.AddMinutes(-1),
|
||||
},
|
||||
new RequestLog
|
||||
{
|
||||
UserId = "id1",
|
||||
RequestType = RequestType.Album,
|
||||
RequestDate = today.AddHours(-2),
|
||||
RequestDate = today.AddMinutes(-2),
|
||||
},
|
||||
};
|
||||
var repoMock = _mocker.GetMock<IRepository<RequestLog>>();
|
||||
|
|
|
@ -304,7 +304,7 @@ namespace Ombi.Core.Tests.Engine
|
|||
{
|
||||
UserId = "id1",
|
||||
RequestType = RequestType.TvShow,
|
||||
RequestDate = today.AddHours(-1),
|
||||
RequestDate = today.AddMinutes(-1),
|
||||
EpisodeCount = 1,
|
||||
},
|
||||
new RequestLog
|
||||
|
@ -312,7 +312,7 @@ namespace Ombi.Core.Tests.Engine
|
|||
UserId = "id1",
|
||||
RequestType = RequestType.TvShow,
|
||||
EpisodeCount = 1,
|
||||
RequestDate = today.AddHours(-2),
|
||||
RequestDate = today.AddMinutes(-2),
|
||||
},
|
||||
};
|
||||
var repoMock = _mocker.GetMock<IRepository<RequestLog>>();
|
||||
|
@ -345,7 +345,7 @@ namespace Ombi.Core.Tests.Engine
|
|||
{
|
||||
UserId = "id1",
|
||||
RequestType = RequestType.TvShow,
|
||||
RequestDate = today.AddHours(-1),
|
||||
RequestDate = today.AddMinutes(-1),
|
||||
EpisodeCount = 5,
|
||||
},
|
||||
new RequestLog
|
||||
|
@ -353,7 +353,7 @@ namespace Ombi.Core.Tests.Engine
|
|||
UserId = "id1",
|
||||
RequestType = RequestType.TvShow,
|
||||
EpisodeCount = 4,
|
||||
RequestDate = today.AddHours(-2),
|
||||
RequestDate = today.AddMinutes(-2),
|
||||
},
|
||||
};
|
||||
var repoMock = _mocker.GetMock<IRepository<RequestLog>>();
|
||||
|
|
|
@ -91,12 +91,12 @@ namespace Ombi.Schedule.Tests
|
|||
new Issues
|
||||
{
|
||||
Status = IssueStatus.Resolved,
|
||||
ResovledDate = DateTime.Now.AddDays(-2)
|
||||
ResovledDate = DateTime.UtcNow.AddDays(-2)
|
||||
},
|
||||
new Issues
|
||||
{
|
||||
Status = IssueStatus.Resolved,
|
||||
ResovledDate = DateTime.Now.AddDays(-4)
|
||||
ResovledDate = DateTime.UtcNow.AddDays(-4)
|
||||
}
|
||||
};
|
||||
|
||||
|
|
16
src/Ombi.Store/Context/Postgres/ExternalPostgresContext.cs
Normal file
16
src/Ombi.Store/Context/Postgres/ExternalPostgresContext.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Ombi.Store.Context.Postgres
|
||||
{
|
||||
public sealed class ExternalPostgresContext : ExternalContext
|
||||
{
|
||||
private static bool _created;
|
||||
public ExternalPostgresContext(DbContextOptions<ExternalPostgresContext> options) : base(options)
|
||||
{
|
||||
if (_created) return;
|
||||
|
||||
_created = true;
|
||||
Database.Migrate();
|
||||
}
|
||||
}
|
||||
}
|
22
src/Ombi.Store/Context/Postgres/OmbiPostgresContext.cs
Normal file
22
src/Ombi.Store/Context/Postgres/OmbiPostgresContext.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Ombi.Store.Context.Postgres
|
||||
{
|
||||
public sealed class OmbiPostgresContext : OmbiContext
|
||||
{
|
||||
private static bool _created;
|
||||
|
||||
public OmbiPostgresContext(DbContextOptions<OmbiPostgresContext> options) : base(options)
|
||||
{
|
||||
if (_created) return;
|
||||
_created = true;
|
||||
|
||||
Database.Migrate();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
17
src/Ombi.Store/Context/Postgres/PostgresModuleInitializer.cs
Normal file
17
src/Ombi.Store/Context/Postgres/PostgresModuleInitializer.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ombi.Store.Context.Postgres;
|
||||
|
||||
public static class PostgresModuleInitializer
|
||||
{
|
||||
#pragma warning disable CA2255
|
||||
// This is required to ensure that Npgsql uses a timestamp behavior that does not require a timezone
|
||||
// Reference: https://stackoverflow.com/a/73586129
|
||||
[ModuleInitializer]
|
||||
#pragma warning restore CA2255
|
||||
public static void Initialize()
|
||||
{
|
||||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||
}
|
||||
}
|
16
src/Ombi.Store/Context/Postgres/SettingsPostgresContext.cs
Normal file
16
src/Ombi.Store/Context/Postgres/SettingsPostgresContext.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Ombi.Store.Context.Postgres
|
||||
{
|
||||
public sealed class SettingsPostgresContext : SettingsContext
|
||||
{
|
||||
private static bool _created;
|
||||
public SettingsPostgresContext(DbContextOptions<SettingsPostgresContext> options) : base(options)
|
||||
{
|
||||
if (_created) return;
|
||||
|
||||
_created = true;
|
||||
Database.Migrate();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,5 +20,13 @@ INSERT INTO AspNetRoles(Id, ConcurrencyStamp, Name, NormalizedName)
|
|||
SELECT '{Guid.NewGuid()}','{Guid.NewGuid()}','{role}', '{role.ToUpper()}'
|
||||
WHERE NOT EXISTS(SELECT 1 FROM AspNetRoles WHERE Name = '{role}');");
|
||||
}
|
||||
|
||||
public static void InsertRolePostgres(this MigrationBuilder mb, string role)
|
||||
{
|
||||
mb.Sql($@"
|
||||
INSERT INTO public.""AspNetRoles""(""Id"", ""ConcurrencyStamp"", ""Name"", ""NormalizedName"")
|
||||
SELECT '{Guid.NewGuid()}','{Guid.NewGuid()}','{role}', '{role.ToUpper()}'
|
||||
WHERE NOT EXISTS(SELECT 1 FROM public.""AspNetRoles"" WHERE ""Name"" = '{role}');");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
628
src/Ombi.Store/Migrations/ExternalPostgres/20231212135426_Initial.Designer.cs
generated
Normal file
628
src/Ombi.Store/Migrations/ExternalPostgres/20231212135426_Initial.Designer.cs
generated
Normal file
|
@ -0,0 +1,628 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Ombi.Store.Context.Postgres;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Ombi.Store.Migrations.ExternalPostgres
|
||||
{
|
||||
[DbContext(typeof(ExternalPostgresContext))]
|
||||
[Migration("20231212135426_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.22")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.CouchPotatoCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("TheMovieDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("CouchPotatoCache");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.EmbyContent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("AddedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("EmbyId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Has4K")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ImdbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Quality")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TheMovieDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TvDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("EmbyContent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("AddedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("EmbyId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("EpisodeNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ImdbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ParentId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("TheMovieDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TvDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ParentId");
|
||||
|
||||
b.ToTable("EmbyEpisode");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.JellyfinContent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("AddedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("Has4K")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ImdbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("JellyfinId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Quality")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TheMovieDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TvDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("JellyfinContent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.JellyfinEpisode", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("AddedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("EpisodeNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ImdbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("JellyfinId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ParentId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("TheMovieDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TvDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ParentId");
|
||||
|
||||
b.ToTable("JellyfinEpisode");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.LidarrAlbumCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("AddedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("ArtistId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ForeignAlbumId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Monitored")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<decimal>("PercentOfTracks")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<DateTime>("ReleaseDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("TrackCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("LidarrAlbumCache");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.LidarrArtistCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ArtistId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ArtistName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ForeignArtistId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Monitored")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("LidarrArtistCache");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("EpisodeNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("GrandparentKey")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ParentKey")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GrandparentKey");
|
||||
|
||||
b.ToTable("PlexEpisode");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ParentKey")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PlexContentId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("PlexServerContentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SeasonKey")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PlexServerContentId");
|
||||
|
||||
b.ToTable("PlexSeasonsContent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexServerContent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("AddedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("Has4K")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ImdbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Quality")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ReleaseYear")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("RequestId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("TheMovieDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TvDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("PlexServerContent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexWatchlistHistory", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("TmdbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("PlexWatchlistHistory");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.RadarrCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Has4K")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("HasFile")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("HasRegular")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("TheMovieDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RadarrCache");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.SickRageCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("TvDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SickRageCache");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.SickRageEpisodeCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("EpisodeNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TvDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SickRageEpisodeCache");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.SonarrCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("TheMovieDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TvDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SonarrCache");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.SonarrEpisodeCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("EpisodeNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("HasFile")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("MovieDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TvDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SonarrEpisodeCache");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.UserPlayedEpisode", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("EpisodeNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TheMovieDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("UserPlayedEpisode");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.UserPlayedMovie", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("TheMovieDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("UserPlayedMovie");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.EmbyContent", "Series")
|
||||
.WithMany("Episodes")
|
||||
.HasForeignKey("ParentId")
|
||||
.HasPrincipalKey("EmbyId");
|
||||
|
||||
b.Navigation("Series");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.JellyfinEpisode", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.JellyfinContent", "Series")
|
||||
.WithMany("Episodes")
|
||||
.HasForeignKey("ParentId")
|
||||
.HasPrincipalKey("JellyfinId");
|
||||
|
||||
b.Navigation("Series");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.PlexServerContent", "Series")
|
||||
.WithMany("Episodes")
|
||||
.HasForeignKey("GrandparentKey")
|
||||
.HasPrincipalKey("Key");
|
||||
|
||||
b.Navigation("Series");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.PlexServerContent", null)
|
||||
.WithMany("Seasons")
|
||||
.HasForeignKey("PlexServerContentId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.EmbyContent", b =>
|
||||
{
|
||||
b.Navigation("Episodes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.JellyfinContent", b =>
|
||||
{
|
||||
b.Navigation("Episodes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexServerContent", b =>
|
||||
{
|
||||
b.Navigation("Episodes");
|
||||
|
||||
b.Navigation("Seasons");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,430 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Ombi.Store.Migrations.ExternalPostgres
|
||||
{
|
||||
public partial class Initial : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CouchPotatoCache",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
TheMovieDbId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CouchPotatoCache", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EmbyContent",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ProviderId = table.Column<string>(type: "text", nullable: true),
|
||||
EmbyId = table.Column<string>(type: "text", nullable: false),
|
||||
Title = table.Column<string>(type: "text", nullable: true),
|
||||
ImdbId = table.Column<string>(type: "text", nullable: true),
|
||||
TvDbId = table.Column<string>(type: "text", nullable: true),
|
||||
TheMovieDbId = table.Column<string>(type: "text", nullable: true),
|
||||
Type = table.Column<int>(type: "integer", nullable: false),
|
||||
Quality = table.Column<string>(type: "text", nullable: true),
|
||||
Has4K = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Url = table.Column<string>(type: "text", nullable: true),
|
||||
AddedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EmbyContent", x => x.Id);
|
||||
table.UniqueConstraint("AK_EmbyContent_EmbyId", x => x.EmbyId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "JellyfinContent",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ProviderId = table.Column<string>(type: "text", nullable: true),
|
||||
JellyfinId = table.Column<string>(type: "text", nullable: false),
|
||||
Title = table.Column<string>(type: "text", nullable: true),
|
||||
ImdbId = table.Column<string>(type: "text", nullable: true),
|
||||
TvDbId = table.Column<string>(type: "text", nullable: true),
|
||||
TheMovieDbId = table.Column<string>(type: "text", nullable: true),
|
||||
Type = table.Column<int>(type: "integer", nullable: false),
|
||||
Quality = table.Column<string>(type: "text", nullable: true),
|
||||
Has4K = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Url = table.Column<string>(type: "text", nullable: true),
|
||||
AddedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_JellyfinContent", x => x.Id);
|
||||
table.UniqueConstraint("AK_JellyfinContent_JellyfinId", x => x.JellyfinId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "LidarrAlbumCache",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ArtistId = table.Column<int>(type: "integer", nullable: false),
|
||||
ForeignAlbumId = table.Column<string>(type: "text", nullable: true),
|
||||
TrackCount = table.Column<int>(type: "integer", nullable: false),
|
||||
ReleaseDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
Monitored = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Title = table.Column<string>(type: "text", nullable: true),
|
||||
PercentOfTracks = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
AddedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LidarrAlbumCache", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "LidarrArtistCache",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ArtistId = table.Column<int>(type: "integer", nullable: false),
|
||||
ArtistName = table.Column<string>(type: "text", nullable: true),
|
||||
ForeignArtistId = table.Column<string>(type: "text", nullable: true),
|
||||
Monitored = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LidarrArtistCache", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PlexServerContent",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ReleaseYear = table.Column<string>(type: "text", nullable: true),
|
||||
Key = table.Column<string>(type: "text", nullable: false),
|
||||
RequestId = table.Column<int>(type: "integer", nullable: true),
|
||||
Title = table.Column<string>(type: "text", nullable: true),
|
||||
ImdbId = table.Column<string>(type: "text", nullable: true),
|
||||
TvDbId = table.Column<string>(type: "text", nullable: true),
|
||||
TheMovieDbId = table.Column<string>(type: "text", nullable: true),
|
||||
Type = table.Column<int>(type: "integer", nullable: false),
|
||||
Quality = table.Column<string>(type: "text", nullable: true),
|
||||
Has4K = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Url = table.Column<string>(type: "text", nullable: true),
|
||||
AddedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlexServerContent", x => x.Id);
|
||||
table.UniqueConstraint("AK_PlexServerContent_Key", x => x.Key);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PlexWatchlistHistory",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
TmdbId = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlexWatchlistHistory", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RadarrCache",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
TheMovieDbId = table.Column<int>(type: "integer", nullable: false),
|
||||
HasFile = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Has4K = table.Column<bool>(type: "boolean", nullable: false),
|
||||
HasRegular = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RadarrCache", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SickRageCache",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
TvDbId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SickRageCache", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SickRageEpisodeCache",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
SeasonNumber = table.Column<int>(type: "integer", nullable: false),
|
||||
EpisodeNumber = table.Column<int>(type: "integer", nullable: false),
|
||||
TvDbId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SickRageEpisodeCache", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SonarrCache",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
TvDbId = table.Column<int>(type: "integer", nullable: false),
|
||||
TheMovieDbId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SonarrCache", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SonarrEpisodeCache",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
SeasonNumber = table.Column<int>(type: "integer", nullable: false),
|
||||
EpisodeNumber = table.Column<int>(type: "integer", nullable: false),
|
||||
TvDbId = table.Column<int>(type: "integer", nullable: false),
|
||||
MovieDbId = table.Column<int>(type: "integer", nullable: false),
|
||||
HasFile = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SonarrEpisodeCache", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UserPlayedEpisode",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
TheMovieDbId = table.Column<int>(type: "integer", nullable: false),
|
||||
SeasonNumber = table.Column<int>(type: "integer", nullable: false),
|
||||
EpisodeNumber = table.Column<int>(type: "integer", nullable: false),
|
||||
UserId = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_UserPlayedEpisode", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UserPlayedMovie",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
TheMovieDbId = table.Column<int>(type: "integer", nullable: false),
|
||||
UserId = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_UserPlayedMovie", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EmbyEpisode",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
EmbyId = table.Column<string>(type: "text", nullable: true),
|
||||
ParentId = table.Column<string>(type: "text", nullable: true),
|
||||
ProviderId = table.Column<string>(type: "text", nullable: true),
|
||||
AddedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
TvDbId = table.Column<string>(type: "text", nullable: true),
|
||||
ImdbId = table.Column<string>(type: "text", nullable: true),
|
||||
TheMovieDbId = table.Column<string>(type: "text", nullable: true),
|
||||
EpisodeNumber = table.Column<int>(type: "integer", nullable: false),
|
||||
SeasonNumber = table.Column<int>(type: "integer", nullable: false),
|
||||
Title = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EmbyEpisode", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_EmbyEpisode_EmbyContent_ParentId",
|
||||
column: x => x.ParentId,
|
||||
principalTable: "EmbyContent",
|
||||
principalColumn: "EmbyId");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "JellyfinEpisode",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
JellyfinId = table.Column<string>(type: "text", nullable: true),
|
||||
ParentId = table.Column<string>(type: "text", nullable: true),
|
||||
ProviderId = table.Column<string>(type: "text", nullable: true),
|
||||
AddedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
TvDbId = table.Column<string>(type: "text", nullable: true),
|
||||
ImdbId = table.Column<string>(type: "text", nullable: true),
|
||||
TheMovieDbId = table.Column<string>(type: "text", nullable: true),
|
||||
EpisodeNumber = table.Column<int>(type: "integer", nullable: false),
|
||||
SeasonNumber = table.Column<int>(type: "integer", nullable: false),
|
||||
Title = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_JellyfinEpisode", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_JellyfinEpisode_JellyfinContent_ParentId",
|
||||
column: x => x.ParentId,
|
||||
principalTable: "JellyfinContent",
|
||||
principalColumn: "JellyfinId");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PlexEpisode",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Key = table.Column<string>(type: "text", nullable: true),
|
||||
ParentKey = table.Column<string>(type: "text", nullable: true),
|
||||
GrandparentKey = table.Column<string>(type: "text", nullable: true),
|
||||
EpisodeNumber = table.Column<int>(type: "integer", nullable: false),
|
||||
SeasonNumber = table.Column<int>(type: "integer", nullable: false),
|
||||
Title = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlexEpisode", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PlexEpisode_PlexServerContent_GrandparentKey",
|
||||
column: x => x.GrandparentKey,
|
||||
principalTable: "PlexServerContent",
|
||||
principalColumn: "Key");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PlexSeasonsContent",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
PlexContentId = table.Column<string>(type: "text", nullable: true),
|
||||
SeasonNumber = table.Column<int>(type: "integer", nullable: false),
|
||||
SeasonKey = table.Column<string>(type: "text", nullable: true),
|
||||
ParentKey = table.Column<string>(type: "text", nullable: true),
|
||||
PlexServerContentId = table.Column<int>(type: "integer", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlexSeasonsContent", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PlexSeasonsContent_PlexServerContent_PlexServerContentId",
|
||||
column: x => x.PlexServerContentId,
|
||||
principalTable: "PlexServerContent",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EmbyEpisode_ParentId",
|
||||
table: "EmbyEpisode",
|
||||
column: "ParentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_JellyfinEpisode_ParentId",
|
||||
table: "JellyfinEpisode",
|
||||
column: "ParentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlexEpisode_GrandparentKey",
|
||||
table: "PlexEpisode",
|
||||
column: "GrandparentKey");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlexSeasonsContent_PlexServerContentId",
|
||||
table: "PlexSeasonsContent",
|
||||
column: "PlexServerContentId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CouchPotatoCache");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EmbyEpisode");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "JellyfinEpisode");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "LidarrAlbumCache");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "LidarrArtistCache");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PlexEpisode");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PlexSeasonsContent");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PlexWatchlistHistory");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RadarrCache");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SickRageCache");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SickRageEpisodeCache");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SonarrCache");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SonarrEpisodeCache");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "UserPlayedEpisode");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "UserPlayedMovie");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EmbyContent");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "JellyfinContent");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PlexServerContent");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,626 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Ombi.Store.Context.Postgres;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Ombi.Store.Migrations.ExternalPostgres
|
||||
{
|
||||
[DbContext(typeof(ExternalPostgresContext))]
|
||||
partial class ExternalPostgresContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.22")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.CouchPotatoCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("TheMovieDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("CouchPotatoCache");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.EmbyContent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("AddedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("EmbyId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Has4K")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ImdbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Quality")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TheMovieDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TvDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("EmbyContent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("AddedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("EmbyId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("EpisodeNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ImdbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ParentId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("TheMovieDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TvDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ParentId");
|
||||
|
||||
b.ToTable("EmbyEpisode");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.JellyfinContent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("AddedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("Has4K")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ImdbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("JellyfinId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Quality")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TheMovieDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TvDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("JellyfinContent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.JellyfinEpisode", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("AddedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("EpisodeNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ImdbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("JellyfinId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ParentId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("TheMovieDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TvDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ParentId");
|
||||
|
||||
b.ToTable("JellyfinEpisode");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.LidarrAlbumCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("AddedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("ArtistId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ForeignAlbumId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Monitored")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<decimal>("PercentOfTracks")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<DateTime>("ReleaseDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("TrackCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("LidarrAlbumCache");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.LidarrArtistCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ArtistId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ArtistName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ForeignArtistId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Monitored")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("LidarrArtistCache");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("EpisodeNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("GrandparentKey")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ParentKey")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GrandparentKey");
|
||||
|
||||
b.ToTable("PlexEpisode");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ParentKey")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PlexContentId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("PlexServerContentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SeasonKey")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PlexServerContentId");
|
||||
|
||||
b.ToTable("PlexSeasonsContent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexServerContent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("AddedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("Has4K")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ImdbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Quality")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ReleaseYear")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("RequestId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("TheMovieDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TvDbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("PlexServerContent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexWatchlistHistory", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("TmdbId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("PlexWatchlistHistory");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.RadarrCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Has4K")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("HasFile")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("HasRegular")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("TheMovieDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RadarrCache");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.SickRageCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("TvDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SickRageCache");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.SickRageEpisodeCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("EpisodeNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TvDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SickRageEpisodeCache");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.SonarrCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("TheMovieDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TvDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SonarrCache");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.SonarrEpisodeCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("EpisodeNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("HasFile")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("MovieDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TvDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SonarrEpisodeCache");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.UserPlayedEpisode", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("EpisodeNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TheMovieDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("UserPlayedEpisode");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.UserPlayedMovie", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("TheMovieDbId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("UserPlayedMovie");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.EmbyContent", "Series")
|
||||
.WithMany("Episodes")
|
||||
.HasForeignKey("ParentId")
|
||||
.HasPrincipalKey("EmbyId");
|
||||
|
||||
b.Navigation("Series");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.JellyfinEpisode", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.JellyfinContent", "Series")
|
||||
.WithMany("Episodes")
|
||||
.HasForeignKey("ParentId")
|
||||
.HasPrincipalKey("JellyfinId");
|
||||
|
||||
b.Navigation("Series");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.PlexServerContent", "Series")
|
||||
.WithMany("Episodes")
|
||||
.HasForeignKey("GrandparentKey")
|
||||
.HasPrincipalKey("Key");
|
||||
|
||||
b.Navigation("Series");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.PlexServerContent", null)
|
||||
.WithMany("Seasons")
|
||||
.HasForeignKey("PlexServerContentId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.EmbyContent", b =>
|
||||
{
|
||||
b.Navigation("Episodes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.JellyfinContent", b =>
|
||||
{
|
||||
b.Navigation("Episodes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexServerContent", b =>
|
||||
{
|
||||
b.Navigation("Episodes");
|
||||
|
||||
b.Navigation("Seasons");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
1359
src/Ombi.Store/Migrations/OmbiPostgres/20231212135239_Initial.Designer.cs
generated
Normal file
1359
src/Ombi.Store/Migrations/OmbiPostgres/20231212135239_Initial.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
934
src/Ombi.Store/Migrations/OmbiPostgres/20231212135239_Initial.cs
Normal file
934
src/Ombi.Store/Migrations/OmbiPostgres/20231212135239_Initial.cs
Normal file
|
@ -0,0 +1,934 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Ombi.Store.Migrations.OmbiPostgres
|
||||
{
|
||||
public partial class Initial : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetRoles",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "text", nullable: false),
|
||||
Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
NormalizedName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetRoles", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetUsers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "text", nullable: false),
|
||||
Alias = table.Column<string>(type: "text", nullable: true),
|
||||
UserType = table.Column<int>(type: "integer", nullable: false),
|
||||
ProviderUserId = table.Column<string>(type: "text", nullable: true),
|
||||
LastLoggedIn = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
Language = table.Column<string>(type: "text", nullable: true),
|
||||
StreamingCountry = table.Column<string>(type: "text", nullable: false),
|
||||
MovieRequestLimit = table.Column<int>(type: "integer", nullable: true),
|
||||
EpisodeRequestLimit = table.Column<int>(type: "integer", nullable: true),
|
||||
MusicRequestLimit = table.Column<int>(type: "integer", nullable: true),
|
||||
MovieRequestLimitType = table.Column<int>(type: "integer", nullable: true),
|
||||
EpisodeRequestLimitType = table.Column<int>(type: "integer", nullable: true),
|
||||
MusicRequestLimitType = table.Column<int>(type: "integer", nullable: true),
|
||||
UserAccessToken = table.Column<string>(type: "text", nullable: true),
|
||||
MediaServerToken = table.Column<string>(type: "text", nullable: true),
|
||||
PasswordHash = table.Column<string>(type: "text", nullable: true),
|
||||
SecurityStamp = table.Column<string>(type: "text", nullable: true),
|
||||
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true),
|
||||
UserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
NormalizedUserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
Email = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
NormalizedEmail = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
EmailConfirmed = table.Column<bool>(type: "boolean", nullable: false),
|
||||
PhoneNumber = table.Column<string>(type: "text", nullable: true),
|
||||
PhoneNumberConfirmed = table.Column<bool>(type: "boolean", nullable: false),
|
||||
TwoFactorEnabled = table.Column<bool>(type: "boolean", nullable: false),
|
||||
LockoutEnd = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
||||
LockoutEnabled = table.Column<bool>(type: "boolean", nullable: false),
|
||||
AccessFailedCount = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Audit",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
DateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: true),
|
||||
AuditType = table.Column<int>(type: "integer", nullable: false),
|
||||
AuditArea = table.Column<int>(type: "integer", nullable: false),
|
||||
User = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Audit", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "IssueCategory",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Value = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_IssueCategory", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "NotificationTemplates",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
NotificationType = table.Column<int>(type: "integer", nullable: false),
|
||||
Agent = table.Column<int>(type: "integer", nullable: false),
|
||||
Subject = table.Column<string>(type: "text", nullable: true),
|
||||
Message = table.Column<string>(type: "text", nullable: true),
|
||||
Enabled = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_NotificationTemplates", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PlexWatchlistUserError",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
UserId = table.Column<string>(type: "text", nullable: true),
|
||||
MediaServerToken = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlexWatchlistUserError", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RecentlyAddedLog",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Type = table.Column<int>(type: "integer", nullable: false),
|
||||
ContentType = table.Column<int>(type: "integer", nullable: false),
|
||||
ContentId = table.Column<int>(type: "integer", nullable: false),
|
||||
EpisodeNumber = table.Column<int>(type: "integer", nullable: true),
|
||||
SeasonNumber = table.Column<int>(type: "integer", nullable: true),
|
||||
AlbumId = table.Column<string>(type: "text", nullable: true),
|
||||
AddedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RecentlyAddedLog", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RequestQueue",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
RequestId = table.Column<int>(type: "integer", nullable: false),
|
||||
Type = table.Column<int>(type: "integer", nullable: false),
|
||||
Dts = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
Error = table.Column<string>(type: "text", nullable: true),
|
||||
Completed = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
RetryCount = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RequestQueue", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TvRequests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
TvDbId = table.Column<int>(type: "integer", nullable: false),
|
||||
ExternalProviderId = table.Column<int>(type: "integer", nullable: false),
|
||||
ImdbId = table.Column<string>(type: "text", nullable: true),
|
||||
QualityOverride = table.Column<int>(type: "integer", nullable: true),
|
||||
RootFolder = table.Column<int>(type: "integer", nullable: true),
|
||||
LanguageProfile = table.Column<int>(type: "integer", nullable: true),
|
||||
Overview = table.Column<string>(type: "text", nullable: true),
|
||||
Title = table.Column<string>(type: "text", nullable: true),
|
||||
PosterPath = table.Column<string>(type: "text", nullable: true),
|
||||
Background = table.Column<string>(type: "text", nullable: true),
|
||||
ReleaseDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
Status = table.Column<string>(type: "text", nullable: true),
|
||||
TotalSeasons = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TvRequests", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetRoleClaims",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
RoleId = table.Column<string>(type: "text", nullable: false),
|
||||
ClaimType = table.Column<string>(type: "text", nullable: true),
|
||||
ClaimValue = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalTable: "AspNetRoles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AlbumRequests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ForeignAlbumId = table.Column<string>(type: "text", nullable: true),
|
||||
ForeignArtistId = table.Column<string>(type: "text", nullable: true),
|
||||
Disk = table.Column<string>(type: "text", nullable: true),
|
||||
Cover = table.Column<string>(type: "text", nullable: true),
|
||||
Rating = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
ReleaseDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
ArtistName = table.Column<string>(type: "text", nullable: true),
|
||||
Title = table.Column<string>(type: "text", nullable: true),
|
||||
Approved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
MarkedAsApproved = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
RequestedDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
Available = table.Column<bool>(type: "boolean", nullable: false),
|
||||
MarkedAsAvailable = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
RequestedUserId = table.Column<string>(type: "text", nullable: true),
|
||||
Denied = table.Column<bool>(type: "boolean", nullable: true),
|
||||
MarkedAsDenied = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
DeniedReason = table.Column<string>(type: "text", nullable: true),
|
||||
RequestType = table.Column<int>(type: "integer", nullable: false),
|
||||
RequestedByAlias = table.Column<string>(type: "text", nullable: true),
|
||||
Source = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AlbumRequests", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AlbumRequests_AspNetUsers_RequestedUserId",
|
||||
column: x => x.RequestedUserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetUserClaims",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
UserId = table.Column<string>(type: "text", nullable: false),
|
||||
ClaimType = table.Column<string>(type: "text", nullable: true),
|
||||
ClaimValue = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetUserClaims_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetUserLogins",
|
||||
columns: table => new
|
||||
{
|
||||
LoginProvider = table.Column<string>(type: "text", nullable: false),
|
||||
ProviderKey = table.Column<string>(type: "text", nullable: false),
|
||||
ProviderDisplayName = table.Column<string>(type: "text", nullable: true),
|
||||
UserId = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetUserLogins_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetUserRoles",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<string>(type: "text", nullable: false),
|
||||
RoleId = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalTable: "AspNetRoles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetUserRoles_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetUserTokens",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<string>(type: "text", nullable: false),
|
||||
LoginProvider = table.Column<string>(type: "text", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Value = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MobileDevices",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Token = table.Column<string>(type: "text", nullable: true),
|
||||
UserId = table.Column<string>(type: "text", nullable: true),
|
||||
AddedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MobileDevices", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MobileDevices_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MovieRequests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
TheMovieDbId = table.Column<int>(type: "integer", nullable: false),
|
||||
IssueId = table.Column<int>(type: "integer", nullable: true),
|
||||
RootPathOverride = table.Column<int>(type: "integer", nullable: false),
|
||||
QualityOverride = table.Column<int>(type: "integer", nullable: false),
|
||||
Has4KRequest = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Approved4K = table.Column<bool>(type: "boolean", nullable: false),
|
||||
MarkedAsApproved4K = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
RequestedDate4k = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
Available4K = table.Column<bool>(type: "boolean", nullable: false),
|
||||
MarkedAsAvailable4K = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
Denied4K = table.Column<bool>(type: "boolean", nullable: true),
|
||||
MarkedAsDenied4K = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
DeniedReason4K = table.Column<string>(type: "text", nullable: true),
|
||||
LangCode = table.Column<string>(type: "text", nullable: true),
|
||||
Title = table.Column<string>(type: "text", nullable: true),
|
||||
Approved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
MarkedAsApproved = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
RequestedDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
Available = table.Column<bool>(type: "boolean", nullable: false),
|
||||
MarkedAsAvailable = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
RequestedUserId = table.Column<string>(type: "text", nullable: true),
|
||||
Denied = table.Column<bool>(type: "boolean", nullable: true),
|
||||
MarkedAsDenied = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
DeniedReason = table.Column<string>(type: "text", nullable: true),
|
||||
RequestType = table.Column<int>(type: "integer", nullable: false),
|
||||
RequestedByAlias = table.Column<string>(type: "text", nullable: true),
|
||||
Source = table.Column<int>(type: "integer", nullable: false),
|
||||
ImdbId = table.Column<string>(type: "text", nullable: true),
|
||||
Overview = table.Column<string>(type: "text", nullable: true),
|
||||
PosterPath = table.Column<string>(type: "text", nullable: true),
|
||||
ReleaseDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
DigitalReleaseDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
Status = table.Column<string>(type: "text", nullable: true),
|
||||
Background = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MovieRequests", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MovieRequests_AspNetUsers_RequestedUserId",
|
||||
column: x => x.RequestedUserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "NotificationUserId",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
PlayerId = table.Column<string>(type: "text", nullable: true),
|
||||
UserId = table.Column<string>(type: "text", nullable: true),
|
||||
AddedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_NotificationUserId", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_NotificationUserId_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RequestLog",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
UserId = table.Column<string>(type: "text", nullable: true),
|
||||
RequestType = table.Column<int>(type: "integer", nullable: false),
|
||||
RequestDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
RequestId = table.Column<int>(type: "integer", nullable: false),
|
||||
EpisodeCount = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RequestLog", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_RequestLog_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RequestSubscription",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
UserId = table.Column<string>(type: "text", nullable: true),
|
||||
RequestId = table.Column<int>(type: "integer", nullable: false),
|
||||
RequestType = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RequestSubscription", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_RequestSubscription_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Tokens",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Token = table.Column<string>(type: "text", nullable: true),
|
||||
UserId = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Tokens", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Tokens_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UserNotificationPreferences",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
UserId = table.Column<string>(type: "text", nullable: true),
|
||||
Agent = table.Column<int>(type: "integer", nullable: false),
|
||||
Enabled = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Value = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_UserNotificationPreferences", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_UserNotificationPreferences_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UserQualityProfiles",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
UserId = table.Column<string>(type: "text", nullable: true),
|
||||
SonarrQualityProfileAnime = table.Column<int>(type: "integer", nullable: false),
|
||||
SonarrRootPathAnime = table.Column<int>(type: "integer", nullable: false),
|
||||
SonarrRootPath = table.Column<int>(type: "integer", nullable: false),
|
||||
SonarrQualityProfile = table.Column<int>(type: "integer", nullable: false),
|
||||
RadarrRootPath = table.Column<int>(type: "integer", nullable: false),
|
||||
RadarrQualityProfile = table.Column<int>(type: "integer", nullable: false),
|
||||
Radarr4KRootPath = table.Column<int>(type: "integer", nullable: false),
|
||||
Radarr4KQualityProfile = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_UserQualityProfiles", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_UserQualityProfiles_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Votes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
RequestId = table.Column<int>(type: "integer", nullable: false),
|
||||
VoteType = table.Column<int>(type: "integer", nullable: false),
|
||||
RequestType = table.Column<int>(type: "integer", nullable: false),
|
||||
UserId = table.Column<string>(type: "text", nullable: true),
|
||||
Date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
Deleted = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Votes", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Votes_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ChildRequests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ParentRequestId = table.Column<int>(type: "integer", nullable: false),
|
||||
IssueId = table.Column<int>(type: "integer", nullable: true),
|
||||
SeriesType = table.Column<int>(type: "integer", nullable: false),
|
||||
Title = table.Column<string>(type: "text", nullable: true),
|
||||
Approved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
MarkedAsApproved = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
RequestedDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
Available = table.Column<bool>(type: "boolean", nullable: false),
|
||||
MarkedAsAvailable = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
RequestedUserId = table.Column<string>(type: "text", nullable: true),
|
||||
Denied = table.Column<bool>(type: "boolean", nullable: true),
|
||||
MarkedAsDenied = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
DeniedReason = table.Column<string>(type: "text", nullable: true),
|
||||
RequestType = table.Column<int>(type: "integer", nullable: false),
|
||||
RequestedByAlias = table.Column<string>(type: "text", nullable: true),
|
||||
Source = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ChildRequests", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ChildRequests_AspNetUsers_RequestedUserId",
|
||||
column: x => x.RequestedUserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_ChildRequests_TvRequests_ParentRequestId",
|
||||
column: x => x.ParentRequestId,
|
||||
principalTable: "TvRequests",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Issues",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Title = table.Column<string>(type: "text", nullable: true),
|
||||
RequestType = table.Column<int>(type: "integer", nullable: false),
|
||||
ProviderId = table.Column<string>(type: "text", nullable: true),
|
||||
RequestId = table.Column<int>(type: "integer", nullable: true),
|
||||
Subject = table.Column<string>(type: "text", nullable: true),
|
||||
Description = table.Column<string>(type: "text", nullable: true),
|
||||
IssueCategoryId = table.Column<int>(type: "integer", nullable: false),
|
||||
Status = table.Column<int>(type: "integer", nullable: false),
|
||||
ResovledDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
CreatedDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
UserReportedId = table.Column<string>(type: "text", nullable: true),
|
||||
IssueId = table.Column<int>(type: "integer", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Issues", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Issues_AspNetUsers_UserReportedId",
|
||||
column: x => x.UserReportedId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_Issues_ChildRequests_IssueId",
|
||||
column: x => x.IssueId,
|
||||
principalTable: "ChildRequests",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_Issues_IssueCategory_IssueCategoryId",
|
||||
column: x => x.IssueCategoryId,
|
||||
principalTable: "IssueCategory",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Issues_MovieRequests_IssueId",
|
||||
column: x => x.IssueId,
|
||||
principalTable: "MovieRequests",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SeasonRequests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
SeasonNumber = table.Column<int>(type: "integer", nullable: false),
|
||||
Overview = table.Column<string>(type: "text", nullable: true),
|
||||
ChildRequestId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SeasonRequests", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_SeasonRequests_ChildRequests_ChildRequestId",
|
||||
column: x => x.ChildRequestId,
|
||||
principalTable: "ChildRequests",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "IssueComments",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
UserId = table.Column<string>(type: "text", nullable: true),
|
||||
Comment = table.Column<string>(type: "text", nullable: true),
|
||||
IssuesId = table.Column<int>(type: "integer", nullable: true),
|
||||
Date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_IssueComments", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_IssueComments_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_IssueComments_Issues_IssuesId",
|
||||
column: x => x.IssuesId,
|
||||
principalTable: "Issues",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EpisodeRequests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
EpisodeNumber = table.Column<int>(type: "integer", nullable: false),
|
||||
Title = table.Column<string>(type: "text", nullable: true),
|
||||
AirDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
Url = table.Column<string>(type: "text", nullable: true),
|
||||
Available = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Approved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Requested = table.Column<bool>(type: "boolean", nullable: false),
|
||||
SeasonId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EpisodeRequests", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_EpisodeRequests_SeasonRequests_SeasonId",
|
||||
column: x => x.SeasonId,
|
||||
principalTable: "SeasonRequests",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AlbumRequests_RequestedUserId",
|
||||
table: "AlbumRequests",
|
||||
column: "RequestedUserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AspNetRoleClaims_RoleId",
|
||||
table: "AspNetRoleClaims",
|
||||
column: "RoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "RoleNameIndex",
|
||||
table: "AspNetRoles",
|
||||
column: "NormalizedName",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AspNetUserClaims_UserId",
|
||||
table: "AspNetUserClaims",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AspNetUserLogins_UserId",
|
||||
table: "AspNetUserLogins",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AspNetUserRoles_RoleId",
|
||||
table: "AspNetUserRoles",
|
||||
column: "RoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "EmailIndex",
|
||||
table: "AspNetUsers",
|
||||
column: "NormalizedEmail");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "UserNameIndex",
|
||||
table: "AspNetUsers",
|
||||
column: "NormalizedUserName",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ChildRequests_ParentRequestId",
|
||||
table: "ChildRequests",
|
||||
column: "ParentRequestId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ChildRequests_RequestedUserId",
|
||||
table: "ChildRequests",
|
||||
column: "RequestedUserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EpisodeRequests_SeasonId",
|
||||
table: "EpisodeRequests",
|
||||
column: "SeasonId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_IssueComments_IssuesId",
|
||||
table: "IssueComments",
|
||||
column: "IssuesId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_IssueComments_UserId",
|
||||
table: "IssueComments",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Issues_IssueCategoryId",
|
||||
table: "Issues",
|
||||
column: "IssueCategoryId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Issues_IssueId",
|
||||
table: "Issues",
|
||||
column: "IssueId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Issues_UserReportedId",
|
||||
table: "Issues",
|
||||
column: "UserReportedId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MobileDevices_UserId",
|
||||
table: "MobileDevices",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MovieRequests_RequestedUserId",
|
||||
table: "MovieRequests",
|
||||
column: "RequestedUserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_NotificationUserId_UserId",
|
||||
table: "NotificationUserId",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RequestLog_UserId",
|
||||
table: "RequestLog",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RequestSubscription_UserId",
|
||||
table: "RequestSubscription",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SeasonRequests_ChildRequestId",
|
||||
table: "SeasonRequests",
|
||||
column: "ChildRequestId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Tokens_UserId",
|
||||
table: "Tokens",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserNotificationPreferences_UserId",
|
||||
table: "UserNotificationPreferences",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserQualityProfiles_UserId",
|
||||
table: "UserQualityProfiles",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Votes_UserId",
|
||||
table: "Votes",
|
||||
column: "UserId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AlbumRequests");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetRoleClaims");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetUserClaims");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetUserLogins");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetUserRoles");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetUserTokens");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Audit");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EpisodeRequests");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "IssueComments");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MobileDevices");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "NotificationTemplates");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "NotificationUserId");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PlexWatchlistUserError");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RecentlyAddedLog");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RequestLog");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RequestQueue");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RequestSubscription");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Tokens");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "UserNotificationPreferences");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "UserQualityProfiles");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Votes");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetRoles");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SeasonRequests");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Issues");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ChildRequests");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "IssueCategory");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MovieRequests");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TvRequests");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetUsers");
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
66
src/Ombi.Store/Migrations/SettingsPostgres/20231212135625_Initial.Designer.cs
generated
Normal file
66
src/Ombi.Store/Migrations/SettingsPostgres/20231212135625_Initial.Designer.cs
generated
Normal file
|
@ -0,0 +1,66 @@
|
|||
// <auto-generated />
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Ombi.Store.Context.Postgres;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Ombi.Store.Migrations.SettingsPostgres
|
||||
{
|
||||
[DbContext(typeof(SettingsPostgresContext))]
|
||||
[Migration("20231212135625_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.22")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.ApplicationConfiguration", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ApplicationConfiguration");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.GlobalSettings", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Content")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("SettingsName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("GlobalSettings");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Ombi.Store.Migrations.SettingsPostgres
|
||||
{
|
||||
public partial class Initial : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ApplicationConfiguration",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Type = table.Column<int>(type: "integer", nullable: false),
|
||||
Value = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ApplicationConfiguration", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GlobalSettings",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Content = table.Column<string>(type: "text", nullable: true),
|
||||
SettingsName = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GlobalSettings", x => x.Id);
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ApplicationConfiguration");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "GlobalSettings");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
// <auto-generated />
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Ombi.Store.Context.Postgres;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Ombi.Store.Migrations.SettingsPostgres
|
||||
{
|
||||
[DbContext(typeof(SettingsPostgresContext))]
|
||||
partial class SettingsPostgresContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.22")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.ApplicationConfiguration", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ApplicationConfiguration");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.GlobalSettings", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Content")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("SettingsName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("GlobalSettings");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@
|
|||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.5" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.22" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
|
||||
<PackageReference Include="Nito.AsyncEx" Version="5.1.2" />
|
||||
<PackageReference Include="Polly" Version="7.2.3" />
|
||||
|
@ -40,4 +41,8 @@
|
|||
<LastGenOutput>Sql.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Migrations\OmbiPostgres\" />
|
||||
<Folder Include="Migrations\SettingsPostgres\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,14 +1,18 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||
using MySqlConnector;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal;
|
||||
using Ombi.Helpers;
|
||||
using Ombi.Store.Context;
|
||||
using Ombi.Store.Context.MySql;
|
||||
using Ombi.Store.Context.Sqlite;
|
||||
using Ombi.Store.Context.Postgres;
|
||||
using Polly;
|
||||
using Pomelo.EntityFrameworkCore.MySql.Storage.Internal;
|
||||
using SQLitePCL;
|
||||
|
@ -20,6 +24,7 @@ namespace Ombi.Extensions
|
|||
|
||||
public const string SqliteDatabase = "Sqlite";
|
||||
public const string MySqlDatabase = "MySQL";
|
||||
public const string PostgresDatabase = "Postgres";
|
||||
|
||||
public static void ConfigureDatabases(this IServiceCollection services, IHealthChecksBuilder hcBuilder)
|
||||
{
|
||||
|
@ -36,6 +41,10 @@ namespace Ombi.Extensions
|
|||
services.AddDbContext<OmbiContext, OmbiMySqlContext>(x => ConfigureMySql(x, configuration.OmbiDatabase));
|
||||
AddMySqlHealthCheck(hcBuilder, "Ombi Database", configuration.OmbiDatabase);
|
||||
break;
|
||||
case var type when type.Equals(PostgresDatabase, StringComparison.InvariantCultureIgnoreCase):
|
||||
services.AddDbContext<OmbiContext, OmbiPostgresContext>(x => ConfigurePostgres(x, configuration.OmbiDatabase));
|
||||
AddPostgresHealthCheck(hcBuilder, "Ombi Database", configuration.OmbiDatabase);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (configuration.ExternalDatabase.Type)
|
||||
|
@ -48,6 +57,10 @@ namespace Ombi.Extensions
|
|||
services.AddDbContext<ExternalContext, ExternalMySqlContext>(x => ConfigureMySql(x, configuration.ExternalDatabase));
|
||||
AddMySqlHealthCheck(hcBuilder, "External Database", configuration.ExternalDatabase);
|
||||
break;
|
||||
case var type when type.Equals(PostgresDatabase, StringComparison.InvariantCultureIgnoreCase):
|
||||
services.AddDbContext<ExternalContext, ExternalPostgresContext>(x => ConfigurePostgres(x, configuration.ExternalDatabase));
|
||||
AddPostgresHealthCheck(hcBuilder, "External Database", configuration.ExternalDatabase);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (configuration.SettingsDatabase.Type)
|
||||
|
@ -60,6 +73,10 @@ namespace Ombi.Extensions
|
|||
services.AddDbContext<SettingsContext, SettingsMySqlContext>(x => ConfigureMySql(x, configuration.SettingsDatabase));
|
||||
AddMySqlHealthCheck(hcBuilder, "Settings Database", configuration.SettingsDatabase);
|
||||
break;
|
||||
case var type when type.Equals(PostgresDatabase, StringComparison.InvariantCultureIgnoreCase):
|
||||
services.AddDbContext<SettingsContext, SettingsPostgresContext>(x => ConfigurePostgres(x, configuration.SettingsDatabase));
|
||||
AddPostgresHealthCheck(hcBuilder, "Settings Database", configuration.SettingsDatabase);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,6 +131,19 @@ namespace Ombi.Extensions
|
|||
}
|
||||
}
|
||||
|
||||
private static void AddPostgresHealthCheck(IHealthChecksBuilder builder, string dbName, PerDatabaseConfiguration config)
|
||||
{
|
||||
if (builder != null)
|
||||
{
|
||||
builder.AddNpgSql(
|
||||
npgsqlConnectionString: config.ConnectionString,
|
||||
name: dbName,
|
||||
failureStatus: HealthStatus.Unhealthy,
|
||||
tags: new string[] { "db" }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ConfigureSqlite(DbContextOptionsBuilder options, PerDatabaseConfiguration config)
|
||||
{
|
||||
SQLitePCL.Batteries.Init();
|
||||
|
@ -135,6 +165,14 @@ namespace Ombi.Extensions
|
|||
});
|
||||
}
|
||||
|
||||
public static void ConfigurePostgres(DbContextOptionsBuilder options, PerDatabaseConfiguration config)
|
||||
{
|
||||
options.UseNpgsql(config.ConnectionString, b =>
|
||||
{
|
||||
b.EnableRetryOnFailure();
|
||||
}).ReplaceService<ISqlGenerationHelper, NpgsqlCaseInsensitiveSqlGenerationHelper>();
|
||||
}
|
||||
|
||||
private static ServerVersion GetServerVersion(string connectionString)
|
||||
{
|
||||
// Workaround Windows bug, that can lead to the following exception:
|
||||
|
@ -191,5 +229,16 @@ namespace Ombi.Extensions
|
|||
public string Type { get; set; }
|
||||
public string ConnectionString { get; set; }
|
||||
}
|
||||
|
||||
public class NpgsqlCaseInsensitiveSqlGenerationHelper : NpgsqlSqlGenerationHelper
|
||||
{
|
||||
const string EFMigrationsHisory = "__EFMigrationsHistory";
|
||||
public NpgsqlCaseInsensitiveSqlGenerationHelper(RelationalSqlGenerationHelperDependencies dependencies)
|
||||
: base(dependencies) { }
|
||||
public override string DelimitIdentifier(string identifier) =>
|
||||
base.DelimitIdentifier(identifier == EFMigrationsHisory ? identifier : identifier.ToLower());
|
||||
public override void DelimitIdentifier(StringBuilder builder, string identifier)
|
||||
=> base.DelimitIdentifier(builder, identifier == EFMigrationsHisory ? identifier : identifier.ToLower());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -65,6 +65,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AspNetCore.HealthChecks.MySql" Version="6.0.2" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.NpgSql" Version="6.0.2" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.Sqlite" Version="6.0.2" />
|
||||
<PackageReference Include="AutoMapper" Version="12.0.0" />
|
||||
<PackageReference Include="CommandLineParser" Version="2.9.1" />
|
||||
|
|
|
@ -120,6 +120,7 @@ namespace Ombi
|
|||
|
||||
serviceProvider.UseQuartz().GetAwaiter().GetResult();
|
||||
|
||||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||
var ctx = serviceProvider.GetService<OmbiContext>();
|
||||
loggerFactory.AddSerilog();
|
||||
var ombiService =
|
||||
|
@ -151,7 +152,6 @@ namespace Ombi
|
|||
{
|
||||
app.UsePathBase(settings.BaseUrl);
|
||||
}
|
||||
|
||||
ctx.Seed();
|
||||
var settingsctx = serviceProvider.GetService<SettingsContext>();
|
||||
settingsctx.Seed();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue