Merge pull request #667 from Nitix/foreign-key
Fix Foreign key with delete on cascade
This commit is contained in:
commit
4459c19e70
@ -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 =>
|
@ -426,7 +426,7 @@ namespace NadekoBot.Migrations
|
||||
column: x => x.MusicPlaylistId,
|
||||
principalTable: "MusicPlaylists",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
@ -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 =>
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user