start group system

This commit is contained in:
Lennart Kampshoff
2019-05-05 17:07:29 +02:00
parent e1dd54b7c5
commit a34c03eae9
9 changed files with 1382 additions and 3 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,118 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace ReallifeGamemode.Migrations
{
public partial class Groups : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "GroupId",
table: "Users",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "GroupId",
table: "ServerVehicles",
nullable: true);
migrationBuilder.CreateTable(
name: "Groups",
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_Groups", x => x.Id);
});
migrationBuilder.CreateTable(
name: "GroupBankAccounts",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
GroupId = table.Column<int>(nullable: true),
Balance = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GroupBankAccounts", x => x.Id);
table.ForeignKey(
name: "FK_GroupBankAccounts_Groups_GroupId",
column: x => x.GroupId,
principalTable: "Groups",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_Users_GroupId",
table: "Users",
column: "GroupId");
migrationBuilder.CreateIndex(
name: "IX_ServerVehicles_GroupId",
table: "ServerVehicles",
column: "GroupId");
migrationBuilder.CreateIndex(
name: "IX_GroupBankAccounts_GroupId",
table: "GroupBankAccounts",
column: "GroupId");
migrationBuilder.AddForeignKey(
name: "FK_ServerVehicles_Groups_GroupId",
table: "ServerVehicles",
column: "GroupId",
principalTable: "Groups",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Users_Groups_GroupId",
table: "Users",
column: "GroupId",
principalTable: "Groups",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ServerVehicles_Groups_GroupId",
table: "ServerVehicles");
migrationBuilder.DropForeignKey(
name: "FK_Users_Groups_GroupId",
table: "Users");
migrationBuilder.DropTable(
name: "GroupBankAccounts");
migrationBuilder.DropTable(
name: "Groups");
migrationBuilder.DropIndex(
name: "IX_Users_GroupId",
table: "Users");
migrationBuilder.DropIndex(
name: "IX_ServerVehicles_GroupId",
table: "ServerVehicles");
migrationBuilder.DropColumn(
name: "GroupId",
table: "Users");
migrationBuilder.DropColumn(
name: "GroupId",
table: "ServerVehicles");
}
}
}

View File

@@ -374,6 +374,34 @@ namespace ReallifeGamemode.Migrations
b.ToTable("GotoPoints");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Group", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.HasKey("Id");
b.ToTable("Groups");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.GroupBankAccount", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("Balance");
b.Property<int?>("GroupId");
b.HasKey("Id");
b.HasIndex("GroupId");
b.ToTable("GroupBankAccounts");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Interior", b =>
{
b.Property<int>("Id")
@@ -744,6 +772,8 @@ namespace ReallifeGamemode.Migrations
b.Property<int?>("FactionRankId");
b.Property<int?>("GroupId");
b.Property<int>("Handmoney");
b.Property<int>("LogUserId");
@@ -779,6 +809,8 @@ namespace ReallifeGamemode.Migrations
b.HasIndex("FactionRankId");
b.HasIndex("GroupId");
b.ToTable("Users");
});
@@ -870,6 +902,17 @@ namespace ReallifeGamemode.Migrations
b.HasDiscriminator().HasValue("FactionVehicle");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.GroupVehicle", b =>
{
b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle");
b.Property<int?>("GroupId");
b.HasIndex("GroupId");
b.HasDiscriminator().HasValue("GroupVehicle");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Saves.SavedVehicle", b =>
{
b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle");
@@ -960,6 +1003,13 @@ namespace ReallifeGamemode.Migrations
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.GroupBankAccount", b =>
{
b.HasOne("ReallifeGamemode.Server.Entities.Group", "Group")
.WithMany()
.HasForeignKey("GroupId");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Logs.Death", b =>
{
b.HasOne("ReallifeGamemode.Server.Entities.User", "Killer")
@@ -996,6 +1046,10 @@ namespace ReallifeGamemode.Migrations
b.HasOne("ReallifeGamemode.Server.Entities.FactionRank", "FactionRank")
.WithMany()
.HasForeignKey("FactionRankId");
b.HasOne("ReallifeGamemode.Server.Entities.Group", "Group")
.WithMany()
.HasForeignKey("GroupId");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserBankAccount", b =>
@@ -1029,6 +1083,13 @@ namespace ReallifeGamemode.Migrations
.HasForeignKey("FactionId");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.GroupVehicle", b =>
{
b.HasOne("ReallifeGamemode.Server.Entities.Group", "Group")
.WithMany()
.HasForeignKey("GroupId");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserVehicle", b =>
{
b.HasOne("ReallifeGamemode.Server.Entities.User", "User")