Files
Delta-v/Content.Server.Database/CDModel.cs
LyndomenandJanet Blackquill f024f46b0b Port Height & Records Computer from Cosmatic Drift (#2236)
* Port character records from CD

* Make species' base scales respected by CD heights

* Hide the height editor in the humanoid profile editor

---------

Co-authored-by: Janet Blackquill <uhhadd@gmail.com>
2025-03-11 15:34:45 +00:00

57 lines
1.6 KiB
C#

// File to store as much CD related database things outside of Model.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json;
using Microsoft.EntityFrameworkCore;
namespace Content.Server.Database;
public static class CDModel
{
/// <summary>
/// Stores CD Character data separately from the main Profile. This is done to work around a bug
/// in EFCore migrations.
/// <p />
/// There is no way of forcing a dependent table to exist in EFCore (according to MS).
/// You must always account for the possibility of this table not existing.
/// </summary>
public class CDProfile
{
public int Id { get; set; }
public int ProfileId { get; set; }
public Profile Profile { get; set; } = null!;
public float Height { get; set; } = 1f;
[Column("character_records", TypeName = "jsonb")]
public JsonDocument? CharacterRecords { get; set; }
public List<CharacterRecordEntry> CharacterRecordEntries { get; set; } = new();
}
public enum DbRecordEntryType : byte
{
Medical = 0, Security = 1, Employment = 2
}
[Table("cd_character_record_entries"), Index(nameof(Id))]
public sealed class CharacterRecordEntry
{
public int Id { get; set; }
public string Title { get; set; } = null!;
public string Involved { get; set; } = null!;
public string Description { get; set; } = null!;
public DbRecordEntryType Type { get; set; }
public int CDProfileId { get; set; }
public CDProfile CDProfile { get; set; } = null!;
}
}