136 lines
4.7 KiB
C#
136 lines
4.7 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
|
|
/**
|
|
* @overview Life of German Reallife - DatabaseContext.cs
|
|
* @author VegaZ
|
|
* @copyright (c) 2008 - 2018 Life of German
|
|
*/
|
|
|
|
namespace ReallifeGamemode.Database.Models
|
|
{
|
|
public partial class DatabaseContext : DbContext
|
|
{
|
|
public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options) { }
|
|
|
|
public DatabaseContext() { }
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
base.OnConfiguring(optionsBuilder);
|
|
optionsBuilder.UseMySql("Host=localhost;Port=3306;Database=gtav-devdb;Username=gtav-dev;Password=Test123");
|
|
}
|
|
|
|
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.FactionWeapon> FactionWeapons { 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; }
|
|
public DbSet<Entities.BusinessData> BusinessData { get; set; }
|
|
|
|
// Control Panel
|
|
public DbSet<Entities.News> News { get; set; }
|
|
public DbSet<Entities.Location> Locations { get; set; }
|
|
|
|
// Server Vehicles
|
|
public DbSet<Entities.ServerVehicle> ServerVehicles { get; set; }
|
|
public DbSet<Entities.VehicleMod> VehicleMods { get; set; }
|
|
public DbSet<Entities.VehicleItem> VehicleItems { 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.JobVehicle> JobVehicles { get; set; }
|
|
|
|
// Houses
|
|
public DbSet<Entities.House> Houses { get; set; }
|
|
public DbSet<Entities.HouseRental> HouseRentals { get; set; }
|
|
|
|
// Bus Routes
|
|
public DbSet<Entities.BusRoute> BusRoutes { get; set; }
|
|
public DbSet<Entities.BusRoutePoint> BusRoutesPoints { get; set; }
|
|
|
|
//Driving/Bike/Flight School
|
|
public DbSet<Entities.SchoolVehicle> SchoolVehicles { get; set; }
|
|
|
|
//Gangwar
|
|
public DbSet<Entities.Turfs> Turfs { get; set; }
|
|
|
|
//ClothesShop
|
|
public DbSet<Entities.ShopClothe> ShopClothes { get; set; }
|
|
|
|
//ItemShop
|
|
public DbSet<Entities.ShopItem> ShopItems { get; set; }
|
|
|
|
}
|
|
}
|