fix user -> house relation
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ReallifeGamemode.Migrations
|
||||
{
|
||||
public partial class UserHouseReference : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Houses_UserId",
|
||||
table: "Houses");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Users_HouseId",
|
||||
table: "Users",
|
||||
column: "HouseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Houses_UserId",
|
||||
table: "Houses",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Users_Houses_HouseId",
|
||||
table: "Users",
|
||||
column: "HouseId",
|
||||
principalTable: "Houses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Users_Houses_HouseId",
|
||||
table: "Users");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Users_HouseId",
|
||||
table: "Users");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Houses_UserId",
|
||||
table: "Houses");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Houses_UserId",
|
||||
table: "Houses",
|
||||
column: "UserId",
|
||||
unique: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user