summarize bank accounts
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user