db: add nullable Viewer.Udid with partial unique index
Backstop for /tool/signup idempotency: signup-created viewers carry the client's UDID (the AES key for that client's wire traffic); admin-imported viewers stay null. Partial unique index allows the column to coexist with pre-existing null rows. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ namespace SVSim.Database.Models;
|
||||
/// A user within the game system.
|
||||
/// </summary>
|
||||
[Index(nameof(ShortUdid))]
|
||||
[Index(nameof(Udid), IsUnique = true)]
|
||||
public class Viewer : BaseEntity<long>
|
||||
{
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
@@ -17,11 +18,18 @@ public class Viewer : BaseEntity<long>
|
||||
/// This user's name displayed in game.
|
||||
/// </summary>
|
||||
public string DisplayName { get; set; } = String.Empty;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// This user's short identifier.
|
||||
/// </summary>
|
||||
public long ShortUdid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The client's full UDID (AES key for the wire protocol). Set when the viewer is created
|
||||
/// via <c>/tool/signup</c>; null for viewers created via the admin Steam-import path. Unique
|
||||
/// when present — the partial filter is declared in the migration.
|
||||
/// </summary>
|
||||
public Guid? Udid { get; set; }
|
||||
|
||||
public DateTime LastLogin { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user