Update C# db models

This commit is contained in:
Rory&
2026-02-03 03:09:24 +01:00
parent 50cbeb7677
commit 656758ad12
49 changed files with 161 additions and 138 deletions
@@ -1,5 +1,3 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using Spacebar.Models.Db.Models;
using Stream = Spacebar.Models.Db.Models.Stream;
@@ -91,6 +89,8 @@ public partial class SpacebarDbContext : DbContext
public virtual DbSet<Template> Templates { get; set; }
public virtual DbSet<ThreadMember> ThreadMembers { get; set; }
public virtual DbSet<User> Users { get; set; }
public virtual DbSet<UserSetting> UserSettings { get; set; }
@@ -355,7 +355,7 @@ public partial class SpacebarDbContext : DbContext
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("FK_05535bc695e9f7ee104616459d3");
entity.HasOne(d => d.Channel).WithMany(p => p.Messages)
entity.HasOne(d => d.Channel).WithMany(p => p.MessageChannels)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("FK_86b9109b155eb70c0a2ca3b4b6d");
@@ -371,9 +371,13 @@ public partial class SpacebarDbContext : DbContext
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("FK_61a92bb65b302a76d9c1fcd3174");
entity.HasOne(d => d.Thread).WithMany(p => p.MessageThreads)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("FK_bb3af7f695d50083e6523290d41");
entity.HasOne(d => d.Webhook).WithMany(p => p.Messages).HasConstraintName("FK_f83c04bcf1df4e5c0e7a52ed348");
entity.HasMany(d => d.Channels).WithMany(p => p.MessagesNavigation)
entity.HasMany(d => d.Channels).WithMany(p => p.Messages)
.UsingEntity<Dictionary<string, object>>(
"MessageChannelMention",
r => r.HasOne<Channel>().WithMany()
@@ -620,6 +624,15 @@ public partial class SpacebarDbContext : DbContext
.HasConstraintName("FK_445d00eaaea0e60a017a5ed0c11");
});
modelBuilder.Entity<ThreadMember>(entity =>
{
entity.HasKey(e => e.Index).HasName("PK_22232a9f7a08fb9967a9c78da53");
entity.HasOne(d => d.IdNavigation).WithMany(p => p.ThreadMembers).HasConstraintName("FK_cf20e37d71b0e1bf1ab633861c8");
entity.HasOne(d => d.MemberIdxNavigation).WithMany(p => p.ThreadMembers).HasConstraintName("FK_4721015b4e24ad29da55dbd2de0");
});
modelBuilder.Entity<User>(entity =>
{
entity.HasKey(e => e.Id).HasName("PK_a3ffb1c0c8416b9fc6f907b7433");
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -73,6 +73,18 @@ public partial class Channel
[Column("default_thread_rate_limit_per_user")]
public int? DefaultThreadRateLimitPerUser { get; set; }
[Column("thread_metadata")]
public string? ThreadMetadata { get; set; }
[Column("member_count")]
public int? MemberCount { get; set; }
[Column("message_count")]
public int? MessageCount { get; set; }
[Column("total_message_sent")]
public int? TotalMessageSent { get; set; }
[InverseProperty("Channel")]
public virtual ICollection<CloudAttachment> CloudAttachments { get; set; } = new List<CloudAttachment>();
@@ -102,7 +114,10 @@ public partial class Channel
public virtual ICollection<Invite> Invites { get; set; } = new List<Invite>();
[InverseProperty("Channel")]
public virtual ICollection<Message> Messages { get; set; } = new List<Message>();
public virtual ICollection<Message> MessageChannels { get; set; } = new List<Message>();
[InverseProperty("Thread")]
public virtual ICollection<Message> MessageThreads { get; set; } = new List<Message>();
[ForeignKey("OwnerId")]
[InverseProperty("Channels")]
@@ -121,6 +136,9 @@ public partial class Channel
[InverseProperty("Channel")]
public virtual ICollection<Stream> Streams { get; set; } = new List<Stream>();
[InverseProperty("IdNavigation")]
public virtual ICollection<ThreadMember> ThreadMembers { get; set; } = new List<ThreadMember>();
[InverseProperty("Channel")]
public virtual ICollection<VoiceState> VoiceStates { get; set; } = new List<VoiceState>();
@@ -132,5 +150,5 @@ public partial class Channel
[ForeignKey("ChannelsId")]
[InverseProperty("Channels")]
public virtual ICollection<Message> MessagesNavigation { get; set; } = new List<Message>();
public virtual ICollection<Message> Messages { get; set; } = new List<Message>();
}
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -65,6 +65,15 @@ public partial class Member
[Column("communication_disabled_until", TypeName = "timestamp without time zone")]
public DateTime? CommunicationDisabledUntil { get; set; }
[Column("avatar_decoration_data")]
public string? AvatarDecorationData { get; set; }
[Column("display_name_styles")]
public string? DisplayNameStyles { get; set; }
[Column("collectibles")]
public string? Collectibles { get; set; }
[ForeignKey("GuildId")]
[InverseProperty("Members")]
public virtual Guild Guild { get; set; } = null!;
@@ -73,6 +82,9 @@ public partial class Member
[InverseProperty("Members")]
public virtual User IdNavigation { get; set; } = null!;
[InverseProperty("MemberIdxNavigation")]
public virtual ICollection<ThreadMember> ThreadMembers { get; set; } = new List<ThreadMember>();
[ForeignKey("Index")]
[InverseProperty("Indices")]
public virtual ICollection<Role> Roles { get; set; } = new List<Role>();
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -97,6 +97,9 @@ public partial class Message
[Column("message_snapshots")]
public string MessageSnapshots { get; set; } = null!;
[Column("thread_id", TypeName = "character varying")]
public string? ThreadId { get; set; }
[ForeignKey("ApplicationId")]
[InverseProperty("Messages")]
public virtual Application? Application { get; set; }
@@ -109,7 +112,7 @@ public partial class Message
public virtual User? Author { get; set; }
[ForeignKey("ChannelId")]
[InverseProperty("Messages")]
[InverseProperty("MessageChannels")]
public virtual Channel? Channel { get; set; }
[ForeignKey("GuildId")]
@@ -127,12 +130,16 @@ public partial class Message
[InverseProperty("InverseMessageReferenceNavigation")]
public virtual Message? MessageReferenceNavigation { get; set; }
[ForeignKey("ThreadId")]
[InverseProperty("MessageThreads")]
public virtual Channel? Thread { get; set; }
[ForeignKey("WebhookId")]
[InverseProperty("Messages")]
public virtual Webhook? Webhook { get; set; }
[ForeignKey("MessagesId")]
[InverseProperty("MessagesNavigation")]
[InverseProperty("Messages")]
public virtual ICollection<Channel> Channels { get; set; } = new List<Channel>();
[ForeignKey("MessagesId")]
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Spacebar.Models.Db.Models;
[Table("thread_members")]
[Index("Id", "MemberIdx", Name = "IDX_38d4f704373da3f0dc9b352ac9", IsUnique = true)]
public partial class ThreadMember
{
[Key]
[Column("index")]
public int Index { get; set; }
[Column("id", TypeName = "character varying")]
public string Id { get; set; } = null!;
[Column("member_idx")]
public int MemberIdx { get; set; }
[Column("join_timestamp", TypeName = "timestamp without time zone")]
public DateTime JoinTimestamp { get; set; }
[Column("muted")]
public bool Muted { get; set; }
[Column("mute_config")]
public string? MuteConfig { get; set; }
[Column("flags")]
public int Flags { get; set; }
[ForeignKey("Id")]
[InverseProperty("ThreadMembers")]
public virtual Channel IdNavigation { get; set; } = null!;
[ForeignKey("MemberIdx")]
[InverseProperty("ThreadMembers")]
public virtual Member MemberIdxNavigation { get; set; } = null!;
}
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -89,14 +89,14 @@ public partial class User
[Column("email", TypeName = "character varying")]
public string? Email { get; set; }
[Column("flags", TypeName = "character varying")]
[Column("flags")]
public ulong Flags { get; set; }
[Column("public_flags")]
public ulong PublicFlags { get; set; }
[Column("purchased_flags")]
public long PurchasedFlags { get; set; }
public ulong PurchasedFlags { get; set; }
[Column("premium_usage_flags")]
public int PremiumUsageFlags { get; set; }
@@ -119,6 +119,18 @@ public partial class User
[Column("badge_ids")]
public string? BadgeIds { get; set; }
[Column("avatar_decoration_data")]
public string? AvatarDecorationData { get; set; }
[Column("display_name_styles")]
public string? DisplayNameStyles { get; set; }
[Column("collectibles")]
public string? Collectibles { get; set; }
[Column("primary_guild")]
public string? PrimaryGuild { get; set; }
[InverseProperty("BotUser")]
public virtual Application? ApplicationBotUser { get; set; }
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -7,12 +7,8 @@
</PropertyGroup>
<ItemGroup>
<!-- <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.2">-->
<!-- <PrivateAssets>all</PrivateAssets>-->
<!-- <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>-->
<!-- </PackageReference>-->
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="*" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="*" />
</ItemGroup>
</Project>
@@ -1,77 +0,0 @@
[
{
"pname": "Microsoft.EntityFrameworkCore",
"version": "10.0.0",
"hash": "sha256-xfgrlxhtOkQwF5Q7j8gSm41URJiH8IuJ/T/Dh88++hE="
},
{
"pname": "Microsoft.EntityFrameworkCore.Abstractions",
"version": "10.0.0",
"hash": "sha256-UDgZbRQcGPaKsE53EH6bvJiv+Q4KSxAbnsVhTVFGG4Q="
},
{
"pname": "Microsoft.EntityFrameworkCore.Analyzers",
"version": "10.0.0",
"hash": "sha256-7Q0jYJO50cqGI+u6gLpootbB8GZvgsgtg0F9FZI1jig="
},
{
"pname": "Microsoft.EntityFrameworkCore.Relational",
"version": "10.0.0",
"hash": "sha256-vOP2CE5YA551BlpbOuIy6RuAiAEPEpCVS1cEE33/zN4="
},
{
"pname": "Microsoft.Extensions.Caching.Abstractions",
"version": "10.0.0",
"hash": "sha256-IciARPnXx/S6HZc4t2ED06UyUwfZI9LKSzwKSGdpsfI="
},
{
"pname": "Microsoft.Extensions.Caching.Memory",
"version": "10.0.0",
"hash": "sha256-AMgDSm1k6q0s17spGtyR5q8nAqUFDOxl/Fe38f9M+d4="
},
{
"pname": "Microsoft.Extensions.Configuration.Abstractions",
"version": "10.0.0",
"hash": "sha256-GcgrnTAieCV7AVT13zyOjfwwL86e99iiO/MiMOxPGG0="
},
{
"pname": "Microsoft.Extensions.DependencyInjection",
"version": "10.0.0",
"hash": "sha256-LYm9hVlo/R9c2aAKHsDYJ5vY9U0+3Jvclme3ou3BtvQ="
},
{
"pname": "Microsoft.Extensions.DependencyInjection.Abstractions",
"version": "10.0.0",
"hash": "sha256-9iodXP39YqgxomnOPOxd/mzbG0JfOSXzFoNU3omT2Ps="
},
{
"pname": "Microsoft.Extensions.Logging",
"version": "10.0.0",
"hash": "sha256-P+zPAadLL63k/GqK34/qChqQjY9aIRxZfxlB9lqsSrs="
},
{
"pname": "Microsoft.Extensions.Logging.Abstractions",
"version": "10.0.0",
"hash": "sha256-BnhgGZc01HwTSxogavq7Ueq4V7iMA3wPnbfRwQ4RhGk="
},
{
"pname": "Microsoft.Extensions.Options",
"version": "10.0.0",
"hash": "sha256-j5MOqZSKeUtxxzmZjzZMGy0vELHdvPraqwTQQQNVsYA="
},
{
"pname": "Microsoft.Extensions.Primitives",
"version": "10.0.0",
"hash": "sha256-Dup08KcptLjlnpN5t5//+p4n8FUTgRAq4n/w1s6us+I="
},
{
"pname": "Npgsql",
"version": "10.0.0",
"hash": "sha256-UVKz9dH/rVCCbMyFdqA31RYpht1XgDRLIqUy0Dp9ACQ="
},
{
"pname": "Npgsql.EntityFrameworkCore.PostgreSQL",
"version": "10.0.0",
"hash": "sha256-XIJxnTMektQVP1qtslEIGbmBGrIQsvjQjCMRTs9UIbg="
}
]