summarize bank accounts

This commit is contained in:
hydrant
2019-05-13 20:06:19 +02:00
parent 61f049ae56
commit a21e7f887a
10 changed files with 1499 additions and 135 deletions

View File

@@ -17,11 +17,6 @@ namespace ReallifeGamemode.Migrations
table: "ServerVehicles",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "ShopId",
table: "ServerVehicles",
nullable: true);
migrationBuilder.CreateTable(
name: "Jobs",
columns: table => new
@@ -90,10 +85,6 @@ namespace ReallifeGamemode.Migrations
migrationBuilder.DropColumn(
name: "JobId",
table: "ServerVehicles");
migrationBuilder.DropColumn(
name: "ShopId",
table: "ServerVehicles");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,248 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace ReallifeGamemode.Migrations
{
public partial class BankAccountSummary : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_UserBankAccounts_Users_UserId",
table: "UserBankAccounts");
migrationBuilder.DropTable(
name: "BusinessBankAccounts");
migrationBuilder.DropTable(
name: "FactionBankAccounts");
migrationBuilder.DropTable(
name: "GroupBankAccounts");
migrationBuilder.DropPrimaryKey(
name: "PK_UserBankAccounts",
table: "UserBankAccounts");
migrationBuilder.RenameTable(
name: "UserBankAccounts",
newName: "BankAccounts");
migrationBuilder.AlterColumn<int>(
name: "UserId",
table: "BankAccounts",
nullable: true,
oldClrType: typeof(int));
migrationBuilder.AddColumn<string>(
name: "Discriminator",
table: "BankAccounts",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<int>(
name: "BusinessId",
table: "BankAccounts",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "FactionId",
table: "BankAccounts",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "GroupId",
table: "BankAccounts",
nullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_BankAccounts",
table: "BankAccounts",
column: "Id");
migrationBuilder.CreateIndex(
name: "IX_BankAccounts_BusinessId",
table: "BankAccounts",
column: "BusinessId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_BankAccounts_FactionId",
table: "BankAccounts",
column: "FactionId");
migrationBuilder.CreateIndex(
name: "IX_BankAccounts_GroupId",
table: "BankAccounts",
column: "GroupId");
migrationBuilder.AddForeignKey(
name: "FK_BankAccounts_Factions_FactionId",
table: "BankAccounts",
column: "FactionId",
principalTable: "Factions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BankAccounts_Groups_GroupId",
table: "BankAccounts",
column: "GroupId",
principalTable: "Groups",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BankAccounts_Users_UserId",
table: "BankAccounts",
column: "UserId",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_BankAccounts_Factions_FactionId",
table: "BankAccounts");
migrationBuilder.DropForeignKey(
name: "FK_BankAccounts_Groups_GroupId",
table: "BankAccounts");
migrationBuilder.DropForeignKey(
name: "FK_BankAccounts_Users_UserId",
table: "BankAccounts");
migrationBuilder.DropPrimaryKey(
name: "PK_BankAccounts",
table: "BankAccounts");
migrationBuilder.DropIndex(
name: "IX_BankAccounts_BusinessId",
table: "BankAccounts");
migrationBuilder.DropIndex(
name: "IX_BankAccounts_FactionId",
table: "BankAccounts");
migrationBuilder.DropIndex(
name: "IX_BankAccounts_GroupId",
table: "BankAccounts");
migrationBuilder.DropColumn(
name: "Discriminator",
table: "BankAccounts");
migrationBuilder.DropColumn(
name: "BusinessId",
table: "BankAccounts");
migrationBuilder.DropColumn(
name: "FactionId",
table: "BankAccounts");
migrationBuilder.DropColumn(
name: "GroupId",
table: "BankAccounts");
migrationBuilder.RenameTable(
name: "BankAccounts",
newName: "UserBankAccounts");
migrationBuilder.AlterColumn<int>(
name: "UserId",
table: "UserBankAccounts",
nullable: false,
oldClrType: typeof(int),
oldNullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_UserBankAccounts",
table: "UserBankAccounts",
column: "Id");
migrationBuilder.CreateTable(
name: "BusinessBankAccounts",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Balance = table.Column<int>(nullable: false),
BusinessId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BusinessBankAccounts", x => x.Id);
});
migrationBuilder.CreateTable(
name: "FactionBankAccounts",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Active = table.Column<bool>(nullable: false),
Balance = table.Column<int>(nullable: false),
Bic = table.Column<string>(maxLength: 12, nullable: true),
FactionId = table.Column<int>(nullable: false),
Iban = table.Column<string>(maxLength: 32, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_FactionBankAccounts", x => x.Id);
table.ForeignKey(
name: "FK_FactionBankAccounts_Factions_FactionId",
column: x => x.FactionId,
principalTable: "Factions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "GroupBankAccounts",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Balance = table.Column<int>(nullable: false),
GroupId = table.Column<int>(nullable: true)
},
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_BusinessBankAccounts_BusinessId",
table: "BusinessBankAccounts",
column: "BusinessId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_FactionBankAccounts_FactionId",
table: "FactionBankAccounts",
column: "FactionId");
migrationBuilder.CreateIndex(
name: "IX_GroupBankAccounts_GroupId",
table: "GroupBankAccounts",
column: "GroupId");
migrationBuilder.AddForeignKey(
name: "FK_UserBankAccounts_Users_UserId",
table: "UserBankAccounts",
column: "UserId",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@@ -61,21 +61,29 @@ namespace ReallifeGamemode.Migrations
b.ToTable("Bans");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.BusinessBankAccount", b =>
modelBuilder.Entity("ReallifeGamemode.Server.Entities.BankAccount", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<bool>("Active");
b.Property<int>("Balance");
b.Property<int>("BusinessId");
b.Property<string>("Bic")
.HasMaxLength(12);
b.Property<string>("Discriminator")
.IsRequired();
b.Property<string>("Iban")
.HasMaxLength(32);
b.HasKey("Id");
b.HasIndex("BusinessId")
.IsUnique();
b.ToTable("BankAccounts");
b.ToTable("BusinessBankAccounts");
b.HasDiscriminator<string>("Discriminator").HasValue("BankAccount");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Character", b =>
@@ -311,30 +319,6 @@ namespace ReallifeGamemode.Migrations
b.ToTable("Factions");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionBankAccount", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<bool>("Active");
b.Property<int>("Balance");
b.Property<string>("Bic")
.HasMaxLength(12);
b.Property<int>("FactionId");
b.Property<string>("Iban")
.HasMaxLength(32);
b.HasKey("Id");
b.HasIndex("FactionId");
b.ToTable("FactionBankAccounts");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionRank", b =>
{
b.Property<int>("Id")
@@ -386,22 +370,6 @@ namespace ReallifeGamemode.Migrations
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")
@@ -832,30 +800,6 @@ namespace ReallifeGamemode.Migrations
b.ToTable("Users");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserBankAccount", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<bool>("Active");
b.Property<int>("Balance");
b.Property<string>("Bic")
.HasMaxLength(12);
b.Property<string>("Iban")
.HasMaxLength(32);
b.Property<int>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("UserBankAccounts");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserItem", b =>
{
b.Property<int>("Id")
@@ -907,6 +851,51 @@ namespace ReallifeGamemode.Migrations
b.ToTable("WhitelistEntries");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.BusinessBankAccount", b =>
{
b.HasBaseType("ReallifeGamemode.Server.Entities.BankAccount");
b.Property<int>("BusinessId");
b.HasIndex("BusinessId")
.IsUnique();
b.HasDiscriminator().HasValue("BusinessBankAccount");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionBankAccount", b =>
{
b.HasBaseType("ReallifeGamemode.Server.Entities.BankAccount");
b.Property<int>("FactionId");
b.HasIndex("FactionId");
b.HasDiscriminator().HasValue("FactionBankAccount");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.GroupBankAccount", b =>
{
b.HasBaseType("ReallifeGamemode.Server.Entities.BankAccount");
b.Property<int?>("GroupId");
b.HasIndex("GroupId");
b.HasDiscriminator().HasValue("GroupBankAccount");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserBankAccount", b =>
{
b.HasBaseType("ReallifeGamemode.Server.Entities.BankAccount");
b.Property<int>("UserId");
b.HasIndex("UserId");
b.HasDiscriminator().HasValue("UserBankAccount");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionVehicle", b =>
{
b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle");
@@ -957,8 +946,6 @@ namespace ReallifeGamemode.Migrations
b.Property<int>("Price");
b.Property<int?>("ShopId");
b.ToTable("ShopVehicles");
b.HasDiscriminator().HasValue("ShopVehicle");
@@ -1016,14 +1003,6 @@ namespace ReallifeGamemode.Migrations
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionBankAccount", b =>
{
b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction")
.WithMany()
.HasForeignKey("FactionId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionRank", b =>
{
b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction")
@@ -1032,13 +1011,6 @@ 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")
@@ -1085,14 +1057,6 @@ namespace ReallifeGamemode.Migrations
.HasForeignKey("JobId");
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserBankAccount", b =>
{
b.HasOne("ReallifeGamemode.Server.Entities.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserItem", b =>
{
b.HasOne("ReallifeGamemode.Server.Entities.User", "User")
@@ -1109,6 +1073,29 @@ namespace ReallifeGamemode.Migrations
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionBankAccount", b =>
{
b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction")
.WithMany()
.HasForeignKey("FactionId")
.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.UserBankAccount", b =>
{
b.HasOne("ReallifeGamemode.Server.Entities.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionVehicle", b =>
{
b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction")