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
|
namespace NadekoBot.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(NadekoSqliteContext))]
|
[DbContext(typeof(NadekoSqliteContext))]
|
||||||
[Migration("20161001173937_first")]
|
[Migration("20161002021256_first")]
|
||||||
partial class first
|
partial class first
|
||||||
{
|
{
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -633,7 +633,8 @@ namespace NadekoBot.Migrations
|
|||||||
{
|
{
|
||||||
b.HasOne("NadekoBot.Services.Database.Models.MusicPlaylist")
|
b.HasOne("NadekoBot.Services.Database.Models.MusicPlaylist")
|
||||||
.WithMany("Songs")
|
.WithMany("Songs")
|
||||||
.HasForeignKey("MusicPlaylistId");
|
.HasForeignKey("MusicPlaylistId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.RaceAnimal", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.RaceAnimal", b =>
|
@ -426,7 +426,7 @@ namespace NadekoBot.Migrations
|
|||||||
column: x => x.MusicPlaylistId,
|
column: x => x.MusicPlaylistId,
|
||||||
principalTable: "MusicPlaylists",
|
principalTable: "MusicPlaylists",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.Restrict);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
@ -632,7 +632,8 @@ namespace NadekoBot.Migrations
|
|||||||
{
|
{
|
||||||
b.HasOne("NadekoBot.Services.Database.Models.MusicPlaylist")
|
b.HasOne("NadekoBot.Services.Database.Models.MusicPlaylist")
|
||||||
.WithMany("Songs")
|
.WithMany("Songs")
|
||||||
.HasForeignKey("MusicPlaylistId");
|
.HasForeignKey("MusicPlaylistId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.RaceAnimal", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.RaceAnimal", b =>
|
||||||
|
@ -208,7 +208,7 @@ namespace NadekoBot.Services.Database
|
|||||||
var musicPlaylistEntity = modelBuilder.Entity<MusicPlaylist>();
|
var musicPlaylistEntity = modelBuilder.Entity<MusicPlaylist>();
|
||||||
|
|
||||||
musicPlaylistEntity
|
musicPlaylistEntity
|
||||||
.HasMany<PlaylistSong>(p => p.Songs)
|
.HasMany(p => p.Songs)
|
||||||
.WithOne()
|
.WithOne()
|
||||||
.OnDelete(Microsoft.EntityFrameworkCore.Metadata.DeleteBehavior.Cascade);
|
.OnDelete(Microsoft.EntityFrameworkCore.Metadata.DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user