bank account refactor
This commit is contained in:
17
ReallifeGamemode.Database/BankAccountHolder.cs
Normal file
17
ReallifeGamemode.Database/BankAccountHolder.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Database
|
||||
{
|
||||
public abstract class BankAccountHolder<T> where T : class, IBankAccount, new()
|
||||
{
|
||||
public abstract string BankAccountName { get; }
|
||||
|
||||
[ForeignKey(nameof(BankAccountId))]
|
||||
public virtual T BankAccount { get; set; }
|
||||
|
||||
public virtual int? BankAccountId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ using ReallifeGamemode.Database.Models;
|
||||
|
||||
namespace ReallifeGamemode.Database.Entities
|
||||
{
|
||||
public partial class Faction : IBankAccountOwner
|
||||
public partial class Faction : BankAccountHolder<FactionBankAccount>
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
@@ -21,19 +21,6 @@ namespace ReallifeGamemode.Database.Entities
|
||||
public bool StateOwned { get; set; }
|
||||
public int WeaponDealTime { get; set; } = 60;
|
||||
|
||||
public IBankAccount GetBankAccount(DatabaseContext databaseContext = null)
|
||||
{
|
||||
if (databaseContext == null)
|
||||
{
|
||||
using (databaseContext = new DatabaseContext())
|
||||
{
|
||||
return databaseContext.FactionBankAccounts.FirstOrDefault(u => u.FactionId == this.Id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return databaseContext.FactionBankAccounts.FirstOrDefault(u => u.FactionId == this.Id);
|
||||
}
|
||||
}
|
||||
public override string BankAccountName => Name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,14 +13,16 @@ namespace ReallifeGamemode.Database.Entities
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
[ForeignKey("Faction")]
|
||||
public int FactionId { get; set; }
|
||||
public Faction Faction { get; set; }
|
||||
|
||||
[StringLength(12)]
|
||||
public string Bic { get; set; }
|
||||
|
||||
[StringLength(32)]
|
||||
public string Iban { get; set; }
|
||||
|
||||
public int Balance { get; set; }
|
||||
|
||||
public bool Active { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ using ReallifeGamemode.Database.Models;
|
||||
|
||||
namespace ReallifeGamemode.Database.Entities
|
||||
{
|
||||
public partial class Group : IBankAccountOwner
|
||||
public partial class Group : BankAccountHolder<GroupBankAccount>
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
@@ -14,34 +14,6 @@ namespace ReallifeGamemode.Database.Entities
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public IBankAccount GetBankAccount(DatabaseContext databaseContext = null)
|
||||
{
|
||||
GroupBankAccount bankAccount = null;
|
||||
if (databaseContext == null)
|
||||
{
|
||||
using (databaseContext = new DatabaseContext())
|
||||
{
|
||||
bankAccount = databaseContext.GroupBankAccounts.Include(g => g.Group).Where(g => g.Group == this).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bankAccount = databaseContext.GroupBankAccounts.Include(g => g.Group).Where(g => g.Group == this).FirstOrDefault();
|
||||
}
|
||||
|
||||
if (bankAccount == null)
|
||||
{
|
||||
bankAccount = new GroupBankAccount
|
||||
{
|
||||
Group = this,
|
||||
Balance = 0
|
||||
};
|
||||
|
||||
databaseContext.GroupBankAccounts.Add(bankAccount);
|
||||
databaseContext.SaveChanges();
|
||||
}
|
||||
|
||||
return bankAccount;
|
||||
}
|
||||
public override string BankAccountName => Name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,6 @@ namespace ReallifeGamemode.Database.Entities
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
public Group Group { get; set; }
|
||||
|
||||
public int Balance { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ using ReallifeGamemode.Server.Types;
|
||||
|
||||
namespace ReallifeGamemode.Database.Entities
|
||||
{
|
||||
public partial class User : IBankAccountOwner
|
||||
public partial class User : BankAccountHolder<UserBankAccount>
|
||||
{
|
||||
[NotMapped]
|
||||
private int _wanteds;
|
||||
@@ -98,27 +98,12 @@ namespace ReallifeGamemode.Database.Entities
|
||||
|
||||
public bool IsAdmin(AdminLevel level) => AdminLevel >= level;
|
||||
|
||||
public IBankAccount GetBankAccount(DatabaseContext databaseContext = null)
|
||||
{
|
||||
if (databaseContext == null)
|
||||
{
|
||||
using (databaseContext = new DatabaseContext())
|
||||
{
|
||||
return databaseContext.UserBankAccounts.FirstOrDefault(u => u.UserId == this.Id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return databaseContext.UserBankAccounts.FirstOrDefault(u => u.UserId == this.Id);
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public Player Player
|
||||
{
|
||||
get => NAPI.Pools.GetAllPlayers().Where(c => c.Name.ToLower() == this.Name.ToLower()).FirstOrDefault();
|
||||
}
|
||||
|
||||
|
||||
public override string BankAccountName => Name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,28 +17,30 @@ namespace ReallifeGamemode.Database.Entities
|
||||
[NotMapped]
|
||||
private int _balance;
|
||||
|
||||
public delegate void BankAccountBalanceChangedEvent(UserBankAccount account);
|
||||
public static event BankAccountBalanceChangedEvent BalanceChanged;
|
||||
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
[ForeignKey("User")]
|
||||
public int UserId { get; set; }
|
||||
public User User { get; set; }
|
||||
|
||||
[StringLength(12)]
|
||||
public string Bic { get; set; }
|
||||
|
||||
[StringLength(32)]
|
||||
public string Iban { get; set; }
|
||||
|
||||
public int Balance
|
||||
{
|
||||
get => _balance;
|
||||
|
||||
set
|
||||
{
|
||||
_balance = value;
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
PlayerService.GetPlayerByNameOrId(dbContext.Users.First(u => u.Id == UserId).Name).TriggerEvent("updateMoney", value);
|
||||
}
|
||||
BalanceChanged?.Invoke(this);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Active { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
95
ReallifeGamemode.Database/HeidiSQL_Export.txt
Normal file
95
ReallifeGamemode.Database/HeidiSQL_Export.txt
Normal file
@@ -0,0 +1,95 @@
|
||||
SessionManager_WindowLeft<|||>3<|||>432
|
||||
SessionManager_WindowTop<|||>3<|||>375
|
||||
ColWidths_connform.ListSessions<|||>1<|||>163,50,50,50,50,50,53
|
||||
ColsVisible_connform.ListSessions<|||>1<|||>0
|
||||
ColPositions_connform.ListSessions<|||>1<|||>0,1,2,3,4,5,6
|
||||
ColSort_connform.ListSessions<|||>1<|||>0,1
|
||||
MainWinOnMonitor<|||>3<|||>0
|
||||
ColWidths_MainForm.ListDatabases<|||>1<|||>150,80,50,50,50,50,50,50,50,50,120
|
||||
ColsVisible_MainForm.ListDatabases<|||>1<|||>0,1,2,3,4,5,6,7,8,9,10
|
||||
ColPositions_MainForm.ListDatabases<|||>1<|||>0,1,2,3,4,5,6,7,8,9,10
|
||||
ColSort_MainForm.ListDatabases<|||>1<|||>0,0
|
||||
ColWidths_MainForm.ListVariables<|||>1<|||>160,200,275
|
||||
ColsVisible_MainForm.ListVariables<|||>1<|||>0,1,2
|
||||
ColPositions_MainForm.ListVariables<|||>1<|||>0,1,2
|
||||
ColSort_MainForm.ListVariables<|||>1<|||>0,0
|
||||
ColWidths_MainForm.ListStatus<|||>1<|||>160,275,100,100
|
||||
ColsVisible_MainForm.ListStatus<|||>1<|||>0,1,2,3
|
||||
ColPositions_MainForm.ListStatus<|||>1<|||>0,1,2,3
|
||||
ColSort_MainForm.ListStatus<|||>1<|||>0,0
|
||||
ColWidths_MainForm.ListProcesses<|||>1<|||>70,80,80,80,80,50,50,44
|
||||
ColsVisible_MainForm.ListProcesses<|||>1<|||>0,1,2,3,4,5,6,7
|
||||
ColPositions_MainForm.ListProcesses<|||>1<|||>0,1,2,3,4,5,6,7
|
||||
ColSort_MainForm.ListProcesses<|||>1<|||>0,1
|
||||
ColWidths_MainForm.ListCommandStats<|||>1<|||>120,100,100,100,215
|
||||
ColsVisible_MainForm.ListCommandStats<|||>1<|||>0,1,2,3,4
|
||||
ColPositions_MainForm.ListCommandStats<|||>1<|||>0,1,2,3,4
|
||||
ColSort_MainForm.ListCommandStats<|||>1<|||>1,1
|
||||
ColWidths_MainForm.ListTables<|||>1<|||>120,70,70,120,120,70,100,50,70,70,70,70,70,90,120,70,70,70,50
|
||||
ColsVisible_MainForm.ListTables<|||>1<|||>0,1,2,3,4,5,6,18
|
||||
ColPositions_MainForm.ListTables<|||>1<|||>0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18
|
||||
ColSort_MainForm.ListTables<|||>1<|||>0,0
|
||||
LastSessions<|||>1<|||>Unnamed
|
||||
LastActiveSession<|||>1<|||>Unnamed
|
||||
CoolBand0Index<|||>3<|||>0
|
||||
CoolBand0Break<|||>3<|||>1
|
||||
CoolBand0Width<|||>3<|||>818
|
||||
CoolBand1Index<|||>3<|||>1
|
||||
CoolBand1Break<|||>3<|||>1
|
||||
CoolBand1Width<|||>3<|||>818
|
||||
FileDialogEncoding_MainForm<|||>3<|||>0
|
||||
ColWidths_frmTableEditor.listColumns<|||>1<|||>38,100,156,90,60,65,50,119,130,140,100,100
|
||||
ColsVisible_frmTableEditor.listColumns<|||>1<|||>0,1,2,3,4,5,6,7,8,9,10,11
|
||||
ColPositions_frmTableEditor.listColumns<|||>1<|||>0,1,2,3,4,5,6,7,8,9,10,11
|
||||
ColSort_frmTableEditor.listColumns<|||>1<|||>-1,0
|
||||
ColWidths_frmTableEditor.treeIndexes<|||>1<|||>329,100,80
|
||||
ColsVisible_frmTableEditor.treeIndexes<|||>1<|||>0,1,2
|
||||
ColPositions_frmTableEditor.treeIndexes<|||>1<|||>0,1,2
|
||||
ColSort_frmTableEditor.treeIndexes<|||>1<|||>-1,0
|
||||
ColWidths_frmTableEditor.listForeignKeys<|||>1<|||>87,80,100,80,80,80
|
||||
ColsVisible_frmTableEditor.listForeignKeys<|||>1<|||>0,1,2,3,4,5
|
||||
ColPositions_frmTableEditor.listForeignKeys<|||>1<|||>0,1,2,3,4,5
|
||||
ColSort_frmTableEditor.listForeignKeys<|||>1<|||>-1,0
|
||||
MainWinLeft<|||>3<|||>410
|
||||
MainWinTop<|||>3<|||>294
|
||||
SQLFile0<|||>1<|||>C:\Users\michaplays27\Desktop\SQL\sql.sql
|
||||
MainWinMaximized<|||>3<|||>0
|
||||
ExportSQL_DataHow<|||>3<|||>2
|
||||
ExportSQL_Filenames<|||>1<|||>dutycloth<{{{><}}}>
|
||||
MainWinWidth<|||>3<|||>840
|
||||
MainWinHeight<|||>3<|||>525
|
||||
Servers\Unnamed\SessionCreated<|||>1<|||>2020-02-27 20:38:48
|
||||
Servers\Unnamed\Host<|||>1<|||>127.0.0.1
|
||||
Servers\Unnamed\WindowsAuth<|||>3<|||>0
|
||||
Servers\Unnamed\User<|||>1<|||>gtav-dev
|
||||
Servers\Unnamed\Password<|||>1<|||>783E394C767A3A3E587C3D575B7B7B3A5E5A50273D3670374E5A5A3D38394E576
|
||||
Servers\Unnamed\LoginPrompt<|||>3<|||>0
|
||||
Servers\Unnamed\Port<|||>1<|||>3306
|
||||
Servers\Unnamed\NetType<|||>3<|||>0
|
||||
Servers\Unnamed\Compressed<|||>3<|||>0
|
||||
Servers\Unnamed\LocalTimeZone<|||>3<|||>0
|
||||
Servers\Unnamed\QueryTimeout<|||>3<|||>0
|
||||
Servers\Unnamed\KeepAlive<|||>3<|||>0
|
||||
Servers\Unnamed\FullTableStatus<|||>3<|||>1
|
||||
Servers\Unnamed\Databases<|||>1<|||>
|
||||
Servers\Unnamed\Comment<|||>1<|||>
|
||||
Servers\Unnamed\StartupScriptFilename<|||>1<|||>
|
||||
Servers\Unnamed\SSHtunnelHost<|||>1<|||>
|
||||
Servers\Unnamed\SSHtunnelHostPort<|||>3<|||>0
|
||||
Servers\Unnamed\SSHtunnelUser<|||>1<|||>
|
||||
Servers\Unnamed\SSHtunnelPassword<|||>1<|||>6
|
||||
Servers\Unnamed\SSHtunnelTimeout<|||>3<|||>4
|
||||
Servers\Unnamed\SSHtunnelPrivateKey<|||>1<|||>
|
||||
Servers\Unnamed\SSHtunnelPort<|||>3<|||>3307
|
||||
Servers\Unnamed\SSL_Active<|||>3<|||>0
|
||||
Servers\Unnamed\SSL_Key<|||>1<|||>
|
||||
Servers\Unnamed\SSL_Cert<|||>1<|||>
|
||||
Servers\Unnamed\SSL_CA<|||>1<|||>
|
||||
Servers\Unnamed\SSL_Cipher<|||>1<|||>
|
||||
Servers\Unnamed\ServerVersionFull<|||>1<|||>10.3.9-MariaDB - mariadb.org binary distribution
|
||||
Servers\Unnamed\ConnectCount<|||>3<|||>10
|
||||
Servers\Unnamed\ServerVersion<|||>3<|||>100309
|
||||
Servers\Unnamed\LastConnect<|||>1<|||>2020-03-15 16:29:18
|
||||
Servers\Unnamed\lastUsedDB<|||>1<|||>gtav-devdb
|
||||
Servers\Unnamed\RefusedCount<|||>3<|||>44
|
||||
Servers\Unnamed\gtav-devdb|users\Sort<|||>1<|||>0_AdminLevel|
|
||||
1423
ReallifeGamemode.Database/Migrations/20200315113621_BankAccountRefactor.Designer.cs
generated
Normal file
1423
ReallifeGamemode.Database/Migrations/20200315113621_BankAccountRefactor.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,210 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ReallifeGamemode.Database.Migrations
|
||||
{
|
||||
public partial class BankAccountRefactor : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_FactionBankAccounts_Factions_FactionId",
|
||||
table: "FactionBankAccounts");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GroupBankAccounts_Groups_GroupId",
|
||||
table: "GroupBankAccounts");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_UserBankAccounts_Users_UserId",
|
||||
table: "UserBankAccounts");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_UserBankAccounts_UserId",
|
||||
table: "UserBankAccounts");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_GroupBankAccounts_GroupId",
|
||||
table: "GroupBankAccounts");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_FactionBankAccounts_FactionId",
|
||||
table: "FactionBankAccounts");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "BankAccountId",
|
||||
table: "Users",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "BankAccountId",
|
||||
table: "Groups",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "BankAccountId",
|
||||
table: "Factions",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.Sql(@"
|
||||
UPDATE users u
|
||||
INNER JOIN userbankaccounts ub ON ub.userid = u.id
|
||||
SET u.bankaccountid = ub.id");
|
||||
|
||||
migrationBuilder.Sql(@"
|
||||
UPDATE factions f
|
||||
INNER JOIN factionbankaccounts fb ON fb.factionid = f.id
|
||||
SET f.bankaccountid = fb.id");
|
||||
|
||||
migrationBuilder.Sql(@"
|
||||
UPDATE groups g
|
||||
INNER JOIN groupbankaccounts gb ON gb.groupid = g.id
|
||||
SET g.bankaccountid = gb.id");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UserId",
|
||||
table: "UserBankAccounts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "GroupId",
|
||||
table: "GroupBankAccounts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "FactionId",
|
||||
table: "FactionBankAccounts");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Users_BankAccountId",
|
||||
table: "Users",
|
||||
column: "BankAccountId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Groups_BankAccountId",
|
||||
table: "Groups",
|
||||
column: "BankAccountId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Factions_BankAccountId",
|
||||
table: "Factions",
|
||||
column: "BankAccountId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Factions_FactionBankAccounts_BankAccountId",
|
||||
table: "Factions",
|
||||
column: "BankAccountId",
|
||||
principalTable: "FactionBankAccounts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Groups_GroupBankAccounts_BankAccountId",
|
||||
table: "Groups",
|
||||
column: "BankAccountId",
|
||||
principalTable: "GroupBankAccounts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Users_UserBankAccounts_BankAccountId",
|
||||
table: "Users",
|
||||
column: "BankAccountId",
|
||||
principalTable: "UserBankAccounts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Factions_FactionBankAccounts_BankAccountId",
|
||||
table: "Factions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Groups_GroupBankAccounts_BankAccountId",
|
||||
table: "Groups");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Users_UserBankAccounts_BankAccountId",
|
||||
table: "Users");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Users_BankAccountId",
|
||||
table: "Users");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Groups_BankAccountId",
|
||||
table: "Groups");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Factions_BankAccountId",
|
||||
table: "Factions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BankAccountId",
|
||||
table: "Users");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BankAccountId",
|
||||
table: "Groups");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BankAccountId",
|
||||
table: "Factions");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "UserId",
|
||||
table: "UserBankAccounts",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "GroupId",
|
||||
table: "GroupBankAccounts",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "FactionId",
|
||||
table: "FactionBankAccounts",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserBankAccounts_UserId",
|
||||
table: "UserBankAccounts",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GroupBankAccounts_GroupId",
|
||||
table: "GroupBankAccounts",
|
||||
column: "GroupId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_FactionBankAccounts_FactionId",
|
||||
table: "FactionBankAccounts",
|
||||
column: "FactionId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_FactionBankAccounts_Factions_FactionId",
|
||||
table: "FactionBankAccounts",
|
||||
column: "FactionId",
|
||||
principalTable: "Factions",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GroupBankAccounts_Groups_GroupId",
|
||||
table: "GroupBankAccounts",
|
||||
column: "GroupId",
|
||||
principalTable: "Groups",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_UserBankAccounts_Users_UserId",
|
||||
table: "UserBankAccounts",
|
||||
column: "UserId",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -351,6 +351,8 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int?>("BankAccountId");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(32);
|
||||
|
||||
@@ -360,6 +362,8 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BankAccountId");
|
||||
|
||||
b.ToTable("Factions");
|
||||
});
|
||||
|
||||
@@ -375,15 +379,11 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
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");
|
||||
});
|
||||
|
||||
@@ -453,10 +453,14 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int?>("BankAccountId");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BankAccountId");
|
||||
|
||||
b.ToTable("Groups");
|
||||
});
|
||||
|
||||
@@ -467,12 +471,8 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
|
||||
b.Property<int>("Balance");
|
||||
|
||||
b.Property<int?>("GroupId");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.ToTable("GroupBankAccounts");
|
||||
});
|
||||
|
||||
@@ -967,6 +967,8 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
|
||||
b.Property<int?>("BanId");
|
||||
|
||||
b.Property<int?>("BankAccountId");
|
||||
|
||||
b.Property<int?>("BusinessId");
|
||||
|
||||
b.Property<int?>("CharacterId");
|
||||
@@ -1032,6 +1034,8 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
|
||||
b.HasIndex("BanId");
|
||||
|
||||
b.HasIndex("BankAccountId");
|
||||
|
||||
b.HasIndex("BusinessId")
|
||||
.IsUnique();
|
||||
|
||||
@@ -1063,12 +1067,8 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
b.Property<string>("Iban")
|
||||
.HasMaxLength(32);
|
||||
|
||||
b.Property<int>("UserId");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("UserBankAccounts");
|
||||
});
|
||||
|
||||
@@ -1273,12 +1273,11 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionBankAccount", b =>
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Faction", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction")
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.FactionBankAccount", "BankAccount")
|
||||
.WithMany()
|
||||
.HasForeignKey("FactionId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
.HasForeignKey("BankAccountId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionRank", b =>
|
||||
@@ -1296,11 +1295,11 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
.HasForeignKey("FactionId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.GroupBankAccount", b =>
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Group", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.Group", "Group")
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.GroupBankAccount", "BankAccount")
|
||||
.WithMany()
|
||||
.HasForeignKey("GroupId");
|
||||
.HasForeignKey("BankAccountId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.House", b =>
|
||||
@@ -1346,6 +1345,10 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
.WithMany()
|
||||
.HasForeignKey("BanId");
|
||||
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.UserBankAccount", "BankAccount")
|
||||
.WithMany()
|
||||
.HasForeignKey("BankAccountId");
|
||||
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.Character", "Character")
|
||||
.WithMany()
|
||||
.HasForeignKey("CharacterId");
|
||||
@@ -1367,14 +1370,6 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
.HasForeignKey("HouseId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserBankAccount", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserItem", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.User", "User")
|
||||
|
||||
Reference in New Issue
Block a user