mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-08 10:44:20 -04:00
Adding unique & index field to slugs
This commit is contained in:
parent
0c9b3d04c3
commit
e890c05660
@ -124,6 +124,26 @@ namespace Kyoo
|
|||||||
.Ignore(x => x.Name);
|
.Ignore(x => x.Name);
|
||||||
modelBuilder.Entity<PeopleLink>()
|
modelBuilder.Entity<PeopleLink>()
|
||||||
.Ignore(x => x.ExternalIDs);
|
.Ignore(x => x.ExternalIDs);
|
||||||
|
|
||||||
|
|
||||||
|
modelBuilder.Entity<Collection>()
|
||||||
|
.HasIndex(x => x.Slug)
|
||||||
|
.IsUnique();
|
||||||
|
modelBuilder.Entity<Genre>()
|
||||||
|
.HasIndex(x => x.Slug)
|
||||||
|
.IsUnique();
|
||||||
|
modelBuilder.Entity<Library>()
|
||||||
|
.HasIndex(x => x.Slug)
|
||||||
|
.IsUnique();
|
||||||
|
modelBuilder.Entity<People>()
|
||||||
|
.HasIndex(x => x.Slug)
|
||||||
|
.IsUnique();
|
||||||
|
modelBuilder.Entity<Show>()
|
||||||
|
.HasIndex(x => x.Slug)
|
||||||
|
.IsUnique();
|
||||||
|
modelBuilder.Entity<Studio>()
|
||||||
|
.HasIndex(x => x.Slug)
|
||||||
|
.IsUnique();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
namespace Kyoo.Models.DatabaseMigrations.Internal
|
namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||||
{
|
{
|
||||||
[DbContext(typeof(DatabaseContext))]
|
[DbContext(typeof(DatabaseContext))]
|
||||||
[Migration("20200413152648_Initial")]
|
[Migration("20200414223325_Initial")]
|
||||||
partial class Initial
|
partial class Initial
|
||||||
{
|
{
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -41,6 +41,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
|||||||
|
|
||||||
b.HasKey("ID");
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.HasIndex("Slug")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("Collections");
|
b.ToTable("Collections");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -130,6 +133,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
|||||||
|
|
||||||
b.HasKey("ID");
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.HasIndex("Slug")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("Genres");
|
b.ToTable("Genres");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -168,6 +174,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
|||||||
|
|
||||||
b.HasKey("ID");
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.HasIndex("Slug")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("Libraries");
|
b.ToTable("Libraries");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -213,6 +222,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
|||||||
|
|
||||||
b.HasKey("Slug");
|
b.HasKey("Slug");
|
||||||
|
|
||||||
|
b.HasIndex("Slug")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("Peoples");
|
b.ToTable("Peoples");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -333,6 +345,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");
|
||||||
@ -352,6 +367,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
|||||||
|
|
||||||
b.HasKey("ID");
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.HasIndex("Slug")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("Studios");
|
b.ToTable("Studios");
|
||||||
});
|
});
|
||||||
|
|
@ -325,6 +325,12 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
|||||||
table: "CollectionLinks",
|
table: "CollectionLinks",
|
||||||
column: "ShowID");
|
column: "ShowID");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Collections_Slug",
|
||||||
|
table: "Collections",
|
||||||
|
column: "Slug",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Episodes_SeasonID",
|
name: "IX_Episodes_SeasonID",
|
||||||
table: "Episodes",
|
table: "Episodes",
|
||||||
@ -340,6 +346,18 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
|||||||
table: "GenreLinks",
|
table: "GenreLinks",
|
||||||
column: "GenreID");
|
column: "GenreID");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Genres_Slug",
|
||||||
|
table: "Genres",
|
||||||
|
column: "Slug",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Libraries_Slug",
|
||||||
|
table: "Libraries",
|
||||||
|
column: "Slug",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_LibraryLinks_CollectionID",
|
name: "IX_LibraryLinks_CollectionID",
|
||||||
table: "LibraryLinks",
|
table: "LibraryLinks",
|
||||||
@ -365,16 +383,34 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
|||||||
table: "PeopleLinks",
|
table: "PeopleLinks",
|
||||||
column: "ShowID");
|
column: "ShowID");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Peoples_Slug",
|
||||||
|
table: "Peoples",
|
||||||
|
column: "Slug",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Seasons_ShowID",
|
name: "IX_Seasons_ShowID",
|
||||||
table: "Seasons",
|
table: "Seasons",
|
||||||
column: "ShowID");
|
column: "ShowID");
|
||||||
|
|
||||||
|
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",
|
||||||
column: "StudioID");
|
column: "StudioID");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Studios_Slug",
|
||||||
|
table: "Studios",
|
||||||
|
column: "Slug",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Tracks_EpisodeID",
|
name: "IX_Tracks_EpisodeID",
|
||||||
table: "Tracks",
|
table: "Tracks",
|
@ -39,6 +39,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
|||||||
|
|
||||||
b.HasKey("ID");
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.HasIndex("Slug")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("Collections");
|
b.ToTable("Collections");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -128,6 +131,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
|||||||
|
|
||||||
b.HasKey("ID");
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.HasIndex("Slug")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("Genres");
|
b.ToTable("Genres");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -166,6 +172,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
|||||||
|
|
||||||
b.HasKey("ID");
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.HasIndex("Slug")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("Libraries");
|
b.ToTable("Libraries");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -211,6 +220,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
|||||||
|
|
||||||
b.HasKey("Slug");
|
b.HasKey("Slug");
|
||||||
|
|
||||||
|
b.HasIndex("Slug")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("Peoples");
|
b.ToTable("Peoples");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -331,6 +343,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");
|
||||||
@ -350,6 +365,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
|||||||
|
|
||||||
b.HasKey("ID");
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.HasIndex("Slug")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("Studios");
|
b.ToTable("Studios");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -52,8 +52,8 @@ namespace Kyoo
|
|||||||
services.AddDbContext<DatabaseContext>(options =>
|
services.AddDbContext<DatabaseContext>(options =>
|
||||||
{
|
{
|
||||||
options.UseLazyLoadingProxies()
|
options.UseLazyLoadingProxies()
|
||||||
.UseSqlite(_configuration.GetConnectionString("Database"))
|
.UseSqlite(_configuration.GetConnectionString("Database"));
|
||||||
.UseLoggerFactory(LoggerFactory.Create(builder => builder.AddConsole()));
|
//.UseLoggerFactory(LoggerFactory.Create(builder => builder.AddConsole()));
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddDbContext<IdentityDatabase>(options =>
|
services.AddDbContext<IdentityDatabase>(options =>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user