mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Updating migrations to use the unique slug of shows
This commit is contained in:
parent
d3a126bf03
commit
9d6efebcf2
@ -10,7 +10,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
namespace Kyoo.Models.DatabaseMigrations.Internal
|
namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||||
{
|
{
|
||||||
[DbContext(typeof(DatabaseContext))]
|
[DbContext(typeof(DatabaseContext))]
|
||||||
[Migration("20200623000428_Initial")]
|
[Migration("20200623233713_Initial")]
|
||||||
partial class Initial
|
partial class Initial
|
||||||
{
|
{
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -432,6 +432,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
|||||||
|
|
||||||
b.HasKey("ID");
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.HasIndex("Slug")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
b.HasIndex("StudioID");
|
b.HasIndex("StudioID");
|
||||||
|
|
||||||
b.ToTable("Shows");
|
b.ToTable("Shows");
|
@ -523,6 +523,12 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
|||||||
columns: new[] { "ShowID", "SeasonNumber" },
|
columns: new[] { "ShowID", "SeasonNumber" },
|
||||||
unique: true);
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Shows_Slug",
|
||||||
|
table: "Shows",
|
||||||
|
column: "Slug",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Shows_StudioID",
|
name: "IX_Shows_StudioID",
|
||||||
table: "Shows",
|
table: "Shows",
|
@ -430,6 +430,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
|||||||
|
|
||||||
b.HasKey("ID");
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.HasIndex("Slug")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
b.HasIndex("StudioID");
|
b.HasIndex("StudioID");
|
||||||
|
|
||||||
b.ToTable("Shows");
|
b.ToTable("Shows");
|
||||||
|
@ -150,6 +150,12 @@ namespace Kyoo.Controllers
|
|||||||
Regex regex = new Regex(patern, RegexOptions.IgnoreCase);
|
Regex regex = new Regex(patern, RegexOptions.IgnoreCase);
|
||||||
Match match = regex.Match(relativePath);
|
Match match = regex.Match(relativePath);
|
||||||
|
|
||||||
|
if (!match.Success)
|
||||||
|
{
|
||||||
|
await Console.Error.WriteLineAsync($"The episode at {path} does not match the episode's regex.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string showPath = Path.GetDirectoryName(path);
|
string showPath = Path.GetDirectoryName(path);
|
||||||
string collectionName = match.Groups["Collection"]?.Value;
|
string collectionName = match.Groups["Collection"]?.Value;
|
||||||
string showName = match.Groups["Show"].Value;
|
string showName = match.Groups["Show"].Value;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user