mirror of https://github.com/ErsatzTV/ErsatzTV.git
4 changed files with 1566 additions and 1 deletions
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
using ErsatzTV.Core.Domain; |
||||
using Microsoft.EntityFrameworkCore; |
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders; |
||||
|
||||
namespace ErsatzTV.Infrastructure.Data.Configurations |
||||
{ |
||||
public class SeasonMetadataConfiguration : IEntityTypeConfiguration<SeasonMetadata> |
||||
{ |
||||
public void Configure(EntityTypeBuilder<SeasonMetadata> builder) |
||||
{ |
||||
builder.ToTable("SeasonMetadata"); |
||||
|
||||
builder.HasMany(em => em.Artwork) |
||||
.WithOne() |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
} |
||||
} |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,37 @@
@@ -0,0 +1,37 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations |
||||
{ |
||||
public partial class Add_SeasonMetadataCascade : Migration |
||||
{ |
||||
protected override void Up(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.DropForeignKey( |
||||
"FK_Artwork_SeasonMetadata_SeasonMetadataId", |
||||
"Artwork"); |
||||
|
||||
migrationBuilder.AddForeignKey( |
||||
"FK_Artwork_SeasonMetadata_SeasonMetadataId", |
||||
"Artwork", |
||||
"SeasonMetadataId", |
||||
"SeasonMetadata", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
} |
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.DropForeignKey( |
||||
"FK_Artwork_SeasonMetadata_SeasonMetadataId", |
||||
"Artwork"); |
||||
|
||||
migrationBuilder.AddForeignKey( |
||||
"FK_Artwork_SeasonMetadata_SeasonMetadataId", |
||||
"Artwork", |
||||
"SeasonMetadataId", |
||||
"SeasonMetadata", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Restrict); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue