Files
reallife-gamemode/ReallifeGamemode.Server/Models/DatabaseContext.cs
2019-05-13 12:51:56 +02:00

109 lines
4.1 KiB
C#

using Microsoft.EntityFrameworkCore;
/**
* @overview Life of German Reallife - DatabaseContext.cs
* @author VegaZ
* @copyright (c) 2008 - 2018 Life of German
*/
namespace ReallifeGamemode.Server.Models
{
public partial class DatabaseContext : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder
.UseMySql("Host=localhost;Port=3306;Database=gtav-devdb;Username=gtav-dev;Password=Test123")
.UseLazyLoadingProxies();
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Entities.BusinessBankAccount>()
.HasIndex(b => b.BusinessId)
.IsUnique(true);
modelBuilder.Entity<Entities.User>()
.HasIndex(u => u.BusinessId)
.IsUnique(true);
modelBuilder.Entity<Entities.ServerVehicle>()
.Property(sv => sv.Active)
.HasDefaultValue(true);
modelBuilder.Entity<Entities.VehicleMod>()
.HasIndex(vM => new { vM.ServerVehicleId, vM.Slot }).IsUnique();
}
//User
public DbSet<Entities.Ban> Bans { get; set; }
public DbSet<Entities.Character> Characters { get; set; }
public DbSet<Entities.CharacterCloth> CharacterClothes { get; set; }
public DbSet<Entities.DutyCloth> DutyClothes { get; set; }
public DbSet<Entities.ClothCombination> ClothCombinations { get; set; }
public DbSet<Entities.User> Users { get; set; }
public DbSet<Entities.UserVehicle> UserVehicles { get; set; }
public DbSet<Entities.UserBankAccount> UserBankAccounts { get; set; }
//Inventar
public DbSet<Entities.UserItem> UserItems { get; set; }
//Faction
public DbSet<Entities.Faction> Factions { get; set; }
public DbSet<Entities.FactionBankAccount> FactionBankAccounts { get; set; }
public DbSet<Entities.FactionRank> FactionRanks { get; set; }
public DbSet<Entities.FactionVehicle> FactionVehicles { get; set; }
//Shops
//Logs
//public DbSet<Logs.Ban> BanLogs { get; set; }
public DbSet<Entities.Logs.BankAccountTransactionHistory> BankAccountTransactionLogs { get; set; }
public DbSet<Entities.Logs.Death> DeathLogs { get; set; }
//Saves
public DbSet<Entities.ATM> ATMs { get; set; }
public DbSet<Entities.Saves.SavedBlip> Blips { get; set; }
public DbSet<Entities.Door> Doors { get; set; }
public DbSet<Entities.GotoPoint> GotoPoints { get; set; }
public DbSet<Entities.Saves.SavedMarker> Markers { get; set; }
public DbSet<Entities.Saves.SavedPed> Peds { get; set; }
public DbSet<Entities.Saves.SavedPickup> Pickups { get; set; }
public DbSet<Entities.Saves.SavedTextLabel> TextLabels { get; set; }
public DbSet<Entities.Saves.SavedVehicle> Vehicles { get; set; }
public DbSet<Entities.ShopVehicle> ShopVehicles { get; set; }
// Business
public DbSet<Entities.BusinessBankAccount> BusinessBankAccounts { get; set; }
// Control Panel
public DbSet<Entities.News> News { get; set; }
// Server Vehicles
public DbSet<Entities.ServerVehicle> ServerVehicles { get; set; }
public DbSet<Entities.VehicleMod> VehicleMods { get; set; }
// Whitelist
public DbSet<Entities.Whitelist> WhitelistEntries { get; set; }
// Interiors
public DbSet<Entities.Interior> Interiors { get; set; }
// Tuning Garages
public DbSet<Entities.TuningGarage> TuningGarages { get; set; }
// Gruppen
public DbSet<Entities.Group> Groups { get; set; }
public DbSet<Entities.GroupBankAccount> GroupBankAccounts { get; set; }
public DbSet<Entities.GroupVehicle> GroupVehicles { get; set; }
// Jobs
public DbSet<Entities.Job> Jobs { get; set; }
public DbSet<Entities.JobVehicle> JobVehicles { get; set; }
}
}