[backend/database] Switch to in-model entity configuration

This commit is contained in:
Laura Hausmann 2024-11-14 20:14:19 +01:00
parent 59d14297a3
commit 84b8553a40
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
73 changed files with 1384 additions and 1118 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -69,4 +70,28 @@ public class AbuseUserReport
[ForeignKey(nameof(TargetUserId))]
[InverseProperty(nameof(User.AbuseUserReportTargetUsers))]
public virtual User TargetUser { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<AbuseUserReport>
{
public void Configure(EntityTypeBuilder<AbuseUserReport> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the AbuseUserReport.");
entity.Property(e => e.Forwarded).HasDefaultValue(false);
entity.Property(e => e.ReporterHost).HasComment("[Denormalized]");
entity.Property(e => e.Resolved).HasDefaultValue(false);
entity.Property(e => e.TargetUserHost).HasComment("[Denormalized]");
entity.HasOne(d => d.Assignee)
.WithMany(p => p.AbuseUserReportAssignees)
.OnDelete(DeleteBehavior.SetNull);
entity.HasOne(d => d.Reporter)
.WithMany(p => p.AbuseUserReportReporters)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.TargetUser)
.WithMany(p => p.AbuseUserReportTargetUsers)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -14,12 +14,12 @@ public class AllowedInstance
public string Host { get; set; } = null!;
[Column("imported")] public bool IsImported { get; set; }
}
public class AllowedInstanceEntityTypeConfiguration : IEntityTypeConfiguration<AllowedInstance>
{
public void Configure(EntityTypeBuilder<AllowedInstance> builder)
private class EntityTypeConfiguration : IEntityTypeConfiguration<AllowedInstance>
{
builder.Property(p => p.IsImported).HasDefaultValue(false);
public void Configure(EntityTypeBuilder<AllowedInstance> builder)
{
builder.Property(p => p.IsImported).HasDefaultValue(false);
}
}
}

View file

@ -2,6 +2,7 @@
using System.ComponentModel.DataAnnotations.Schema;
using EntityFrameworkCore.Projectables;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -45,4 +46,15 @@ public class Announcement
[Projectable]
public bool IsReadBy(User user) => ReadBy.Contains(user);
private class EntityTypeConfiguration : IEntityTypeConfiguration<Announcement>
{
public void Configure(EntityTypeBuilder<Announcement> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the Announcement.");
entity.Property(e => e.IsGoodNews).HasDefaultValue(false);
entity.Property(e => e.ShowPopup).HasDefaultValue(false);
entity.Property(e => e.UpdatedAt).HasComment("The updated date of the Announcement.");
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -34,4 +35,20 @@ public class AnnouncementRead
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.AnnouncementReads))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<AnnouncementRead>
{
public void Configure(EntityTypeBuilder<AnnouncementRead> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the AnnouncementRead.");
entity.HasOne(d => d.Announcement)
.WithMany(p => p.AnnouncementReads)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User)
.WithMany(p => p.AnnouncementReads)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using NpgsqlTypes;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -91,4 +92,32 @@ public class Antenna
[ForeignKey(nameof(UserListId))]
[InverseProperty(nameof(Tables.UserList.Antennas))]
public virtual UserList? UserList { get; set; }
private class EntityTypeConfiguration : IEntityTypeConfiguration<Antenna>
{
public void Configure(EntityTypeBuilder<Antenna> entity)
{
entity.Property(e => e.CaseSensitive).HasDefaultValue(false);
entity.Property(e => e.CreatedAt).HasComment("The created date of the Antenna.");
entity.Property(e => e.ExcludeKeywords).HasDefaultValueSql("'[]'::jsonb");
entity.Property(e => e.Instances).HasDefaultValueSql("'[]'::jsonb");
entity.Property(e => e.Keywords).HasDefaultValueSql("'[]'::jsonb");
entity.Property(e => e.Name).HasComment("The name of the Antenna.");
entity.Property(e => e.UserId).HasComment("The owner ID.");
entity.Property(e => e.Users).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.WithReplies).HasDefaultValue(false);
entity.HasOne(d => d.UserGroupMember)
.WithMany(p => p.Antennas)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User)
.WithMany(p => p.Antennas)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.UserList)
.WithMany(p => p.Antennas)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -43,4 +44,20 @@ public class AttestationChallenge
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.AttestationChallenges))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<AttestationChallenge>
{
public void Configure(EntityTypeBuilder<AttestationChallenge> entity)
{
entity.Property(e => e.Challenge).HasComment("Hex-encoded sha256 hash of the challenge.");
entity.Property(e => e.CreatedAt).HasComment("The date challenge was created for expiry purposes.");
entity.Property(e => e.RegistrationChallenge)
.HasDefaultValue(false)
.HasComment("Indicates that the challenge is only for registration purposes if true to prevent the challenge for being used as authentication.");
entity.HasOne(d => d.User)
.WithMany(p => p.AttestationChallenges)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -2,6 +2,7 @@
using System.ComponentModel.DataAnnotations.Schema;
using Iceshrimp.Backend.Core.Configuration;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -57,4 +58,15 @@ public class Bite
public string GetPublicUri(string webDomain) => User.IsLocalUser
? $"https://{webDomain}/bites/{Id}"
: throw new Exception("Cannot access PublicUri for remote user");
private class EntityTypeConfiguration : IEntityTypeConfiguration<Bite>
{
public void Configure(EntityTypeBuilder<Bite> entity)
{
entity.HasOne(d => d.User).WithMany().OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.TargetUser).WithMany().OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.TargetNote).WithMany().OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.TargetBite).WithMany().OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -18,12 +18,12 @@ public class BlockedInstance
public string? Reason { get; set; }
[Column("imported")] public bool IsImported { get; set; }
}
public class BlockedInstanceEntityTypeConfiguration : IEntityTypeConfiguration<BlockedInstance>
{
public void Configure(EntityTypeBuilder<BlockedInstance> builder)
private class EntityTypeConfiguration : IEntityTypeConfiguration<BlockedInstance>
{
builder.Property(p => p.IsImported).HasDefaultValue(false);
public void Configure(EntityTypeBuilder<BlockedInstance> builder)
{
builder.Property(p => p.IsImported).HasDefaultValue(false);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -43,4 +44,22 @@ public class Blocking
[ForeignKey(nameof(BlockerId))]
[InverseProperty(nameof(User.OutgoingBlocks))]
public virtual User Blocker { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<Blocking>
{
public void Configure(EntityTypeBuilder<Blocking> entity)
{
entity.Property(e => e.BlockeeId).HasComment("The blockee user ID.");
entity.Property(e => e.BlockerId).HasComment("The blocker user ID.");
entity.Property(e => e.CreatedAt).HasComment("The created date of the Blocking.");
entity.HasOne(d => d.Blockee)
.WithMany(p => p.IncomingBlocks)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.Blocker)
.WithMany(p => p.OutgoingBlocks)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -81,4 +82,30 @@ public class Channel
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.Channels))]
public virtual User? User { get; set; }
private class EntityTypeConfiguration : IEntityTypeConfiguration<Channel>
{
public void Configure(EntityTypeBuilder<Channel> entity)
{
entity.Property(e => e.BannerId).HasComment("The ID of banner Channel.");
entity.Property(e => e.CreatedAt).HasComment("The created date of the Channel.");
entity.Property(e => e.Description).HasComment("The description of the Channel.");
entity.Property(e => e.Name).HasComment("The name of the Channel.");
entity.Property(e => e.NotesCount)
.HasDefaultValue(0)
.HasComment("The count of notes.");
entity.Property(e => e.UserId).HasComment("The owner ID.");
entity.Property(e => e.UsersCount)
.HasDefaultValue(0)
.HasComment("The count of users.");
entity.HasOne(d => d.Banner)
.WithMany(p => p.Channels)
.OnDelete(DeleteBehavior.SetNull);
entity.HasOne(d => d.User)
.WithMany(p => p.Channels)
.OnDelete(DeleteBehavior.SetNull);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -43,4 +44,22 @@ public class ChannelFollowing
[ForeignKey(nameof(FollowerId))]
[InverseProperty(nameof(User.ChannelFollowings))]
public virtual User Follower { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<ChannelFollowing>
{
public void Configure(EntityTypeBuilder<ChannelFollowing> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the ChannelFollowing.");
entity.Property(e => e.FolloweeId).HasComment("The followee channel ID.");
entity.Property(e => e.FollowerId).HasComment("The follower user ID.");
entity.HasOne(d => d.Followee)
.WithMany(p => p.ChannelFollowings)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.Follower)
.WithMany(p => p.ChannelFollowings)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -33,4 +34,20 @@ public class ChannelNotePin
[ForeignKey(nameof(NoteId))]
[InverseProperty(nameof(Tables.Note.ChannelNotePins))]
public virtual Note Note { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<ChannelNotePin>
{
public void Configure(EntityTypeBuilder<ChannelNotePin> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the ChannelNotePin.");
entity.HasOne(d => d.Channel)
.WithMany(p => p.ChannelNotePins)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.Note)
.WithMany(p => p.ChannelNotePins)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -48,4 +49,20 @@ public class Clip
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.Clips))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<Clip>
{
public void Configure(EntityTypeBuilder<Clip> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the Clip.");
entity.Property(e => e.Description).HasComment("The description of the Clip.");
entity.Property(e => e.IsPublic).HasDefaultValue(false);
entity.Property(e => e.Name).HasComment("The name of the Clip.");
entity.Property(e => e.UserId).HasComment("The owner ID.");
entity.HasOne(d => d.User)
.WithMany(p => p.Clips)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -36,4 +37,21 @@ public class ClipNote
[ForeignKey(nameof(NoteId))]
[InverseProperty(nameof(Tables.Note.ClipNotes))]
public virtual Note Note { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<ClipNote>
{
public void Configure(EntityTypeBuilder<ClipNote> entity)
{
entity.Property(e => e.ClipId).HasComment("The clip ID.");
entity.Property(e => e.NoteId).HasComment("The note ID.");
entity.HasOne(d => d.Clip)
.WithMany(p => p.ClipNotes)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.Note)
.WithMany(p => p.ClipNotes)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -201,4 +202,45 @@ public class DriveFile : IEntity
[J("width")] public int? Width { get; set; }
[J("height")] public int? Height { get; set; }
}
private class EntityTypeConfiguration : IEntityTypeConfiguration<DriveFile>
{
public void Configure(EntityTypeBuilder<DriveFile> entity)
{
entity.Property(e => e.Blurhash).HasComment("The BlurHash string.");
entity.Property(e => e.Comment).HasComment("The comment of the DriveFile.");
entity.Property(e => e.CreatedAt).HasComment("The created date of the DriveFile.");
entity.Property(e => e.FolderId)
.HasComment("The parent folder ID. If null, it means the DriveFile is located in root.");
entity.Property(e => e.IsLink)
.HasDefaultValue(false)
.HasComment("Whether the DriveFile is direct link to remote server.");
entity.Property(e => e.IsSensitive)
.HasDefaultValue(false)
.HasComment("Whether the DriveFile is NSFW.");
entity.Property(e => e.Sha256).HasComment("The SHA256 hash of the DriveFile.");
entity.Property(e => e.Name).HasComment("The file name of the DriveFile.");
entity.Property(e => e.Properties)
.HasDefaultValueSql("'{}'::jsonb")
.HasComment("The any properties of the DriveFile. For example, it includes image width/height.");
entity.Property(e => e.RequestHeaders).HasDefaultValueSql("'{}'::jsonb");
entity.Property(e => e.Size).HasComment("The file size (bytes) of the DriveFile.");
entity.Property(e => e.ThumbnailUrl).HasComment("The URL of the thumbnail of the DriveFile.");
entity.Property(e => e.Type).HasComment("The content type (MIME) of the DriveFile.");
entity.Property(e => e.Uri)
.HasComment("The URI of the DriveFile. it will be null when the DriveFile is local.");
entity.Property(e => e.Url).HasComment("The URL of the DriveFile.");
entity.Property(e => e.UserHost).HasComment("The host of owner. It will be null if the user in local.");
entity.Property(e => e.UserId).HasComment("The owner ID.");
entity.Property(e => e.PublicUrl).HasComment("The URL of the webpublic of the DriveFile.");
entity.HasOne(d => d.Folder)
.WithMany(p => p.DriveFiles)
.OnDelete(DeleteBehavior.SetNull);
entity.HasOne(d => d.User)
.WithMany(p => p.DriveFiles)
.OnDelete(DeleteBehavior.SetNull);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -55,4 +56,24 @@ public class DriveFolder
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.DriveFolders))]
public virtual User? User { get; set; }
private class EntityTypeConfiguration : IEntityTypeConfiguration<DriveFolder>
{
public void Configure(EntityTypeBuilder<DriveFolder> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the DriveFolder.");
entity.Property(e => e.Name).HasComment("The name of the DriveFolder.");
entity.Property(e => e.ParentId)
.HasComment("The parent folder ID. If null, it means the DriveFolder is located in root.");
entity.Property(e => e.UserId).HasComment("The owner ID.");
entity.HasOne(d => d.Parent)
.WithMany(p => p.InverseParent)
.OnDelete(DeleteBehavior.SetNull);
entity.HasOne(d => d.User)
.WithMany(p => p.DriveFolders)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -2,6 +2,7 @@
using System.ComponentModel.DataAnnotations.Schema;
using Iceshrimp.Backend.Core.Configuration;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -67,4 +68,15 @@ public class Emoji
public string? GetPublicUriOrNull(Config.InstanceSection config) => Host == null
? $"https://{config.WebDomain}/emoji/{Name}"
: null;
private class EntityTypeConfiguration : IEntityTypeConfiguration<Emoji>
{
public void Configure(EntityTypeBuilder<Emoji> entity)
{
entity.Property(e => e.Aliases).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.Height).HasComment("Image height");
entity.Property(e => e.PublicUrl).HasDefaultValueSql("''::character varying");
entity.Property(e => e.Width).HasComment("Image width");
}
}
}

View file

@ -55,18 +55,18 @@ public class Filter
User = user!
};
}
}
public class FilterEntityTypeConfiguration : IEntityTypeConfiguration<Filter>
{
public void Configure(EntityTypeBuilder<Filter> entity)
private class EntityTypeConfiguration : IEntityTypeConfiguration<Filter>
{
entity.HasOne(p => p.User)
.WithMany(p => p.Filters)
.OnDelete(DeleteBehavior.Cascade)
.HasForeignKey("user_id");
public void Configure(EntityTypeBuilder<Filter> entity)
{
entity.HasOne(p => p.User)
.WithMany(p => p.Filters)
.OnDelete(DeleteBehavior.Cascade)
.HasForeignKey("user_id");
entity.Property(p => p.Keywords).HasDefaultValueSql("'{}'::varchar[]");
entity.Property(p => p.Contexts).HasDefaultValueSql("'{}'::public.filter_context_enum[]");
entity.Property(p => p.Keywords).HasDefaultValueSql("'{}'::varchar[]");
entity.Property(p => p.Contexts).HasDefaultValueSql("'{}'::public.filter_context_enum[]");
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -96,4 +97,29 @@ public class FollowRequest : IEntity
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<FollowRequest>
{
public void Configure(EntityTypeBuilder<FollowRequest> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the FollowRequest.");
entity.Property(e => e.FolloweeHost).HasComment("[Denormalized]");
entity.Property(e => e.FolloweeId).HasComment("The followee user ID.");
entity.Property(e => e.FolloweeInbox).HasComment("[Denormalized]");
entity.Property(e => e.FolloweeSharedInbox).HasComment("[Denormalized]");
entity.Property(e => e.FollowerHost).HasComment("[Denormalized]");
entity.Property(e => e.FollowerId).HasComment("The follower user ID.");
entity.Property(e => e.FollowerInbox).HasComment("[Denormalized]");
entity.Property(e => e.FollowerSharedInbox).HasComment("[Denormalized]");
entity.Property(e => e.RequestId).HasComment("id of Follow Activity.");
entity.HasOne(d => d.Followee)
.WithMany(p => p.IncomingFollowRequests)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.Follower)
.WithMany(p => p.OutgoingFollowRequests)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -89,4 +90,28 @@ public class Following
[ForeignKey(nameof(FollowerId))]
[InverseProperty(nameof(User.OutgoingFollowRelationships))]
public virtual User Follower { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<Following>
{
public void Configure(EntityTypeBuilder<Following> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the Following.");
entity.Property(e => e.FolloweeHost).HasComment("[Denormalized]");
entity.Property(e => e.FolloweeId).HasComment("The followee user ID.");
entity.Property(e => e.FolloweeInbox).HasComment("[Denormalized]");
entity.Property(e => e.FolloweeSharedInbox).HasComment("[Denormalized]");
entity.Property(e => e.FollowerHost).HasComment("[Denormalized]");
entity.Property(e => e.FollowerId).HasComment("The follower user ID.");
entity.Property(e => e.FollowerInbox).HasComment("[Denormalized]");
entity.Property(e => e.FollowerSharedInbox).HasComment("[Denormalized]");
entity.HasOne(d => d.Followee)
.WithMany(p => p.IncomingFollowRelationships)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.Follower)
.WithMany(p => p.OutgoingFollowRelationships)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -27,4 +28,18 @@ public class GalleryLike
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.GalleryLikes))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<GalleryLike>
{
public void Configure(EntityTypeBuilder<GalleryLike> entity)
{
entity.HasOne(d => d.Post)
.WithMany(p => p.GalleryLikes)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User)
.WithMany(p => p.GalleryLikes)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -64,4 +65,24 @@ public class GalleryPost
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.GalleryPosts))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<GalleryPost>
{
public void Configure(EntityTypeBuilder<GalleryPost> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the GalleryPost.");
entity.Property(e => e.FileIds).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.IsSensitive)
.HasDefaultValue(false)
.HasComment("Whether the post is sensitive.");
entity.Property(e => e.LikedCount).HasDefaultValue(0);
entity.Property(e => e.Tags).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.UpdatedAt).HasComment("The updated date of the GalleryPost.");
entity.Property(e => e.UserId).HasComment("The ID of author.");
entity.HasOne(d => d.User)
.WithMany(p => p.GalleryPosts)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -14,4 +15,9 @@ public class Hashtag : IEntity
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<Hashtag>
{
public void Configure(EntityTypeBuilder<Hashtag> entity) { }
}
}

View file

@ -2,6 +2,7 @@
using System.ComponentModel.DataAnnotations.Schema;
using EntityFrameworkCore.Projectables;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -103,4 +104,24 @@ public class Instance
[NotMapped]
[Projectable]
public bool NeedsUpdate => InfoUpdatedAt == null || InfoUpdatedAt < DateTime.Now - TimeSpan.FromHours(24);
private class EntityTypeConfiguration : IEntityTypeConfiguration<Instance>
{
public void Configure(EntityTypeBuilder<Instance> entity)
{
entity.Property(e => e.CaughtAt).HasComment("The caught date of the Instance.");
entity.Property(e => e.OutgoingFollows).HasDefaultValue(0);
entity.Property(e => e.IncomingFollows).HasDefaultValue(0);
entity.Property(e => e.Host).HasComment("The host of the Instance.");
entity.Property(e => e.IsNotResponding).HasDefaultValue(false);
entity.Property(e => e.IsSuspended).HasDefaultValue(false);
entity.Property(e => e.NotesCount)
.HasDefaultValue(0)
.HasComment("The count of the notes of the Instance.");
entity.Property(e => e.SoftwareName).HasComment("The software of the Instance.");
entity.Property(e => e.UsersCount)
.HasDefaultValue(0)
.HasComment("The count of the users of the Instance.");
}
}
}

View file

@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
using EntityFrameworkCore.Projectables;
using Iceshrimp.Backend.Core.Extensions;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -45,4 +46,14 @@ public class Job
[NotMapped] public long QueueDuration => ((StartedAt ?? DateTime.UtcNow) - QueuedAt).GetTotalMilliseconds();
[NotMapped] [Projectable] public DateTime LastUpdatedAt => FinishedAt ?? StartedAt ?? QueuedAt;
private class EntityTypeConfiguration : IEntityTypeConfiguration<Job>
{
public void Configure(EntityTypeBuilder<Job> entity)
{
entity.Property(e => e.Id).ValueGeneratedNever();
entity.Property(e => e.Status).HasDefaultValue(JobStatus.Queued);
entity.Property(e => e.QueuedAt).HasDefaultValueSql("now()");
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using NpgsqlTypes;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -32,4 +33,16 @@ public class Marker
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.Markers))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<Marker>
{
public void Configure(EntityTypeBuilder<Marker> entity)
{
entity.Property(d => d.Version).HasDefaultValue(0);
entity.HasOne(d => d.User)
.WithMany(p => p.Markers)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -69,4 +70,33 @@ public class MessagingMessage
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.MessagingMessageUsers))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<MessagingMessage>
{
public void Configure(EntityTypeBuilder<MessagingMessage> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the MessagingMessage.");
entity.Property(e => e.GroupId).HasComment("The recipient group ID.");
entity.Property(e => e.IsRead).HasDefaultValue(false);
entity.Property(e => e.Reads).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.RecipientId).HasComment("The recipient user ID.");
entity.Property(e => e.UserId).HasComment("The sender user ID.");
entity.HasOne(d => d.File)
.WithMany(p => p.MessagingMessages)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.Group)
.WithMany(p => p.MessagingMessages)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.Recipient)
.WithMany(p => p.MessagingMessageRecipients)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User)
.WithMany(p => p.MessagingMessageUsers)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,5 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -283,4 +285,62 @@ public class Meta
[Column("autofollowedAccount")]
[StringLength(128)]
public string? AutofollowedAccount { get; set; }
private class EntityTypeConfiguration : IEntityTypeConfiguration<Meta>
{
public void Configure(EntityTypeBuilder<Meta> entity)
{
entity.Property(e => e.AllowedHosts).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.BlockedHosts).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.CacheRemoteFiles).HasDefaultValue(false);
entity.Property(e => e.CustomMotd).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.CustomSplashIcons).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.DeeplIsPro).HasDefaultValue(false);
entity.Property(e => e.DefaultReaction).HasDefaultValueSql("'⭐'::character varying");
entity.Property(e => e.DisableGlobalTimeline).HasDefaultValue(false);
entity.Property(e => e.DisableLocalTimeline).HasDefaultValue(false);
entity.Property(e => e.DisableRecommendedTimeline).HasDefaultValue(true);
entity.Property(e => e.DisableRegistration).HasDefaultValue(false);
entity.Property(e => e.EmailRequiredForSignup).HasDefaultValue(false);
entity.Property(e => e.EnableActiveEmailValidation).HasDefaultValue(true);
entity.Property(e => e.EnableDiscordIntegration).HasDefaultValue(false);
entity.Property(e => e.EnableEmail).HasDefaultValue(false);
entity.Property(e => e.EnableGithubIntegration).HasDefaultValue(false);
entity.Property(e => e.EnableHcaptcha).HasDefaultValue(false);
entity.Property(e => e.EnableIdenticonGeneration).HasDefaultValue(true);
entity.Property(e => e.EnableIpLogging).HasDefaultValue(false);
entity.Property(e => e.EnableRecaptcha).HasDefaultValue(false);
entity.Property(e => e.EnableServerMachineStats).HasDefaultValue(false);
entity.Property(e => e.ErrorImageUrl)
.HasDefaultValueSql("'/static-assets/badges/error.png'::character varying");
entity.Property(e => e.ExperimentalFeatures).HasDefaultValueSql("'{}'::jsonb");
entity.Property(e => e.FeedbackUrl)
.HasDefaultValueSql("'https://iceshrimp.dev/iceshrimp/iceshrimp/issues/new'::character varying");
entity.Property(e => e.HiddenTags).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.Langs).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.LocalDriveCapacityMb)
.HasDefaultValue(1024)
.HasComment("Drive capacity of a local user (MB)");
entity.Property(e => e.MascotImageUrl)
.HasDefaultValueSql("'/static-assets/badges/info.png'::character varying");
entity.Property(e => e.ObjectStorageS3ForcePathStyle).HasDefaultValue(true);
entity.Property(e => e.ObjectStorageSetPublicRead).HasDefaultValue(false);
entity.Property(e => e.ObjectStorageUseProxy).HasDefaultValue(true);
entity.Property(e => e.ObjectStorageUseSsl).HasDefaultValue(true);
entity.Property(e => e.PinnedPages)
.HasDefaultValueSql("'{/featured,/channels,/explore,/pages,/about-iceshrimp}'::character varying[]");
entity.Property(e => e.PinnedUsers).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.PrivateMode).HasDefaultValue(false);
entity.Property(e => e.RecommendedInstances).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.RemoteDriveCapacityMb)
.HasDefaultValue(32)
.HasComment("Drive capacity of a remote user (MB)");
entity.Property(e => e.RepositoryUrl)
.HasDefaultValueSql("'https://iceshrimp.dev/iceshrimp/iceshrimp'::character varying");
entity.Property(e => e.SecureMode).HasDefaultValue(true);
entity.Property(e => e.SilencedHosts).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.SmtpSecure).HasDefaultValue(false);
entity.Property(e => e.UseObjectStorage).HasDefaultValue(false);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -29,4 +30,16 @@ public class ModerationLog
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.ModerationLogs))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<ModerationLog>
{
public void Configure(EntityTypeBuilder<ModerationLog> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the ModerationLog.");
entity.HasOne(d => d.User)
.WithMany(p => p.ModerationLogs)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -46,4 +47,22 @@ public class Muting
[ForeignKey(nameof(MuterId))]
[InverseProperty(nameof(User.OutgoingMutes))]
public virtual User Muter { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<Muting>
{
public void Configure(EntityTypeBuilder<Muting> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the Muting.");
entity.Property(e => e.MuteeId).HasComment("The mutee user ID.");
entity.Property(e => e.MuterId).HasComment("The muter user ID.");
entity.HasOne(d => d.Mutee)
.WithMany(p => p.IncomingMutes)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.Muter)
.WithMany(p => p.OutgoingMutes)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -5,6 +5,7 @@ using EntityFrameworkCore.Projectables;
using Iceshrimp.Backend.Core.Configuration;
using Iceshrimp.Backend.Core.Helpers;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using NpgsqlTypes;
using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
@ -371,4 +372,72 @@ public class Note : IEntity
[J("username")] public required string Username { get; set; }
[J("host")] public required string? Host { get; set; }
}
private class EntityTypeConfiguration : IEntityTypeConfiguration<Note>
{
public void Configure(EntityTypeBuilder<Note> entity)
{
entity.HasIndex(e => e.Mentions, "GIN_note_mentions").HasMethod("gin");
entity.HasIndex(e => e.Tags, "GIN_note_tags").HasMethod("gin");
entity.HasIndex(e => e.VisibleUserIds, "GIN_note_visibleUserIds").HasMethod("gin");
entity.HasIndex(e => e.Text, "GIN_TRGM_note_text")
.HasMethod("gin")
.HasOperators("gin_trgm_ops");
entity.HasIndex(e => e.Cw, "GIN_TRGM_note_cw")
.HasMethod("gin")
.HasOperators("gin_trgm_ops");
entity.HasIndex(e => e.CombinedAltText, "GIN_TRGM_note_combined_alt_text")
.HasMethod("gin")
.HasOperators("gin_trgm_ops");
entity.Property(e => e.AttachedFileTypes).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.ChannelId).HasComment("The ID of source channel.");
entity.Property(e => e.CreatedAt).HasComment("The created date of the Note.");
entity.Property(e => e.Emojis).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.FileIds).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.HasPoll).HasDefaultValue(false);
entity.Property(e => e.LikeCount).HasDefaultValue(0);
entity.Property(e => e.LocalOnly).HasDefaultValue(false);
entity.Property(e => e.MentionedRemoteUsers).HasDefaultValueSql("'[]'::jsonb");
entity.Property(e => e.Mentions).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.Reactions).HasDefaultValueSql("'{}'::jsonb");
entity.Property(e => e.RenoteCount).HasDefaultValue((short)0);
entity.Property(e => e.RenoteId).HasComment("The ID of renote target.");
entity.Property(e => e.RenoteUserHost).HasComment("[Denormalized]");
entity.Property(e => e.RenoteUserId).HasComment("[Denormalized]");
entity.Property(e => e.RepliesCount).HasDefaultValue((short)0);
entity.Property(e => e.ReplyId).HasComment("The ID of reply target.");
entity.Property(e => e.ReplyUserHost).HasComment("[Denormalized]");
entity.Property(e => e.ReplyUserId).HasComment("[Denormalized]");
entity.Property(e => e.Score).HasDefaultValue(0);
entity.Property(e => e.Tags).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.UpdatedAt).HasComment("The updated date of the Note.");
entity.Property(e => e.Uri).HasComment("The URI of a note. it will be null when the note is local.");
entity.Property(e => e.Url)
.HasComment("The human readable url of a note. it will be null when the note is local.");
entity.Property(e => e.UserHost).HasComment("[Denormalized]");
entity.Property(e => e.UserId).HasComment("The ID of author.");
entity.Property(e => e.VisibleUserIds).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.ReplyUri)
.HasComment("The URI of the reply target, if it couldn't be resolved at time of ingestion.");
entity.Property(e => e.RenoteUri)
.HasComment("The URI of the renote target, if it couldn't be resolved at time of ingestion.");
entity.HasOne(d => d.Channel)
.WithMany(p => p.Notes)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.Renote)
.WithMany(p => p.InverseRenote)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.Reply)
.WithMany(p => p.InverseReply)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User)
.WithMany(p => p.Notes)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -31,4 +32,20 @@ public class NoteBookmark
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.NoteBookmarks))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<NoteBookmark>
{
public void Configure(EntityTypeBuilder<NoteBookmark> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the NoteBookmark.");
entity.HasOne(d => d.Note)
.WithMany(p => p.NoteBookmarks)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User)
.WithMany(p => p.NoteBookmarks)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -36,4 +37,18 @@ public class NoteEdit
[ForeignKey(nameof(NoteId))]
[InverseProperty(nameof(Tables.Note.NoteEdits))]
public virtual Note Note { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<NoteEdit>
{
public void Configure(EntityTypeBuilder<NoteEdit> entity)
{
entity.Property(e => e.FileIds).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.NoteId).HasComment("The ID of note.");
entity.Property(e => e.UpdatedAt).HasComment("The updated date of the Note.");
entity.HasOne(d => d.Note)
.WithMany(p => p.NoteEdits)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -28,4 +29,18 @@ public class NoteLike : IEntity
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.NoteLikes))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<NoteLike>
{
public void Configure(EntityTypeBuilder<NoteLike> entity)
{
entity.HasOne(d => d.Note)
.WithMany(p => p.NoteLikes)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User)
.WithMany(p => p.NoteLikes)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -37,4 +38,20 @@ public class NoteReaction
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.NoteReactions))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<NoteReaction>
{
public void Configure(EntityTypeBuilder<NoteReaction> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the NoteReaction.");
entity.HasOne(d => d.Note)
.WithMany(p => p.NoteReactions)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User)
.WithMany(p => p.NoteReactions)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -30,4 +31,14 @@ public class NoteThreadMuting
[ForeignKey(nameof(ThreadId))]
[InverseProperty(nameof(NoteThread.NoteThreadMutings))]
public virtual NoteThread Thread { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<NoteThreadMuting>
{
public void Configure(EntityTypeBuilder<NoteThreadMuting> entity)
{
entity.HasOne(d => d.User)
.WithMany(p => p.NoteThreadMutings)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -48,4 +49,21 @@ public class NoteUnread
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.NoteUnreads))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<NoteUnread>
{
public void Configure(EntityTypeBuilder<NoteUnread> entity)
{
entity.Property(e => e.NoteChannelId).HasComment("[Denormalized]");
entity.Property(e => e.NoteUserId).HasComment("[Denormalized]");
entity.HasOne(d => d.Note)
.WithMany(p => p.NoteUnreads)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User)
.WithMany(p => p.NoteUnreads)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -51,4 +52,23 @@ public class NoteWatching
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.NoteWatchings))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<NoteWatching>
{
public void Configure(EntityTypeBuilder<NoteWatching> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the NoteWatching.");
entity.Property(e => e.NoteId).HasComment("The target Note ID.");
entity.Property(e => e.NoteUserId).HasComment("[Denormalized]");
entity.Property(e => e.UserId).HasComment("The watcher ID.");
entity.HasOne(d => d.Note)
.WithMany(p => p.NoteWatchings)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User)
.WithMany(p => p.NoteWatchings)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using NpgsqlTypes;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -133,4 +134,38 @@ public class Notification : IEntity
Note = Note?.WithPrecomputedVisibilities(reply, renote, renoteRenote);
return this;
}
private class EntityTypeConfiguration : IEntityTypeConfiguration<Notification>
{
public void Configure(EntityTypeBuilder<Notification> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the Notification.");
entity.Property(e => e.IsRead)
.HasDefaultValue(false)
.HasComment("Whether the notification was read.");
entity.Property(e => e.NotifieeId).HasComment("The ID of recipient user of the Notification.");
entity.Property(e => e.NotifierId).HasComment("The ID of sender user of the Notification.");
entity.Property(e => e.Type).HasComment("The type of the Notification.");
entity.HasOne(d => d.FollowRequest)
.WithMany(p => p.Notifications)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.Note)
.WithMany(p => p.Notifications)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.Notifiee)
.WithMany(p => p.NotificationNotifiees)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.Notifier)
.WithMany(p => p.NotificationNotifiers)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.UserGroupInvitation)
.WithMany(p => p.Notifications)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -67,4 +68,18 @@ public class OauthApp
/// </summary>
[Column("appToken")] [StringLength(64)]
public string? Token;
private class EntityTypeConfiguration : IEntityTypeConfiguration<OauthApp>
{
public void Configure(EntityTypeBuilder<OauthApp> entity)
{
entity.Property(e => e.ClientId).HasComment("The client id of the OAuth application");
entity.Property(e => e.ClientSecret).HasComment("The client secret of the OAuth application");
entity.Property(e => e.CreatedAt).HasComment("The created date of the OAuth application");
entity.Property(e => e.Name).HasComment("The name of the OAuth application");
entity.Property(e => e.RedirectUris).HasComment("The redirect URIs of the OAuth application");
entity.Property(e => e.Scopes).HasComment("The scopes requested by the OAuth application");
entity.Property(e => e.Website).HasComment("The website of the OAuth application");
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -73,4 +74,34 @@ public class OauthToken
[Column("isPleroma")] public bool IsPleroma { get; set; }
[Column("lastActiveDate")] public DateTime? LastActiveDate { get; set; }
private class EntityTypeConfiguration : IEntityTypeConfiguration<OauthToken>
{
public void Configure(EntityTypeBuilder<OauthToken> entity)
{
entity.Property(e => e.Active).HasComment("Whether or not the token has been activated");
entity.Property(e => e.Code).HasComment("The auth code for the OAuth token");
entity.Property(e => e.CreatedAt).HasComment("The created date of the OAuth token");
entity.Property(e => e.RedirectUri).HasComment("The redirect URI of the OAuth token");
entity.Property(e => e.Scopes).HasComment("The scopes requested by the OAuth token");
entity.Property(e => e.Token).HasComment("The OAuth token");
entity.Property(e => e.SupportsHtmlFormatting)
.HasComment("Whether the client supports HTML inline formatting (bold, italic, strikethrough, ...)")
.HasDefaultValue(true);
entity.Property(e => e.AutoDetectQuotes)
.HasComment("Whether the backend should automatically detect quote posts coming from this client")
.HasDefaultValue(true);
entity.Property(e => e.IsPleroma)
.HasComment("Whether Pleroma or Akkoma specific behavior should be enabled for this client")
.HasDefaultValue(false);
entity.HasOne(d => d.App)
.WithMany(p => p.OauthTokens)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User)
.WithMany(p => p.OauthTokens)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using NpgsqlTypes;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -98,4 +99,28 @@ public class Page
[InverseProperty(nameof(Tables.UserProfile.PinnedPage))]
public virtual UserProfile? UserProfile { get; set; }
private class EntityTypeConfiguration : IEntityTypeConfiguration<Page>
{
public void Configure(EntityTypeBuilder<Page> entity)
{
entity.Property(e => e.Content).HasDefaultValueSql("'[]'::jsonb");
entity.Property(e => e.CreatedAt).HasComment("The created date of the Page.");
entity.Property(e => e.HideTitleWhenPinned).HasDefaultValue(false);
entity.Property(e => e.LikedCount).HasDefaultValue(0);
entity.Property(e => e.Script).HasDefaultValueSql("''::character varying");
entity.Property(e => e.UpdatedAt).HasComment("The updated date of the Page.");
entity.Property(e => e.UserId).HasComment("The ID of author.");
entity.Property(e => e.Variables).HasDefaultValueSql("'[]'::jsonb");
entity.Property(e => e.VisibleUserIds).HasDefaultValueSql("'{}'::character varying[]");
entity.HasOne(d => d.EyeCatchingImage)
.WithMany(p => p.Pages)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User)
.WithMany(p => p.Pages)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -27,4 +28,18 @@ public class PageLike
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.PageLikes))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<PageLike>
{
public void Configure(EntityTypeBuilder<PageLike> entity)
{
entity.HasOne(d => d.Page)
.WithMany(p => p.PageLikes)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User)
.WithMany(p => p.PageLikes)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -23,4 +24,14 @@ public class PasswordResetRequest
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.PasswordResetRequests))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<PasswordResetRequest>
{
public void Configure(EntityTypeBuilder<PasswordResetRequest> entity)
{
entity.HasOne(d => d.User)
.WithMany(p => p.PasswordResetRequests)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -12,12 +12,14 @@ public class PluginStoreEntry
[Key] [Column("id")] public Guid Id { get; set; }
[Column("name")] public string Name { get; set; } = null!;
[Column("data", TypeName = "jsonb")] public string Data { get; set; } = null!;
}
public class PluginStoreEntityTypeConfiguration : IEntityTypeConfiguration<PluginStoreEntry>
{
public void Configure(EntityTypeBuilder<PluginStoreEntry> entity)
private class EntityTypeConfiguration : IEntityTypeConfiguration<PluginStoreEntry>
{
entity.Property(e => e.Data).HasDefaultValueSql("'{}'::jsonb").HasComment("The plugin-specific data object");
public void Configure(EntityTypeBuilder<PluginStoreEntry> entity)
{
entity.Property(e => e.Data)
.HasDefaultValueSql("'{}'::jsonb")
.HasComment("The plugin-specific data object");
}
}
}

View file

@ -10,12 +10,12 @@ public class PolicyConfiguration
{
[Key] [Column("name")] public string Name { get; set; } = null!;
[Column("data", TypeName = "jsonb")] public string Data { get; set; } = null!;
}
public class PolicyConfigurationeEntityTypeConfiguration : IEntityTypeConfiguration<PolicyConfiguration>
{
public void Configure(EntityTypeBuilder<PolicyConfiguration> entity)
private class EntityTypeConfiguration : IEntityTypeConfiguration<PolicyConfiguration>
{
entity.Property(e => e.Data).HasDefaultValueSql("'{}'::jsonb").HasComment("The plugin-specific data object");
public void Configure(EntityTypeBuilder<PolicyConfiguration> entity)
{
entity.Property(e => e.Data).HasDefaultValueSql("'{}'::jsonb").HasComment("The plugin-specific data object");
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -48,4 +49,19 @@ public class Poll
/// </summary>
[Column("noteVisibility")]
public Note.NoteVisibility NoteVisibility { get; set; }
private class EntityTypeConfiguration : IEntityTypeConfiguration<Poll>
{
public void Configure(EntityTypeBuilder<Poll> entity)
{
entity.Property(e => e.Choices).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.UserHost).HasComment("[Denormalized]");
entity.Property(e => e.UserId).HasComment("[Denormalized]");
entity.Property(e => e.NoteVisibility).HasComment("[Denormalized]");
entity.HasOne(d => d.Note)
.WithOne(p => p.Poll)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -35,4 +36,20 @@ public class PollVote
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.PollVotes))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<PollVote>
{
public void Configure(EntityTypeBuilder<PollVote> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the PollVote.");
entity.HasOne(d => d.Note)
.WithMany(p => p.PollVotes)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User)
.WithMany(p => p.PollVotes)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -25,4 +26,16 @@ public class PromoNote
[ForeignKey(nameof(NoteId))]
[InverseProperty(nameof(Tables.Note.PromoNote))]
public virtual Note Note { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<PromoNote>
{
public void Configure(EntityTypeBuilder<PromoNote> entity)
{
entity.Property(e => e.UserId).HasComment("[Denormalized]");
entity.HasOne(d => d.Note)
.WithOne(p => p.PromoNote)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -31,4 +32,20 @@ public class PromoRead
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.PromoReads))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<PromoRead>
{
public void Configure(EntityTypeBuilder<PromoRead> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the PromoRead.");
entity.HasOne(d => d.Note)
.WithMany(p => p.PromoReads)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User)
.WithMany(p => p.PromoReads)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using NpgsqlTypes;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -54,4 +55,21 @@ public class PushSubscription
[ForeignKey(nameof(OauthTokenId))]
[InverseProperty(nameof(Tables.OauthToken.PushSubscription))]
public virtual OauthToken OauthToken { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<PushSubscription>
{
public void Configure(EntityTypeBuilder<PushSubscription> entity)
{
entity.Property(e => e.Types).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.Policy).HasDefaultValue(PushPolicy.All);
entity.HasOne(d => d.User)
.WithMany(p => p.PushSubscriptions)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.OauthToken)
.WithOne(p => p.PushSubscription)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -16,4 +17,9 @@ public class RegistrationInvite
[Column("createdAt")] public DateTime CreatedAt { get; set; }
[Column("code")] [StringLength(64)] public string Code { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<RegistrationInvite>
{
public void Configure(EntityTypeBuilder<RegistrationInvite> entity) { }
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -56,4 +57,23 @@ public class RegistryItem
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.RegistryItems))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<RegistryItem>
{
public void Configure(EntityTypeBuilder<RegistryItem> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the RegistryItem.");
entity.Property(e => e.Key).HasComment("The key of the RegistryItem.");
entity.Property(e => e.Scope).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.UpdatedAt).HasComment("The updated date of the RegistryItem.");
entity.Property(e => e.UserId).HasComment("The owner ID.");
entity.Property(e => e.Value)
.HasDefaultValueSql("'{}'::jsonb")
.HasComment("The value of the RegistryItem.");
entity.HasOne(d => d.User)
.WithMany(p => p.RegistryItems)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using NpgsqlTypes;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -13,8 +14,8 @@ public class Relay
public enum RelayStatus
{
[PgName("requesting")] Requesting = 0,
[PgName("accepted")] Accepted = 1,
[PgName("rejected")] Rejected = 2
[PgName("accepted")] Accepted = 1,
[PgName("rejected")] Rejected = 2
}
[Key]
@ -25,4 +26,9 @@ public class Relay
[Column("inbox")] [StringLength(512)] public string Inbox { get; set; } = null!;
[Column("status")] public RelayStatus Status { get; set; }
private class EntityTypeConfiguration : IEntityTypeConfiguration<Relay>
{
public void Configure(EntityTypeBuilder<Relay> entity) { }
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -43,4 +44,22 @@ public class RenoteMuting
[ForeignKey(nameof(MuterId))]
[InverseProperty(nameof(User.RenoteMutingMuters))]
public virtual User Muter { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<RenoteMuting>
{
public void Configure(EntityTypeBuilder<RenoteMuting> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the Muting.");
entity.Property(e => e.MuteeId).HasComment("The mutee user ID.");
entity.Property(e => e.MuterId).HasComment("The muter user ID.");
entity.HasOne(d => d.Mutee)
.WithMany(p => p.RenoteMutingMutees)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.Muter)
.WithMany(p => p.RenoteMutingMuters)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -39,4 +40,19 @@ public class Session
public virtual User User { get; set; } = null!;
[Column("lastActiveDate")] public DateTime? LastActiveDate { get; set; }
private class EntityTypeConfiguration : IEntityTypeConfiguration<Session>
{
public void Configure(EntityTypeBuilder<Session> entity)
{
entity.Property(e => e.Active)
.HasComment("Whether or not the token has been activated (i.e. 2fa has been confirmed)");
entity.Property(e => e.CreatedAt).HasComment("The created date of the OAuth token");
entity.Property(e => e.Token).HasComment("The authorization token");
entity.HasOne(d => d.User)
.WithMany(p => p.Sessions)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -32,4 +33,16 @@ public class SwSubscription
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.SwSubscriptions))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<SwSubscription>
{
public void Configure(EntityTypeBuilder<SwSubscription> entity)
{
entity.Property(e => e.SendReadMessage).HasDefaultValue(false);
entity.HasOne(d => d.User)
.WithMany(p => p.SwSubscriptions)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,5 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -12,4 +14,9 @@ public class UsedUsername
public string Username { get; set; } = null!;
[Column("createdAt")] public DateTime CreatedAt { get; set; }
private class EntityTypeConfiguration : IEntityTypeConfiguration<UsedUsername>
{
public void Configure(EntityTypeBuilder<UsedUsername> entity) { }
}
}

View file

@ -633,87 +633,87 @@ public class User : IEntity
[Projectable] public string PublicUrlPath => $"/@{Username}";
public string GetIdenticonUrl(string webDomain) => $"https://{webDomain}{IdenticonUrlPath}";
}
public class UserEntityTypeConfiguration : IEntityTypeConfiguration<User>
{
public void Configure(EntityTypeBuilder<User> entity)
private class EntityTypeConfiguration : IEntityTypeConfiguration<User>
{
entity.Property(e => e.AlsoKnownAs).HasComment("URIs the user is known as too");
entity.Property(e => e.AvatarBlurhash).HasComment("The blurhash of the avatar DriveFile");
entity.Property(e => e.AvatarId).HasComment("The ID of avatar DriveFile.");
entity.Property(e => e.AvatarUrl).HasComment("The URL of the avatar DriveFile");
entity.Property(e => e.BannerBlurhash).HasComment("The blurhash of the banner DriveFile");
entity.Property(e => e.BannerId).HasComment("The ID of banner DriveFile.");
entity.Property(e => e.BannerUrl).HasComment("The URL of the banner DriveFile");
entity.Property(e => e.CreatedAt).HasComment("The created date of the User.");
entity.Property(e => e.DriveCapacityOverrideMb).HasComment("Overrides user drive capacity limit");
entity.Property(e => e.Emojis).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.Featured)
.HasComment("The featured URL of the User. It will be null if the origin of the user is local.");
entity.Property(e => e.FollowersCount)
.HasDefaultValue(0)
.HasComment("The count of followers.");
entity.Property(e => e.FollowersUri)
.HasComment("The URI of the user Follower Collection. It will be null if the origin of the user is local.");
entity.Property(e => e.FollowingCount)
.HasDefaultValue(0)
.HasComment("The count of following.");
entity.Property(e => e.Host)
.HasComment("The host of the User. It will be null if the origin of the user is local.");
entity.Property(e => e.Inbox)
.HasComment("The inbox URL of the User. It will be null if the origin of the user is local.");
entity.Property(e => e.IsAdmin)
.HasDefaultValue(false)
.HasComment("Whether the User is the admin.");
entity.Property(e => e.IsBot)
.HasDefaultValue(false)
.HasComment("Whether the User is a bot.");
entity.Property(e => e.IsCat)
.HasDefaultValue(false)
.HasComment("Whether the User is a cat.");
entity.Property(e => e.IsDeleted)
.HasDefaultValue(false)
.HasComment("Whether the User is deleted.");
entity.Property(e => e.IsExplorable)
.HasDefaultValue(true)
.HasComment("Whether the User is explorable.");
entity.Property(e => e.IsLocked)
.HasDefaultValue(false)
.HasComment("Whether the User is locked.");
entity.Property(e => e.IsModerator)
.HasDefaultValue(false)
.HasComment("Whether the User is a moderator.");
entity.Property(e => e.IsSilenced)
.HasDefaultValue(false)
.HasComment("Whether the User is silenced.");
entity.Property(e => e.IsSuspended)
.HasDefaultValue(false)
.HasComment("Whether the User is suspended.");
entity.Property(e => e.MovedToUri).HasComment("The URI of the new account of the User");
entity.Property(e => e.DisplayName).HasComment("The name of the User.");
entity.Property(e => e.NotesCount)
.HasDefaultValue(0)
.HasComment("The count of notes.");
entity.Property(e => e.SharedInbox)
.HasComment("The sharedInbox URL of the User. It will be null if the origin of the user is local.");
entity.Property(e => e.SpeakAsCat)
.HasDefaultValue(true)
.HasComment("Whether to speak as a cat if isCat.");
entity.Property(e => e.Tags).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.UpdatedAt).HasComment("The updated date of the User.");
entity.Property(e => e.Uri)
.HasComment("The URI of the User. It will be null if the origin of the user is local.");
entity.Property(e => e.Username).HasComment("The username of the User.");
entity.Property(e => e.UsernameLower).HasComment("The username (lowercased) of the User.");
entity.Property(e => e.SplitDomainResolved).HasDefaultValue(false);
public void Configure(EntityTypeBuilder<User> entity)
{
entity.Property(e => e.AlsoKnownAs).HasComment("URIs the user is known as too");
entity.Property(e => e.AvatarBlurhash).HasComment("The blurhash of the avatar DriveFile");
entity.Property(e => e.AvatarId).HasComment("The ID of avatar DriveFile.");
entity.Property(e => e.AvatarUrl).HasComment("The URL of the avatar DriveFile");
entity.Property(e => e.BannerBlurhash).HasComment("The blurhash of the banner DriveFile");
entity.Property(e => e.BannerId).HasComment("The ID of banner DriveFile.");
entity.Property(e => e.BannerUrl).HasComment("The URL of the banner DriveFile");
entity.Property(e => e.CreatedAt).HasComment("The created date of the User.");
entity.Property(e => e.DriveCapacityOverrideMb).HasComment("Overrides user drive capacity limit");
entity.Property(e => e.Emojis).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.Featured)
.HasComment("The featured URL of the User. It will be null if the origin of the user is local.");
entity.Property(e => e.FollowersCount)
.HasDefaultValue(0)
.HasComment("The count of followers.");
entity.Property(e => e.FollowersUri)
.HasComment("The URI of the user Follower Collection. It will be null if the origin of the user is local.");
entity.Property(e => e.FollowingCount)
.HasDefaultValue(0)
.HasComment("The count of following.");
entity.Property(e => e.Host)
.HasComment("The host of the User. It will be null if the origin of the user is local.");
entity.Property(e => e.Inbox)
.HasComment("The inbox URL of the User. It will be null if the origin of the user is local.");
entity.Property(e => e.IsAdmin)
.HasDefaultValue(false)
.HasComment("Whether the User is the admin.");
entity.Property(e => e.IsBot)
.HasDefaultValue(false)
.HasComment("Whether the User is a bot.");
entity.Property(e => e.IsCat)
.HasDefaultValue(false)
.HasComment("Whether the User is a cat.");
entity.Property(e => e.IsDeleted)
.HasDefaultValue(false)
.HasComment("Whether the User is deleted.");
entity.Property(e => e.IsExplorable)
.HasDefaultValue(true)
.HasComment("Whether the User is explorable.");
entity.Property(e => e.IsLocked)
.HasDefaultValue(false)
.HasComment("Whether the User is locked.");
entity.Property(e => e.IsModerator)
.HasDefaultValue(false)
.HasComment("Whether the User is a moderator.");
entity.Property(e => e.IsSilenced)
.HasDefaultValue(false)
.HasComment("Whether the User is silenced.");
entity.Property(e => e.IsSuspended)
.HasDefaultValue(false)
.HasComment("Whether the User is suspended.");
entity.Property(e => e.MovedToUri).HasComment("The URI of the new account of the User");
entity.Property(e => e.DisplayName).HasComment("The name of the User.");
entity.Property(e => e.NotesCount)
.HasDefaultValue(0)
.HasComment("The count of notes.");
entity.Property(e => e.SharedInbox)
.HasComment("The sharedInbox URL of the User. It will be null if the origin of the user is local.");
entity.Property(e => e.SpeakAsCat)
.HasDefaultValue(true)
.HasComment("Whether to speak as a cat if isCat.");
entity.Property(e => e.Tags).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.UpdatedAt).HasComment("The updated date of the User.");
entity.Property(e => e.Uri)
.HasComment("The URI of the User. It will be null if the origin of the user is local.");
entity.Property(e => e.Username).HasComment("The username of the User.");
entity.Property(e => e.UsernameLower).HasComment("The username (lowercased) of the User.");
entity.Property(e => e.SplitDomainResolved).HasDefaultValue(false);
entity.HasOne(d => d.Avatar)
.WithOne(p => p.UserAvatar)
.OnDelete(DeleteBehavior.SetNull);
entity.HasOne(d => d.Avatar)
.WithOne(p => p.UserAvatar)
.OnDelete(DeleteBehavior.SetNull);
entity.HasOne(d => d.Banner)
.WithOne(p => p.UserBanner)
.OnDelete(DeleteBehavior.SetNull);
entity.HasOne(d => d.Banner)
.WithOne(p => p.UserBanner)
.OnDelete(DeleteBehavior.SetNull);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -44,4 +45,18 @@ public class UserGroup
[InverseProperty(nameof(UserGroupMember.UserGroup))]
public virtual ICollection<UserGroupMember> UserGroupMembers { get; set; } = new List<UserGroupMember>();
private class EntityTypeConfiguration : IEntityTypeConfiguration<UserGroup>
{
public void Configure(EntityTypeBuilder<UserGroup> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the UserGroup.");
entity.Property(e => e.IsPrivate).HasDefaultValue(false);
entity.Property(e => e.UserId).HasComment("The ID of owner.");
entity.HasOne(d => d.User)
.WithMany(p => p.UserGroups)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -45,4 +46,22 @@ public class UserGroupInvitation
[ForeignKey(nameof(UserGroupId))]
[InverseProperty(nameof(Tables.UserGroup.UserGroupInvitations))]
public virtual UserGroup UserGroup { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<UserGroupInvitation>
{
public void Configure(EntityTypeBuilder<UserGroupInvitation> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the UserGroupInvitation.");
entity.Property(e => e.UserGroupId).HasComment("The group ID.");
entity.Property(e => e.UserId).HasComment("The user ID.");
entity.HasOne(d => d.UserGroup)
.WithMany(p => p.UserGroupInvitations)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User)
.WithMany(p => p.UserGroupInvitations)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -45,4 +46,22 @@ public class UserGroupMember
[ForeignKey(nameof(UserGroupId))]
[InverseProperty(nameof(Tables.UserGroup.UserGroupMembers))]
public virtual UserGroup UserGroup { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<UserGroupMember>
{
public void Configure(EntityTypeBuilder<UserGroupMember> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the UserGroupMember.");
entity.Property(e => e.UserGroupId).HasComment("The group ID.");
entity.Property(e => e.UserId).HasComment("The user ID.");
entity.HasOne(d => d.UserGroup)
.WithMany(p => p.UserGroupMembers)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User)
.WithMany(p => p.UserGroupMemberships)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,5 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -22,4 +24,14 @@ public class UserKeypair
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.UserKeypair))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<UserKeypair>
{
public void Configure(EntityTypeBuilder<UserKeypair> entity)
{
entity.HasOne(d => d.User)
.WithOne(p => p.UserKeypair)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -48,4 +49,21 @@ public class UserList
[InverseProperty(nameof(UserListMember.UserList))]
public virtual ICollection<UserListMember> UserListMembers { get; set; } = new List<UserListMember>();
private class EntityTypeConfiguration : IEntityTypeConfiguration<UserList>
{
public void Configure(EntityTypeBuilder<UserList> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the UserList.");
entity.Property(e => e.HideFromHomeTl)
.HasDefaultValue(false)
.HasComment("Whether posts from list members should be hidden from the home timeline.");
entity.Property(e => e.Name).HasComment("The name of the UserList.");
entity.Property(e => e.UserId).HasComment("The owner ID.");
entity.HasOne(d => d.User)
.WithMany(p => p.UserLists)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -42,4 +43,22 @@ public class UserListMember : IEntity
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<UserListMember>
{
public void Configure(EntityTypeBuilder<UserListMember> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the UserListMember.");
entity.Property(e => e.UserId).HasComment("The user ID.");
entity.Property(e => e.UserListId).HasComment("The list ID.");
entity.HasOne(d => d.User)
.WithMany(p => p.UserListMembers)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.UserList)
.WithMany(p => p.UserListMembers)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -31,4 +32,20 @@ public class UserNotePin
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.UserNotePins))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<UserNotePin>
{
public void Configure(EntityTypeBuilder<UserNotePin> entity)
{
entity.Property(e => e.CreatedAt).HasComment("The created date of the UserNotePins.");
entity.HasOne(d => d.Note)
.WithMany(p => p.UserNotePins)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User)
.WithMany(p => p.UserNotePins)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -26,4 +27,9 @@ public class UserPending
[Column("password")]
[StringLength(128)]
public string Password { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<UserPending>
{
public void Configure(EntityTypeBuilder<UserPending> entity) { }
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using NpgsqlTypes;
using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
@ -92,4 +93,32 @@ public class UserProfile
[PgName("followers")] Followers = 1,
[PgName("private")] Private = 2
}
private class EntityTypeConfiguration : IEntityTypeConfiguration<UserProfile>
{
public void Configure(EntityTypeBuilder<UserProfile> entity)
{
entity.Property(e => e.Birthday)
.IsFixedLength()
.HasComment("The birthday (YYYY-MM-DD) of the User.");
entity.Property(e => e.Description).HasComment("The description (bio) of the User.");
entity.Property(e => e.Fields).HasDefaultValueSql("'[]'::jsonb");
entity.Property(e => e.Location).HasComment("The location of the User.");
entity.Property(e => e.Mentions).HasDefaultValueSql("'[]'::jsonb");
entity.Property(e => e.ModerationNote).HasDefaultValueSql("''::character varying");
entity.Property(e => e.Url).HasComment("Remote URL of the user.");
entity.Property(e => e.UserHost).HasComment("[Denormalized]");
entity.Property(e => e.FFVisibility)
.HasDefaultValue(UserProfileFFVisibility.Public);
entity.Property(e => e.MentionsResolved).HasDefaultValue(false);
entity.HasOne(d => d.PinnedPage)
.WithOne(p => p.UserProfile)
.OnDelete(DeleteBehavior.SetNull);
entity.HasOne(d => d.User)
.WithOne(p => p.UserProfile)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -22,4 +23,14 @@ public class UserPublickey
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.UserPublickey))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<UserPublickey>
{
public void Configure(EntityTypeBuilder<UserPublickey> entity)
{
entity.HasOne(d => d.User)
.WithOne(p => p.UserPublickey)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -40,4 +41,21 @@ public class UserSecurityKey
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.UserSecurityKeys))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<UserSecurityKey>
{
public void Configure(EntityTypeBuilder<UserSecurityKey> entity)
{
entity.Property(e => e.Id).HasComment("Variable-length id given to navigator.credentials.get()");
entity.Property(e => e.LastUsed)
.HasComment("The date of the last time the UserSecurityKey was successfully validated.");
entity.Property(e => e.Name).HasComment("User-defined name for this key");
entity.Property(e => e.PublicKey)
.HasComment("Variable-length public key used to verify attestations (hex-encoded).");
entity.HasOne(d => d.User)
.WithMany(p => p.UserSecurityKeys)
.OnDelete(DeleteBehavior.Cascade);
}
}
}

View file

@ -1,5 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -47,4 +49,22 @@ public class UserSettings
public string? Password { get; set; }
// @formatter:on
private class EntityTypeConfiguration : IEntityTypeConfiguration<UserSettings>
{
public void Configure(EntityTypeBuilder<UserSettings> entity)
{
entity.Property(e => e.PrivateMode).HasDefaultValue(false);
entity.Property(e => e.FilterInaccessible).HasDefaultValue(false);
entity.Property(e => e.DefaultNoteVisibility).HasDefaultValue(Note.NoteVisibility.Public);
entity.Property(e => e.DefaultRenoteVisibility).HasDefaultValue(Note.NoteVisibility.Public);
entity.Property(e => e.AlwaysMarkSensitive).HasDefaultValue(false);
entity.Property(e => e.AutoAcceptFollowed).HasDefaultValue(false);
entity.Property(e => e.Email);
entity.Property(e => e.EmailVerified).HasDefaultValue(false);
entity.Property(e => e.Password);
entity.Property(e => e.TwoFactorEnabled).HasDefaultValue(false);
entity.HasOne(e => e.User).WithOne(e => e.UserSettings);
}
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Iceshrimp.Backend.Core.Database.Tables;
@ -53,4 +54,20 @@ public class Webhook
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.Webhooks))]
public virtual User User { get; set; } = null!;
private class EntityTypeConfiguration : IEntityTypeConfiguration<Webhook>
{
public void Configure(EntityTypeBuilder<Webhook> entity)
{
entity.Property(e => e.Active).HasDefaultValue(true);
entity.Property(e => e.CreatedAt).HasComment("The created date of the Antenna.");
entity.Property(e => e.Name).HasComment("The name of the Antenna.");
entity.Property(e => e.On).HasDefaultValueSql("'{}'::character varying[]");
entity.Property(e => e.UserId).HasComment("The owner ID.");
entity.HasOne(d => d.User)
.WithMany(p => p.Webhooks)
.OnDelete(DeleteBehavior.Cascade);
}
}
}