add lazy loading for entities
This commit is contained in:
1145
ReallifeGamemode.Server/Migrations/20190513104140_Jobs.Designer.cs
generated
Normal file
1145
ReallifeGamemode.Server/Migrations/20190513104140_Jobs.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
90
ReallifeGamemode.Server/Migrations/20190513104140_Jobs.cs
Normal file
90
ReallifeGamemode.Server/Migrations/20190513104140_Jobs.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ReallifeGamemode.Migrations
|
||||
{
|
||||
public partial class Jobs : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "JobId",
|
||||
table: "Users",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "JobId",
|
||||
table: "ServerVehicles",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Jobs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Jobs", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Users_JobId",
|
||||
table: "Users",
|
||||
column: "JobId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ServerVehicles_JobId",
|
||||
table: "ServerVehicles",
|
||||
column: "JobId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ServerVehicles_Jobs_JobId",
|
||||
table: "ServerVehicles",
|
||||
column: "JobId",
|
||||
principalTable: "Jobs",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Users_Jobs_JobId",
|
||||
table: "Users",
|
||||
column: "JobId",
|
||||
principalTable: "Jobs",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ServerVehicles_Jobs_JobId",
|
||||
table: "ServerVehicles");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Users_Jobs_JobId",
|
||||
table: "Users");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Jobs");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Users_JobId",
|
||||
table: "Users");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ServerVehicles_JobId",
|
||||
table: "ServerVehicles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "JobId",
|
||||
table: "Users");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "JobId",
|
||||
table: "ServerVehicles");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -420,6 +420,18 @@ namespace ReallifeGamemode.Migrations
|
||||
b.ToTable("Interiors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Job", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Jobs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Logs.BankAccountTransactionHistory", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -778,6 +790,8 @@ namespace ReallifeGamemode.Migrations
|
||||
|
||||
b.Property<int>("Handmoney");
|
||||
|
||||
b.Property<int?>("JobId");
|
||||
|
||||
b.Property<int>("LogUserId");
|
||||
|
||||
b.Property<string>("Name")
|
||||
@@ -813,6 +827,8 @@ namespace ReallifeGamemode.Migrations
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.HasIndex("JobId");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
@@ -915,6 +931,17 @@ namespace ReallifeGamemode.Migrations
|
||||
b.HasDiscriminator().HasValue("GroupVehicle");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.JobVehicle", b =>
|
||||
{
|
||||
b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle");
|
||||
|
||||
b.Property<int?>("JobId");
|
||||
|
||||
b.HasIndex("JobId");
|
||||
|
||||
b.HasDiscriminator().HasValue("JobVehicle");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Saves.SavedVehicle", b =>
|
||||
{
|
||||
b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle");
|
||||
@@ -1052,6 +1079,10 @@ namespace ReallifeGamemode.Migrations
|
||||
b.HasOne("ReallifeGamemode.Server.Entities.Group", "Group")
|
||||
.WithMany()
|
||||
.HasForeignKey("GroupId");
|
||||
|
||||
b.HasOne("ReallifeGamemode.Server.Entities.Job", "Job")
|
||||
.WithMany()
|
||||
.HasForeignKey("JobId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserBankAccount", b =>
|
||||
@@ -1092,6 +1123,13 @@ namespace ReallifeGamemode.Migrations
|
||||
.HasForeignKey("GroupId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.JobVehicle", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Server.Entities.Job", "Job")
|
||||
.WithMany()
|
||||
.HasForeignKey("JobId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserVehicle", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Server.Entities.User", "User")
|
||||
|
||||
Reference in New Issue
Block a user