RegexBot/Data/CachedGuildUser.cs
Noi 5f00e8b4b2 Fix incorrect foreign key reference
Replaces previously committed migration with a new one.
If updating the database, run these first before the migration:
```
drop table modlogs;
drop type mod_log_type;
delete from "__EFMigrationsHistory" where "migration_id" = '20220824023321_AddModLogs';
```
2022-09-13 14:58:15 -07:00

41 lines
1.3 KiB
C#

using System.ComponentModel.DataAnnotations.Schema;
namespace RegexBot.Data;
/// <summary>
/// Represents an item in the guild user cache.
/// </summary>
[Table("cache_usersinguild")]
public class CachedGuildUser {
/// <summary>
/// Gets the associated guild's snowflake ID.
/// </summary>
public long GuildId { get; set; }
/// <inheritdoc cref="CachedUser.UserId"/>
public long UserId { get; set; }
/// <inheritdoc cref="CachedUser.ULastUpdateTime"/>
public DateTimeOffset GULastUpdateTime { get; set; }
/// <summary>
/// Gets the timestamp showing when this cache entry was first added into the database.
/// </summary>
public DateTimeOffset FirstSeenTime { get; set; }
/// <summary>
/// Gets the user's cached nickname in the guild.
/// </summary>
public string? Nickname { get; set; }
/// <summary>
/// If included in the query, references the associated <seealso cref="CachedUser"/> for this entry.
/// </summary>
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(CachedUser.Guilds))]
public CachedUser User { get; set; } = null!;
/// <summary>
/// If included in the query, references all <seealso cref="ModLogEntry"/> items associated with this entry.
/// </summary>
public ICollection<ModLogEntry> Logs { get; set; } = null!;
}