mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-12 00:06:05 -07:00
Added Migrations rather than a manual DB Script #865
This commit is contained in:
parent
77f9e90c0e
commit
b69b322bd5
13 changed files with 1206 additions and 433 deletions
|
@ -7,9 +7,9 @@ namespace Ombi.Core.Engine.Interfaces
|
|||
public interface IRequestEngine<T>
|
||||
{
|
||||
|
||||
Task<IEnumerable<T>> GetApprovedRequests();
|
||||
Task<IEnumerable<T>> GetNewRequests();
|
||||
Task<IEnumerable<T>> GetAvailableRequests();
|
||||
//Task<IEnumerable<T>> GetApprovedRequests();
|
||||
//Task<IEnumerable<T>> GetNewRequests();
|
||||
//Task<IEnumerable<T>> GetAvailableRequests();
|
||||
RequestCountModel RequestCount();
|
||||
Task<IEnumerable<T>> GetRequests(int count, int position);
|
||||
Task<IEnumerable<T>> GetRequests();
|
||||
|
|
|
@ -248,7 +248,7 @@ namespace Ombi.Core.Engine
|
|||
public async Task<IEnumerable<TvRequests>> SearchTvRequest(string search)
|
||||
{
|
||||
var allRequests = TvRepository.Get();
|
||||
var results = allRequests.Where(x => x.Title.Contains(search, CompareOptions.IgnoreCase));
|
||||
var results = await allRequests.Where(x => x.Title.Contains(search, CompareOptions.IgnoreCase)).ToListAsync();
|
||||
return results;
|
||||
}
|
||||
|
||||
|
@ -325,25 +325,25 @@ namespace Ombi.Core.Engine
|
|||
return Task.FromResult(new RequestEngineResult { RequestAdded = true });
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<TvRequests>> GetApprovedRequests()
|
||||
{
|
||||
//var allRequests = TvRepository.Get();
|
||||
//return await allRequests.Where(x => x.Approved && !x.Available).ToListAsync();
|
||||
return null;
|
||||
}
|
||||
//public async Task<IEnumerable<TvRequests>> GetApprovedRequests()
|
||||
//{
|
||||
// var allRequests = TvRepository.Get();
|
||||
|
||||
|
||||
//}
|
||||
|
||||
public async Task<IEnumerable<TvRequests>> GetNewRequests()
|
||||
{
|
||||
//var allRequests = await TvRepository.GetAllAsync();
|
||||
//return allRequests.Where(x => !x.Approved && !x.Available);
|
||||
return null;
|
||||
}
|
||||
//public async Task<IEnumerable<TvRequests>> GetNewRequests()
|
||||
//{
|
||||
// //var allRequests = await TvRepository.GetAllAsync();
|
||||
// //return allRequests.Where(x => !x.Approved && !x.Available);
|
||||
// return null;
|
||||
//}
|
||||
|
||||
public async Task<IEnumerable<TvRequests>> GetAvailableRequests()
|
||||
{
|
||||
//var allRequests = await TvRepository.GetAllAsync();
|
||||
//return allRequests.Where(x => x.Available);
|
||||
return null;
|
||||
}
|
||||
//public async Task<IEnumerable<TvRequests>> GetAvailableRequests()
|
||||
//{
|
||||
// //var allRequests = await TvRepository.GetAllAsync();
|
||||
// //return allRequests.Where(x => x.Available);
|
||||
// return null;
|
||||
//}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Ombi.Helpers;
|
||||
|
@ -16,20 +15,7 @@ namespace Ombi.Store.Context
|
|||
if (_created) return;
|
||||
|
||||
_created = true;
|
||||
Database.EnsureCreated();
|
||||
Database.Migrate();
|
||||
|
||||
#if DEBUG
|
||||
var location = System.Reflection.Assembly.GetEntryAssembly().Location;
|
||||
var directory = System.IO.Path.GetDirectoryName(location);
|
||||
var file = File.ReadAllText(Path.Combine(directory,"SqlTables.sql"));
|
||||
#else
|
||||
|
||||
var file = File.ReadAllText("SqlTables.sql");
|
||||
#endif
|
||||
// Run Script
|
||||
|
||||
Database.ExecuteSqlCommand(file, 0);
|
||||
|
||||
// Add the notifcation templates
|
||||
AddAllTemplates();
|
||||
|
|
393
src/Ombi.Store/Migrations/20170703134019_Initial.Designer.cs
generated
Normal file
393
src/Ombi.Store/Migrations/20170703134019_Initial.Designer.cs
generated
Normal file
|
@ -0,0 +1,393 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Ombi.Store.Context;
|
||||
using Ombi.Helpers;
|
||||
using Ombi.Store.Entities;
|
||||
|
||||
namespace Ombi.Store.Migrations
|
||||
{
|
||||
[DbContext(typeof(OmbiContext))]
|
||||
[Migration("20170703134019_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "1.1.1");
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.GlobalSettings", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Content");
|
||||
|
||||
b.Property<string>("SettingsName");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("GlobalSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.NotificationTemplates", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("Agent");
|
||||
|
||||
b.Property<bool>("Enabled");
|
||||
|
||||
b.Property<string>("Message");
|
||||
|
||||
b.Property<int>("NotificationType");
|
||||
|
||||
b.Property<string>("Subject");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("NotificationTemplates");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexContent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<DateTime>("AddedAt");
|
||||
|
||||
b.Property<string>("Key");
|
||||
|
||||
b.Property<string>("ProviderId");
|
||||
|
||||
b.Property<string>("ReleaseYear");
|
||||
|
||||
b.Property<string>("Title");
|
||||
|
||||
b.Property<int>("Type");
|
||||
|
||||
b.Property<string>("Url");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("PlexContent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("ParentKey");
|
||||
|
||||
b.Property<int>("PlexContentId");
|
||||
|
||||
b.Property<int>("SeasonKey");
|
||||
|
||||
b.Property<int>("SeasonNumber");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PlexContentId");
|
||||
|
||||
b.ToTable("PlexSeasonsContent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.RadarrCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("TheMovieDbId");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RadarrCache");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<bool>("Approved");
|
||||
|
||||
b.Property<bool>("Available");
|
||||
|
||||
b.Property<bool?>("Denied");
|
||||
|
||||
b.Property<string>("DeniedReason");
|
||||
|
||||
b.Property<int?>("IssueId");
|
||||
|
||||
b.Property<int>("ParentRequestId");
|
||||
|
||||
b.Property<int>("RequestType");
|
||||
|
||||
b.Property<DateTime>("RequestedDate");
|
||||
|
||||
b.Property<int>("RequestedUserId");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ParentRequestId");
|
||||
|
||||
b.HasIndex("RequestedUserId");
|
||||
|
||||
b.ToTable("ChildRequests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieIssues", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Description");
|
||||
|
||||
b.Property<int?>("IssueId");
|
||||
|
||||
b.Property<int>("MovieId");
|
||||
|
||||
b.Property<string>("Subect");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IssueId");
|
||||
|
||||
b.HasIndex("MovieId");
|
||||
|
||||
b.ToTable("MovieIssues");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<bool>("Approved");
|
||||
|
||||
b.Property<bool>("Available");
|
||||
|
||||
b.Property<bool?>("Denied");
|
||||
|
||||
b.Property<string>("DeniedReason");
|
||||
|
||||
b.Property<string>("ImdbId");
|
||||
|
||||
b.Property<int?>("IssueId");
|
||||
|
||||
b.Property<string>("Overview");
|
||||
|
||||
b.Property<string>("PosterPath");
|
||||
|
||||
b.Property<DateTime>("ReleaseDate");
|
||||
|
||||
b.Property<int>("RequestType");
|
||||
|
||||
b.Property<DateTime>("RequestedDate");
|
||||
|
||||
b.Property<int>("RequestedUserId");
|
||||
|
||||
b.Property<string>("Status");
|
||||
|
||||
b.Property<int>("TheMovieDbId");
|
||||
|
||||
b.Property<string>("Title");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RequestedUserId");
|
||||
|
||||
b.ToTable("MovieRequests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.TvIssues", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Description");
|
||||
|
||||
b.Property<int?>("IssueId");
|
||||
|
||||
b.Property<string>("Subect");
|
||||
|
||||
b.Property<int>("TvId");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IssueId");
|
||||
|
||||
b.HasIndex("TvId");
|
||||
|
||||
b.ToTable("TvIssues");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.TvRequests", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("ImdbId");
|
||||
|
||||
b.Property<string>("Overview");
|
||||
|
||||
b.Property<string>("PosterPath");
|
||||
|
||||
b.Property<DateTime>("ReleaseDate");
|
||||
|
||||
b.Property<int?>("RootFolder");
|
||||
|
||||
b.Property<string>("Status");
|
||||
|
||||
b.Property<string>("Title");
|
||||
|
||||
b.Property<int>("TvDbId");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TvRequests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Alias");
|
||||
|
||||
b.Property<string>("ClaimsSerialized");
|
||||
|
||||
b.Property<string>("EmailAddress");
|
||||
|
||||
b.Property<string>("Password");
|
||||
|
||||
b.Property<byte[]>("Salt");
|
||||
|
||||
b.Property<int>("UserType");
|
||||
|
||||
b.Property<string>("Username");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<DateTime>("AirDate");
|
||||
|
||||
b.Property<bool>("Approved");
|
||||
|
||||
b.Property<bool>("Available");
|
||||
|
||||
b.Property<int>("EpisodeNumber");
|
||||
|
||||
b.Property<bool>("Requested");
|
||||
|
||||
b.Property<int>("SeasonId");
|
||||
|
||||
b.Property<string>("Title");
|
||||
|
||||
b.Property<string>("Url");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SeasonId");
|
||||
|
||||
b.ToTable("EpisodeRequests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("ChildRequestId");
|
||||
|
||||
b.Property<int>("SeasonNumber");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ChildRequestId");
|
||||
|
||||
b.ToTable("SeasonRequests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.PlexContent")
|
||||
.WithMany("Seasons")
|
||||
.HasForeignKey("PlexContentId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.Requests.TvRequests", "ParentRequest")
|
||||
.WithMany("ChildRequests")
|
||||
.HasForeignKey("ParentRequestId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("Ombi.Store.Entities.User", "RequestedUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("RequestedUserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieIssues", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.Requests.MovieRequests")
|
||||
.WithMany("Issues")
|
||||
.HasForeignKey("IssueId");
|
||||
|
||||
b.HasOne("Ombi.Store.Entities.Requests.MovieRequests", "Movie")
|
||||
.WithMany()
|
||||
.HasForeignKey("MovieId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.User", "RequestedUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("RequestedUserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.TvIssues", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.Requests.ChildRequests")
|
||||
.WithMany("Issues")
|
||||
.HasForeignKey("IssueId");
|
||||
|
||||
b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", "Child")
|
||||
.WithMany()
|
||||
.HasForeignKey("TvId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Repository.Requests.SeasonRequests", "Season")
|
||||
.WithMany("Episodes")
|
||||
.HasForeignKey("SeasonId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", "ChildRequest")
|
||||
.WithMany("SeasonRequests")
|
||||
.HasForeignKey("ChildRequestId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
396
src/Ombi.Store/Migrations/20170703134019_Initial.cs
Normal file
396
src/Ombi.Store/Migrations/20170703134019_Initial.cs
Normal file
|
@ -0,0 +1,396 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Ombi.Store.Migrations
|
||||
{
|
||||
public partial class Initial : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GlobalSettings",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Content = table.Column<string>(nullable: true),
|
||||
SettingsName = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GlobalSettings", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "NotificationTemplates",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Agent = table.Column<int>(nullable: false),
|
||||
Enabled = table.Column<bool>(nullable: false),
|
||||
Message = table.Column<string>(nullable: true),
|
||||
NotificationType = table.Column<int>(nullable: false),
|
||||
Subject = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_NotificationTemplates", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PlexContent",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
AddedAt = table.Column<DateTime>(nullable: false),
|
||||
Key = table.Column<string>(nullable: true),
|
||||
ProviderId = table.Column<string>(nullable: true),
|
||||
ReleaseYear = table.Column<string>(nullable: true),
|
||||
Title = table.Column<string>(nullable: true),
|
||||
Type = table.Column<int>(nullable: false),
|
||||
Url = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlexContent", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RadarrCache",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
TheMovieDbId = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RadarrCache", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TvRequests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
ImdbId = table.Column<string>(nullable: true),
|
||||
Overview = table.Column<string>(nullable: true),
|
||||
PosterPath = table.Column<string>(nullable: true),
|
||||
ReleaseDate = table.Column<DateTime>(nullable: false),
|
||||
RootFolder = table.Column<int>(nullable: true),
|
||||
Status = table.Column<string>(nullable: true),
|
||||
Title = table.Column<string>(nullable: true),
|
||||
TvDbId = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TvRequests", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Users",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Alias = table.Column<string>(nullable: true),
|
||||
ClaimsSerialized = table.Column<string>(nullable: true),
|
||||
EmailAddress = table.Column<string>(nullable: true),
|
||||
Password = table.Column<string>(nullable: true),
|
||||
Salt = table.Column<byte[]>(nullable: true),
|
||||
UserType = table.Column<int>(nullable: false),
|
||||
Username = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Users", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PlexSeasonsContent",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
ParentKey = table.Column<int>(nullable: false),
|
||||
PlexContentId = table.Column<int>(nullable: false),
|
||||
SeasonKey = table.Column<int>(nullable: false),
|
||||
SeasonNumber = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlexSeasonsContent", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PlexSeasonsContent_PlexContent_PlexContentId",
|
||||
column: x => x.PlexContentId,
|
||||
principalTable: "PlexContent",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ChildRequests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Approved = table.Column<bool>(nullable: false),
|
||||
Available = table.Column<bool>(nullable: false),
|
||||
Denied = table.Column<bool>(nullable: true),
|
||||
DeniedReason = table.Column<string>(nullable: true),
|
||||
IssueId = table.Column<int>(nullable: true),
|
||||
ParentRequestId = table.Column<int>(nullable: false),
|
||||
RequestType = table.Column<int>(nullable: false),
|
||||
RequestedDate = table.Column<DateTime>(nullable: false),
|
||||
RequestedUserId = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ChildRequests", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ChildRequests_TvRequests_ParentRequestId",
|
||||
column: x => x.ParentRequestId,
|
||||
principalTable: "TvRequests",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ChildRequests_Users_RequestedUserId",
|
||||
column: x => x.RequestedUserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MovieRequests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Approved = table.Column<bool>(nullable: false),
|
||||
Available = table.Column<bool>(nullable: false),
|
||||
Denied = table.Column<bool>(nullable: true),
|
||||
DeniedReason = table.Column<string>(nullable: true),
|
||||
ImdbId = table.Column<string>(nullable: true),
|
||||
IssueId = table.Column<int>(nullable: true),
|
||||
Overview = table.Column<string>(nullable: true),
|
||||
PosterPath = table.Column<string>(nullable: true),
|
||||
ReleaseDate = table.Column<DateTime>(nullable: false),
|
||||
RequestType = table.Column<int>(nullable: false),
|
||||
RequestedDate = table.Column<DateTime>(nullable: false),
|
||||
RequestedUserId = table.Column<int>(nullable: false),
|
||||
Status = table.Column<string>(nullable: true),
|
||||
TheMovieDbId = table.Column<int>(nullable: false),
|
||||
Title = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MovieRequests", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MovieRequests_Users_RequestedUserId",
|
||||
column: x => x.RequestedUserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TvIssues",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Description = table.Column<string>(nullable: true),
|
||||
IssueId = table.Column<int>(nullable: true),
|
||||
Subect = table.Column<string>(nullable: true),
|
||||
TvId = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TvIssues", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_TvIssues_ChildRequests_IssueId",
|
||||
column: x => x.IssueId,
|
||||
principalTable: "ChildRequests",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_TvIssues_ChildRequests_TvId",
|
||||
column: x => x.TvId,
|
||||
principalTable: "ChildRequests",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SeasonRequests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
ChildRequestId = table.Column<int>(nullable: false),
|
||||
SeasonNumber = table.Column<int>(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: "MovieIssues",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Description = table.Column<string>(nullable: true),
|
||||
IssueId = table.Column<int>(nullable: true),
|
||||
MovieId = table.Column<int>(nullable: false),
|
||||
Subect = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MovieIssues", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MovieIssues_MovieRequests_IssueId",
|
||||
column: x => x.IssueId,
|
||||
principalTable: "MovieRequests",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_MovieIssues_MovieRequests_MovieId",
|
||||
column: x => x.MovieId,
|
||||
principalTable: "MovieRequests",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EpisodeRequests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
AirDate = table.Column<DateTime>(nullable: false),
|
||||
Approved = table.Column<bool>(nullable: false),
|
||||
Available = table.Column<bool>(nullable: false),
|
||||
EpisodeNumber = table.Column<int>(nullable: false),
|
||||
Requested = table.Column<bool>(nullable: false),
|
||||
SeasonId = table.Column<int>(nullable: false),
|
||||
Title = table.Column<string>(nullable: true),
|
||||
Url = table.Column<string>(nullable: true)
|
||||
},
|
||||
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_PlexSeasonsContent_PlexContentId",
|
||||
table: "PlexSeasonsContent",
|
||||
column: "PlexContentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ChildRequests_ParentRequestId",
|
||||
table: "ChildRequests",
|
||||
column: "ParentRequestId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ChildRequests_RequestedUserId",
|
||||
table: "ChildRequests",
|
||||
column: "RequestedUserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MovieIssues_IssueId",
|
||||
table: "MovieIssues",
|
||||
column: "IssueId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MovieIssues_MovieId",
|
||||
table: "MovieIssues",
|
||||
column: "MovieId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MovieRequests_RequestedUserId",
|
||||
table: "MovieRequests",
|
||||
column: "RequestedUserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TvIssues_IssueId",
|
||||
table: "TvIssues",
|
||||
column: "IssueId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TvIssues_TvId",
|
||||
table: "TvIssues",
|
||||
column: "TvId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EpisodeRequests_SeasonId",
|
||||
table: "EpisodeRequests",
|
||||
column: "SeasonId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SeasonRequests_ChildRequestId",
|
||||
table: "SeasonRequests",
|
||||
column: "ChildRequestId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "GlobalSettings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "NotificationTemplates");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PlexSeasonsContent");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RadarrCache");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MovieIssues");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TvIssues");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EpisodeRequests");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PlexContent");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MovieRequests");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SeasonRequests");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ChildRequests");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TvRequests");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Users");
|
||||
}
|
||||
}
|
||||
}
|
392
src/Ombi.Store/Migrations/OmbiContextModelSnapshot.cs
Normal file
392
src/Ombi.Store/Migrations/OmbiContextModelSnapshot.cs
Normal file
|
@ -0,0 +1,392 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Ombi.Store.Context;
|
||||
using Ombi.Helpers;
|
||||
using Ombi.Store.Entities;
|
||||
|
||||
namespace Ombi.Store.Migrations
|
||||
{
|
||||
[DbContext(typeof(OmbiContext))]
|
||||
partial class OmbiContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "1.1.1");
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.GlobalSettings", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Content");
|
||||
|
||||
b.Property<string>("SettingsName");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("GlobalSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.NotificationTemplates", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("Agent");
|
||||
|
||||
b.Property<bool>("Enabled");
|
||||
|
||||
b.Property<string>("Message");
|
||||
|
||||
b.Property<int>("NotificationType");
|
||||
|
||||
b.Property<string>("Subject");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("NotificationTemplates");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexContent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<DateTime>("AddedAt");
|
||||
|
||||
b.Property<string>("Key");
|
||||
|
||||
b.Property<string>("ProviderId");
|
||||
|
||||
b.Property<string>("ReleaseYear");
|
||||
|
||||
b.Property<string>("Title");
|
||||
|
||||
b.Property<int>("Type");
|
||||
|
||||
b.Property<string>("Url");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("PlexContent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("ParentKey");
|
||||
|
||||
b.Property<int>("PlexContentId");
|
||||
|
||||
b.Property<int>("SeasonKey");
|
||||
|
||||
b.Property<int>("SeasonNumber");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PlexContentId");
|
||||
|
||||
b.ToTable("PlexSeasonsContent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.RadarrCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("TheMovieDbId");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RadarrCache");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<bool>("Approved");
|
||||
|
||||
b.Property<bool>("Available");
|
||||
|
||||
b.Property<bool?>("Denied");
|
||||
|
||||
b.Property<string>("DeniedReason");
|
||||
|
||||
b.Property<int?>("IssueId");
|
||||
|
||||
b.Property<int>("ParentRequestId");
|
||||
|
||||
b.Property<int>("RequestType");
|
||||
|
||||
b.Property<DateTime>("RequestedDate");
|
||||
|
||||
b.Property<int>("RequestedUserId");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ParentRequestId");
|
||||
|
||||
b.HasIndex("RequestedUserId");
|
||||
|
||||
b.ToTable("ChildRequests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieIssues", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Description");
|
||||
|
||||
b.Property<int?>("IssueId");
|
||||
|
||||
b.Property<int>("MovieId");
|
||||
|
||||
b.Property<string>("Subect");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IssueId");
|
||||
|
||||
b.HasIndex("MovieId");
|
||||
|
||||
b.ToTable("MovieIssues");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<bool>("Approved");
|
||||
|
||||
b.Property<bool>("Available");
|
||||
|
||||
b.Property<bool?>("Denied");
|
||||
|
||||
b.Property<string>("DeniedReason");
|
||||
|
||||
b.Property<string>("ImdbId");
|
||||
|
||||
b.Property<int?>("IssueId");
|
||||
|
||||
b.Property<string>("Overview");
|
||||
|
||||
b.Property<string>("PosterPath");
|
||||
|
||||
b.Property<DateTime>("ReleaseDate");
|
||||
|
||||
b.Property<int>("RequestType");
|
||||
|
||||
b.Property<DateTime>("RequestedDate");
|
||||
|
||||
b.Property<int>("RequestedUserId");
|
||||
|
||||
b.Property<string>("Status");
|
||||
|
||||
b.Property<int>("TheMovieDbId");
|
||||
|
||||
b.Property<string>("Title");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RequestedUserId");
|
||||
|
||||
b.ToTable("MovieRequests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.TvIssues", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Description");
|
||||
|
||||
b.Property<int?>("IssueId");
|
||||
|
||||
b.Property<string>("Subect");
|
||||
|
||||
b.Property<int>("TvId");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IssueId");
|
||||
|
||||
b.HasIndex("TvId");
|
||||
|
||||
b.ToTable("TvIssues");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.TvRequests", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("ImdbId");
|
||||
|
||||
b.Property<string>("Overview");
|
||||
|
||||
b.Property<string>("PosterPath");
|
||||
|
||||
b.Property<DateTime>("ReleaseDate");
|
||||
|
||||
b.Property<int?>("RootFolder");
|
||||
|
||||
b.Property<string>("Status");
|
||||
|
||||
b.Property<string>("Title");
|
||||
|
||||
b.Property<int>("TvDbId");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TvRequests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Alias");
|
||||
|
||||
b.Property<string>("ClaimsSerialized");
|
||||
|
||||
b.Property<string>("EmailAddress");
|
||||
|
||||
b.Property<string>("Password");
|
||||
|
||||
b.Property<byte[]>("Salt");
|
||||
|
||||
b.Property<int>("UserType");
|
||||
|
||||
b.Property<string>("Username");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<DateTime>("AirDate");
|
||||
|
||||
b.Property<bool>("Approved");
|
||||
|
||||
b.Property<bool>("Available");
|
||||
|
||||
b.Property<int>("EpisodeNumber");
|
||||
|
||||
b.Property<bool>("Requested");
|
||||
|
||||
b.Property<int>("SeasonId");
|
||||
|
||||
b.Property<string>("Title");
|
||||
|
||||
b.Property<string>("Url");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SeasonId");
|
||||
|
||||
b.ToTable("EpisodeRequests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("ChildRequestId");
|
||||
|
||||
b.Property<int>("SeasonNumber");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ChildRequestId");
|
||||
|
||||
b.ToTable("SeasonRequests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.PlexContent")
|
||||
.WithMany("Seasons")
|
||||
.HasForeignKey("PlexContentId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.Requests.TvRequests", "ParentRequest")
|
||||
.WithMany("ChildRequests")
|
||||
.HasForeignKey("ParentRequestId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("Ombi.Store.Entities.User", "RequestedUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("RequestedUserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieIssues", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.Requests.MovieRequests")
|
||||
.WithMany("Issues")
|
||||
.HasForeignKey("IssueId");
|
||||
|
||||
b.HasOne("Ombi.Store.Entities.Requests.MovieRequests", "Movie")
|
||||
.WithMany()
|
||||
.HasForeignKey("MovieId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.User", "RequestedUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("RequestedUserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.TvIssues", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.Requests.ChildRequests")
|
||||
.WithMany("Issues")
|
||||
.HasForeignKey("IssueId");
|
||||
|
||||
b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", "Child")
|
||||
.WithMany()
|
||||
.HasForeignKey("TvId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Repository.Requests.SeasonRequests", "Season")
|
||||
.WithMany("Episodes")
|
||||
.HasForeignKey("SeasonId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", "ChildRequest")
|
||||
.WithMany("SeasonRequests")
|
||||
.HasForeignKey("ChildRequestId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
1
src/Ombi.Store/Migrations/OmbiMigrations.bat
Normal file
1
src/Ombi.Store/Migrations/OmbiMigrations.bat
Normal file
|
@ -0,0 +1 @@
|
|||
dotnet ef migrations add MIGRATIONNAME --context OmbiContext --startup-project ../Ombi/Ombi.csproj
|
|
@ -4,10 +4,6 @@
|
|||
<TargetFramework>netstandard1.6</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="SqlTables.sql" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="1.1.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" />
|
||||
|
@ -18,11 +14,6 @@
|
|||
<ItemGroup>
|
||||
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="SqlTables.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Ombi.Helpers\Ombi.Helpers.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
89
src/Ombi.Store/Sql.Designer.cs
generated
89
src/Ombi.Store/Sql.Designer.cs
generated
|
@ -1,89 +0,0 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Ombi.Store {
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
public class Sql {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Sql() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Ombi.Store.Sql", typeof(Sql).GetTypeInfo().Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to CREATE TABLE IF NOT EXISTS GlobalSettings
|
||||
///(
|
||||
/// Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
/// SettingsName varchar(50) NOT NULL,
|
||||
/// Content BLOB NOT NULL
|
||||
///);
|
||||
///
|
||||
///CREATE TABLE IF NOT EXISTS PlexContent
|
||||
///(
|
||||
/// Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
/// Title varchar(50) NOT NULL,
|
||||
/// ProviderId varchar(50) NOT NULL,
|
||||
/// Url varchar(100) NOT NULL,
|
||||
/// Key varchar(50) NOT NULL,
|
||||
/// AddedAt varchar(50) NOT NULL,
|
||||
/// Type INTEGER NOT NULL,
|
||||
/// Relea [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
public static string SqlTables {
|
||||
get {
|
||||
return ResourceManager.GetString("SqlTables", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,124 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="SqlTables" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>SqlTables.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1,175 +0,0 @@
|
|||
CREATE TABLE IF NOT EXISTS GlobalSettings
|
||||
(
|
||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
SettingsName varchar(50) NOT NULL,
|
||||
Content BLOB NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS PlexContent
|
||||
(
|
||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
Title varchar(50) NOT NULL,
|
||||
ProviderId varchar(50) NOT NULL,
|
||||
Url varchar(100) NOT NULL,
|
||||
Key varchar(50) NOT NULL,
|
||||
AddedAt varchar(50) NOT NULL,
|
||||
Type INTEGER NOT NULL,
|
||||
ReleaseYear varchar(100) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS RadarrCache
|
||||
(
|
||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
TheMovieDbId INTEGER NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS PlexSeasonsContent
|
||||
(
|
||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
PlexContentId integer not null,
|
||||
SeasonNumber INTEGER NOT NULL,
|
||||
SeasonKey INTEGER NOT NULL,
|
||||
ParentKey INTEGER NOT NULL
|
||||
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS RequestBlobs
|
||||
(
|
||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
ProviderId INTEGER NOT NULL,
|
||||
Content BLOB NOT NULL,
|
||||
Type INTEGER NOT NULL
|
||||
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS Users
|
||||
(
|
||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
Username VARCHAR(100) NOT NULL,
|
||||
Alias VARCHAR(100) NULL,
|
||||
ClaimsSerialized BLOB NOT NULL,
|
||||
EmailAddress VARCHAR(100) NULL,
|
||||
Password VARCHAR(100) NULL,
|
||||
Salt BLOB NULL,
|
||||
UserType INTEGER NOT NULL
|
||||
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS RequestHistory
|
||||
(
|
||||
|
||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
Type INTEGER NOT NULL,
|
||||
RequestedDate varchar(50) NOT NULL,
|
||||
RequestId INTEGER NOT NULL
|
||||
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS NotificationTemplates
|
||||
(
|
||||
|
||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
NotificationType INTEGER NOT NULL,
|
||||
Agent INTEGER NOT NULL,
|
||||
Subject BLOB NULL,
|
||||
Message BLOB NULL,
|
||||
Enabled INTEGER NOT NULL
|
||||
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS MovieIssues
|
||||
(
|
||||
|
||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
Subject INTEGER NOT NULL,
|
||||
Description INTEGER NOT NULL,
|
||||
MovieId INTEGER NOT NULL,
|
||||
|
||||
FOREIGN KEY (MovieId) REFERENCES MovieRequests(Id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS TvIssues
|
||||
(
|
||||
|
||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
Subject INTEGER NOT NULL,
|
||||
Description INTEGER NOT NULL,
|
||||
ChildId INTEGER NOT NULL,
|
||||
|
||||
FOREIGN KEY (ChildId) REFERENCES TvChildRequests(ChildId)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS MovieRequests (
|
||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
ImdbId VARCHAR(20) NOT NULL,
|
||||
TheMovieDbId INTEGER NOT NULL,
|
||||
Overview VARCHAR(100) NOT NULL,
|
||||
Title VARCHAR(50) NOT NULL,
|
||||
PosterPath VARCHAR(100) NOT NULL,
|
||||
ReleaseDate VARCHAR(100) NOT NULL,
|
||||
Status VARCHAR(100) NOT NULL,
|
||||
Approved INTEGER NOT NULL,
|
||||
Available INTEGER NOT NULL,
|
||||
RequestedDate VARCHAR(100) NOT NULL,
|
||||
RequestedUserId INTEGER NOT NULL,
|
||||
IssueId INTEGER NULL,
|
||||
Denied INTEGER NULL,
|
||||
DeniedReason VARCHAR(100) NULL,
|
||||
RequestType INTEGER NOT NULL,
|
||||
|
||||
FOREIGN KEY (IssueId) REFERENCES MovieIssues(Id),
|
||||
FOREIGN KEY (RequestedUserId) REFERENCES Users(Id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS TvRequests (
|
||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
ImdbId VARCHAR(20) NOT NULL,
|
||||
TvDbId INTEGER NOT NULL,
|
||||
Overview VARCHAR(100) NOT NULL,
|
||||
Title VARCHAR(50) NOT NULL,
|
||||
PosterPath VARCHAR(100) NOT NULL,
|
||||
ReleaseDate VARCHAR(100) NOT NULL,
|
||||
Status VARCHAR(100) NULL,
|
||||
RootFolder INTEGER NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ChildRequests (
|
||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
Approved INTEGER NOT NULL,
|
||||
Available INTEGER NOT NULL,
|
||||
RequestedDate VARCHAR(100) NOT NULL,
|
||||
RequestedUserId INTEGER NOT NULL,
|
||||
IssueId INTEGER NULL,
|
||||
Denied INTEGER NULL,
|
||||
DeniedReason VARCHAR(100) NULL,
|
||||
ParentRequestId INTEGER NOT NULL,
|
||||
RequestType INTEGER NOT NULL,
|
||||
|
||||
FOREIGN KEY (IssueId) REFERENCES TvIssues(Id),
|
||||
FOREIGN KEY (ParentRequestId) REFERENCES TvRequests(Id),
|
||||
FOREIGN KEY (RequestedUserId) REFERENCES Users(Id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS SeasonRequests (
|
||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
SeasonNumber INTEGER NOT NULL,
|
||||
ChildRequestId INTEGER NOT NULL,
|
||||
|
||||
FOREIGN KEY (ChildRequestId) REFERENCES ChildRequests(Id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS EpisodeRequests (
|
||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
EpisodeNumber INTEGER NOT NULL,
|
||||
Title VARCHAR(100) NOT NULL,
|
||||
AirDate VARCHAR(100) NOT NULL,
|
||||
Url VARCHAR(100) NOT NULL,
|
||||
SeasonId INTEGER NOT NULL,
|
||||
Available INTEGER NOT NULL,
|
||||
Requested INTEGER NOT NULL,
|
||||
Approved INTEGER NOT NULL,
|
||||
|
||||
|
||||
FOREIGN KEY (SeasonId) REFERENCES SeasonRequests(Id)
|
||||
);
|
|
@ -31,6 +31,7 @@ namespace Ombi.Controllers
|
|||
/// </summary>
|
||||
/// <param name="resolver">The resolver.</param>
|
||||
/// <param name="mapper">The mapper.</param>
|
||||
/// <param name="templateRepo">The templateRepo.</param>
|
||||
public SettingsController(ISettingsResolver resolver, IMapper mapper, INotificationTemplatesRepository templateRepo)
|
||||
{
|
||||
SettingsResolver = resolver;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DocumentationFile>bin\Debug\netcoreapp1.1\Swagger.xml</DocumentationFile>
|
||||
<NoWarn>1701;1702;1705;1591;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue