Skip to content
Snippets Groups Projects
Commit 0fb27260 authored by Janis Daniel Dähne's avatar Janis Daniel Dähne
Browse files

- fk on release to exercise restrict

parent 37fa3940
No related branches found
No related tags found
No related merge requests found
......@@ -587,7 +587,7 @@ namespace ClientServer.Db
.WithOne(p => p.Exercise)
.HasForeignKey(p => p.ExerciseId)
.IsRequired()
.OnDelete(DeleteBehavior.Cascade)
.OnDelete(DeleteBehavior.Restrict)
;
......
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace ClientServer.Migrations
{
public partial class EnsureNoReleaseDeleteEx : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ExerciseReleases_Exercises_ExerciseId",
table: "ExerciseReleases");
migrationBuilder.AddForeignKey(
name: "FK_ExerciseReleases_Exercises_ExerciseId",
table: "ExerciseReleases",
column: "ExerciseId",
principalTable: "Exercises",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ExerciseReleases_Exercises_ExerciseId",
table: "ExerciseReleases");
migrationBuilder.AddForeignKey(
name: "FK_ExerciseReleases_Exercises_ExerciseId",
table: "ExerciseReleases",
column: "ExerciseId",
principalTable: "Exercises",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}
......@@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using ClientServer.Db;
using ClientServer.Models.Exercises.Release;
namespace ClientServer.Migrations
{
......@@ -1900,8 +1901,7 @@ namespace ClientServer.Migrations
{
b.HasOne("ClientServer.Models.Exercises.Exercise", "Exercise")
.WithMany("Releases")
.HasForeignKey("ExerciseId")
.OnDelete(DeleteBehavior.Cascade);
.HasForeignKey("ExerciseId");
b.HasOne("ClientServer.Models.PLang", "PLang")
.WithMany()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment