Skip to content

Commit 96b2efc

Browse files
committed
feat(example-models): make owner optional on todo item
1 parent 72a95ee commit 96b2efc

File tree

2 files changed

+109
-0
lines changed

2 files changed

+109
-0
lines changed

src/JsonApiDotNetCoreExample/Migrations/20170228175630_MakeOwnerOptionalOnTodoItems.Designer.cs

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Microsoft.EntityFrameworkCore.Migrations;
4+
5+
namespace JsonApiDotNetCoreExample.Migrations
6+
{
7+
public partial class MakeOwnerOptionalOnTodoItems : Migration
8+
{
9+
protected override void Up(MigrationBuilder migrationBuilder)
10+
{
11+
migrationBuilder.DropForeignKey(
12+
name: "FK_TodoItems_People_OwnerId",
13+
table: "TodoItems");
14+
15+
migrationBuilder.AlterColumn<int>(
16+
name: "OwnerId",
17+
table: "TodoItems",
18+
nullable: true);
19+
20+
migrationBuilder.AddForeignKey(
21+
name: "FK_TodoItems_People_OwnerId",
22+
table: "TodoItems",
23+
column: "OwnerId",
24+
principalTable: "People",
25+
principalColumn: "Id",
26+
onDelete: ReferentialAction.Restrict);
27+
}
28+
29+
protected override void Down(MigrationBuilder migrationBuilder)
30+
{
31+
migrationBuilder.DropForeignKey(
32+
name: "FK_TodoItems_People_OwnerId",
33+
table: "TodoItems");
34+
35+
migrationBuilder.AlterColumn<int>(
36+
name: "OwnerId",
37+
table: "TodoItems",
38+
nullable: false);
39+
40+
migrationBuilder.AddForeignKey(
41+
name: "FK_TodoItems_People_OwnerId",
42+
table: "TodoItems",
43+
column: "OwnerId",
44+
principalTable: "People",
45+
principalColumn: "Id",
46+
onDelete: ReferentialAction.Cascade);
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)