fix user -> house relation
This commit is contained in:
@@ -69,8 +69,9 @@ namespace ReallifeGamemode.Server.Entities
|
|||||||
|
|
||||||
public GroupRank GroupRank { get; set; }
|
public GroupRank GroupRank { get; set; }
|
||||||
|
|
||||||
public House House { get; set; }
|
[ForeignKey("House")]
|
||||||
public int? HouseId { get; set; }
|
public int? HouseId { get; set; }
|
||||||
|
public House House { get; set; }
|
||||||
|
|
||||||
public int? JobId { get; set; }
|
public int? JobId { get; set; }
|
||||||
|
|
||||||
|
|||||||
1159
ReallifeGamemode.Server/Migrations/20190627162731_UserHouseReference.Designer.cs
generated
Normal file
1159
ReallifeGamemode.Server/Migrations/20190627162731_UserHouseReference.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -423,8 +423,7 @@ namespace ReallifeGamemode.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("UserId")
|
b.HasIndex("UserId");
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("Houses");
|
b.ToTable("Houses");
|
||||||
});
|
});
|
||||||
@@ -846,6 +845,8 @@ namespace ReallifeGamemode.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GroupId");
|
b.HasIndex("GroupId");
|
||||||
|
|
||||||
|
b.HasIndex("HouseId");
|
||||||
|
|
||||||
b.ToTable("Users");
|
b.ToTable("Users");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1055,8 +1056,8 @@ namespace ReallifeGamemode.Migrations
|
|||||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.House", b =>
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.House", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("ReallifeGamemode.Server.Entities.User", "User")
|
b.HasOne("ReallifeGamemode.Server.Entities.User", "User")
|
||||||
.WithOne("House")
|
.WithMany()
|
||||||
.HasForeignKey("ReallifeGamemode.Server.Entities.House", "UserId");
|
.HasForeignKey("UserId");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Logs.Death", b =>
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Logs.Death", b =>
|
||||||
@@ -1099,6 +1100,10 @@ namespace ReallifeGamemode.Migrations
|
|||||||
b.HasOne("ReallifeGamemode.Server.Entities.Group", "Group")
|
b.HasOne("ReallifeGamemode.Server.Entities.Group", "Group")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("GroupId");
|
.HasForeignKey("GroupId");
|
||||||
|
|
||||||
|
b.HasOne("ReallifeGamemode.Server.Entities.House", "House")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("HouseId");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserBankAccount", b =>
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserBankAccount", b =>
|
||||||
|
|||||||
Reference in New Issue
Block a user