Merge pull request #667 from Nitix/foreign-key

Fix Foreign key with delete on cascade
This commit is contained in:
Master Kwoth 2016-10-02 04:50:09 +02:00 committed by GitHub
commit 4459c19e70
4 changed files with 7 additions and 5 deletions

View File

@ -8,7 +8,7 @@ using NadekoBot.Services.Database.Impl;
namespace NadekoBot.Migrations
{
[DbContext(typeof(NadekoSqliteContext))]
[Migration("20161001173937_first")]
[Migration("20161002021256_first")]
partial class first
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -633,7 +633,8 @@ namespace NadekoBot.Migrations
{
b.HasOne("NadekoBot.Services.Database.Models.MusicPlaylist")
.WithMany("Songs")
.HasForeignKey("MusicPlaylistId");
.HasForeignKey("MusicPlaylistId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Services.Database.Models.RaceAnimal", b =>

View File

@ -426,7 +426,7 @@ namespace NadekoBot.Migrations
column: x => x.MusicPlaylistId,
principalTable: "MusicPlaylists",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(

View File

@ -632,7 +632,8 @@ namespace NadekoBot.Migrations
{
b.HasOne("NadekoBot.Services.Database.Models.MusicPlaylist")
.WithMany("Songs")
.HasForeignKey("MusicPlaylistId");
.HasForeignKey("MusicPlaylistId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Services.Database.Models.RaceAnimal", b =>

View File

@ -208,7 +208,7 @@ namespace NadekoBot.Services.Database
var musicPlaylistEntity = modelBuilder.Entity<MusicPlaylist>();
musicPlaylistEntity
.HasMany<PlaylistSong>(p => p.Songs)
.HasMany(p => p.Songs)
.WithOne()
.OnDelete(Microsoft.EntityFrameworkCore.Metadata.DeleteBehavior.Cascade);