Correctly scaffold database enums
This commit is contained in:
parent
a3a330f559
commit
c0ef5e0f1e
10 changed files with 212 additions and 119 deletions
|
@ -1,5 +1,6 @@
|
||||||
using Iceshrimp.Backend.Core.Database.Tables;
|
using Iceshrimp.Backend.Core.Database.Tables;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Npgsql;
|
||||||
|
|
||||||
namespace Iceshrimp.Backend.Core.Database;
|
namespace Iceshrimp.Backend.Core.Database;
|
||||||
|
|
||||||
|
@ -9,227 +10,234 @@ public partial class DatabaseContext : DbContext {
|
||||||
public DatabaseContext(DbContextOptions<DatabaseContext> options)
|
public DatabaseContext(DbContextOptions<DatabaseContext> options)
|
||||||
: base(options) { }
|
: base(options) { }
|
||||||
|
|
||||||
public virtual DbSet<AbuseUserReport> AbuseUserReports { get; set; }
|
public virtual DbSet<AbuseUserReport> AbuseUserReports { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<AccessToken> AccessTokens { get; set; }
|
public virtual DbSet<AccessToken> AccessTokens { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Announcement> Announcements { get; set; }
|
public virtual DbSet<Announcement> Announcements { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<AnnouncementRead> AnnouncementReads { get; set; }
|
public virtual DbSet<AnnouncementRead> AnnouncementReads { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Antenna> Antennas { get; set; }
|
public virtual DbSet<Antenna> Antennas { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<App> Apps { get; set; }
|
public virtual DbSet<App> Apps { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<AttestationChallenge> AttestationChallenges { get; set; }
|
public virtual DbSet<AttestationChallenge> AttestationChallenges { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<AuthSession> AuthSessions { get; set; }
|
public virtual DbSet<AuthSession> AuthSessions { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Blocking> Blockings { get; set; }
|
public virtual DbSet<Blocking> Blockings { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Channel> Channels { get; set; }
|
public virtual DbSet<Channel> Channels { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChannelFollowing> ChannelFollowings { get; set; }
|
public virtual DbSet<ChannelFollowing> ChannelFollowings { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChannelNotePining> ChannelNotePinings { get; set; }
|
public virtual DbSet<ChannelNotePining> ChannelNotePinings { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartActiveUser> ChartActiveUsers { get; set; }
|
public virtual DbSet<ChartActiveUser> ChartActiveUsers { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartApRequest> ChartApRequests { get; set; }
|
public virtual DbSet<ChartApRequest> ChartApRequests { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartDayActiveUser> ChartDayActiveUsers { get; set; }
|
public virtual DbSet<ChartDayActiveUser> ChartDayActiveUsers { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartDayApRequest> ChartDayApRequests { get; set; }
|
public virtual DbSet<ChartDayApRequest> ChartDayApRequests { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartDayDrive> ChartDayDrives { get; set; }
|
public virtual DbSet<ChartDayDrive> ChartDayDrives { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartDayFederation> ChartDayFederations { get; set; }
|
public virtual DbSet<ChartDayFederation> ChartDayFederations { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartDayHashtag> ChartDayHashtags { get; set; }
|
public virtual DbSet<ChartDayHashtag> ChartDayHashtags { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartDayInstance> ChartDayInstances { get; set; }
|
public virtual DbSet<ChartDayInstance> ChartDayInstances { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartDayNetwork> ChartDayNetworks { get; set; }
|
public virtual DbSet<ChartDayNetwork> ChartDayNetworks { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartDayNote> ChartDayNotes { get; set; }
|
public virtual DbSet<ChartDayNote> ChartDayNotes { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartDayPerUserDrive> ChartDayPerUserDrives { get; set; }
|
public virtual DbSet<ChartDayPerUserDrive> ChartDayPerUserDrives { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartDayPerUserFollowing> ChartDayPerUserFollowings { get; set; }
|
public virtual DbSet<ChartDayPerUserFollowing> ChartDayPerUserFollowings { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartDayPerUserNote> ChartDayPerUserNotes { get; set; }
|
public virtual DbSet<ChartDayPerUserNote> ChartDayPerUserNotes { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartDayPerUserReaction> ChartDayPerUserReactions { get; set; }
|
public virtual DbSet<ChartDayPerUserReaction> ChartDayPerUserReactions { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartDayUser> ChartDayUsers { get; set; }
|
public virtual DbSet<ChartDayUser> ChartDayUsers { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartDrive> ChartDrives { get; set; }
|
public virtual DbSet<ChartDrive> ChartDrives { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartFederation> ChartFederations { get; set; }
|
public virtual DbSet<ChartFederation> ChartFederations { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartHashtag> ChartHashtags { get; set; }
|
public virtual DbSet<ChartHashtag> ChartHashtags { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartInstance> ChartInstances { get; set; }
|
public virtual DbSet<ChartInstance> ChartInstances { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartNetwork> ChartNetworks { get; set; }
|
public virtual DbSet<ChartNetwork> ChartNetworks { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartNote> ChartNotes { get; set; }
|
public virtual DbSet<ChartNote> ChartNotes { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartPerUserDrive> ChartPerUserDrives { get; set; }
|
public virtual DbSet<ChartPerUserDrive> ChartPerUserDrives { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartPerUserFollowing> ChartPerUserFollowings { get; set; }
|
public virtual DbSet<ChartPerUserFollowing> ChartPerUserFollowings { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartPerUserNote> ChartPerUserNotes { get; set; }
|
public virtual DbSet<ChartPerUserNote> ChartPerUserNotes { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartPerUserReaction> ChartPerUserReactions { get; set; }
|
public virtual DbSet<ChartPerUserReaction> ChartPerUserReactions { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartTest> ChartTests { get; set; }
|
public virtual DbSet<ChartTest> ChartTests { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartTestGrouped> ChartTestGroupeds { get; set; }
|
public virtual DbSet<ChartTestGrouped> ChartTestGroupeds { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartTestUnique> ChartTestUniques { get; set; }
|
public virtual DbSet<ChartTestUnique> ChartTestUniques { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ChartUser> ChartUsers { get; set; }
|
public virtual DbSet<ChartUser> ChartUsers { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Clip> Clips { get; set; }
|
public virtual DbSet<Clip> Clips { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ClipNote> ClipNotes { get; set; }
|
public virtual DbSet<ClipNote> ClipNotes { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<DriveFile> DriveFiles { get; set; }
|
public virtual DbSet<DriveFile> DriveFiles { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<DriveFolder> DriveFolders { get; set; }
|
public virtual DbSet<DriveFolder> DriveFolders { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Emoji> Emojis { get; set; }
|
public virtual DbSet<Emoji> Emojis { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<FollowRequest> FollowRequests { get; set; }
|
public virtual DbSet<FollowRequest> FollowRequests { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Following> Followings { get; set; }
|
public virtual DbSet<Following> Followings { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<GalleryLike> GalleryLikes { get; set; }
|
public virtual DbSet<GalleryLike> GalleryLikes { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<GalleryPost> GalleryPosts { get; set; }
|
public virtual DbSet<GalleryPost> GalleryPosts { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Hashtag> Hashtags { get; set; }
|
public virtual DbSet<Hashtag> Hashtags { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<HtmlNoteCacheEntry> HtmlNoteCacheEntries { get; set; }
|
public virtual DbSet<HtmlNoteCacheEntry> HtmlNoteCacheEntries { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<HtmlUserCacheEntry> HtmlUserCacheEntries { get; set; }
|
public virtual DbSet<HtmlUserCacheEntry> HtmlUserCacheEntries { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Instance> Instances { get; set; }
|
public virtual DbSet<Instance> Instances { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<MessagingMessage> MessagingMessages { get; set; }
|
public virtual DbSet<MessagingMessage> MessagingMessages { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Metum> Meta { get; set; }
|
public virtual DbSet<Metum> Meta { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Migration> Migrations { get; set; }
|
public virtual DbSet<LegacyMigrations> Migrations { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<ModerationLog> ModerationLogs { get; set; }
|
public virtual DbSet<ModerationLog> ModerationLogs { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Muting> Mutings { get; set; }
|
public virtual DbSet<Muting> Mutings { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Note> Notes { get; set; }
|
public virtual DbSet<Note> Notes { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<NoteEdit> NoteEdits { get; set; }
|
public virtual DbSet<NoteEdit> NoteEdits { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<NoteFavorite> NoteFavorites { get; set; }
|
public virtual DbSet<NoteFavorite> NoteFavorites { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<NoteReaction> NoteReactions { get; set; }
|
public virtual DbSet<NoteReaction> NoteReactions { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<NoteThreadMuting> NoteThreadMutings { get; set; }
|
public virtual DbSet<NoteThreadMuting> NoteThreadMutings { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<NoteUnread> NoteUnreads { get; set; }
|
public virtual DbSet<NoteUnread> NoteUnreads { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<NoteWatching> NoteWatchings { get; set; }
|
public virtual DbSet<NoteWatching> NoteWatchings { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Notification> Notifications { get; set; }
|
public virtual DbSet<Notification> Notifications { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<OauthApp> OauthApps { get; set; }
|
public virtual DbSet<OauthApp> OauthApps { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<OauthToken> OauthTokens { get; set; }
|
public virtual DbSet<OauthToken> OauthTokens { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Page> Pages { get; set; }
|
public virtual DbSet<Page> Pages { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<PageLike> PageLikes { get; set; }
|
public virtual DbSet<PageLike> PageLikes { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<PasswordResetRequest> PasswordResetRequests { get; set; }
|
public virtual DbSet<PasswordResetRequest> PasswordResetRequests { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Poll> Polls { get; set; }
|
public virtual DbSet<Poll> Polls { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<PollVote> PollVotes { get; set; }
|
public virtual DbSet<PollVote> PollVotes { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<PromoNote> PromoNotes { get; set; }
|
public virtual DbSet<PromoNote> PromoNotes { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<PromoRead> PromoReads { get; set; }
|
public virtual DbSet<PromoRead> PromoReads { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<RegistrationTicket> RegistrationTickets { get; set; }
|
public virtual DbSet<RegistrationTicket> RegistrationTickets { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<RegistryItem> RegistryItems { get; set; }
|
public virtual DbSet<RegistryItem> RegistryItems { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Relay> Relays { get; set; }
|
public virtual DbSet<Relay> Relays { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<RenoteMuting> RenoteMutings { get; set; }
|
public virtual DbSet<RenoteMuting> RenoteMutings { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Session> Sessions { get; set; }
|
public virtual DbSet<Session> Sessions { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Signin> Signins { get; set; }
|
public virtual DbSet<Signin> Signins { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<SwSubscription> SwSubscriptions { get; set; }
|
public virtual DbSet<SwSubscription> SwSubscriptions { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<UsedUsername> UsedUsernames { get; set; }
|
public virtual DbSet<UsedUsername> UsedUsernames { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<User> Users { get; set; }
|
public virtual DbSet<User> Users { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<UserGroup> UserGroups { get; set; }
|
public virtual DbSet<UserGroup> UserGroups { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<UserGroupInvitation> UserGroupInvitations { get; set; }
|
public virtual DbSet<UserGroupInvitation> UserGroupInvitations { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<UserGroupInvite> UserGroupInvites { get; set; }
|
public virtual DbSet<UserGroupInvite> UserGroupInvites { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<UserGroupJoining> UserGroupJoinings { get; set; }
|
public virtual DbSet<UserGroupJoining> UserGroupJoinings { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<UserIp> UserIps { get; set; }
|
public virtual DbSet<UserIp> UserIps { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<UserKeypair> UserKeypairs { get; set; }
|
public virtual DbSet<UserKeypair> UserKeypairs { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<UserList> UserLists { get; set; }
|
public virtual DbSet<UserList> UserLists { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<UserListJoining> UserListJoinings { get; set; }
|
public virtual DbSet<UserListJoining> UserListJoinings { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<UserNotePining> UserNotePinings { get; set; }
|
public virtual DbSet<UserNotePining> UserNotePinings { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<UserPending> UserPendings { get; set; }
|
public virtual DbSet<UserPending> UserPendings { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<UserProfile> UserProfiles { get; set; }
|
public virtual DbSet<UserProfile> UserProfiles { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<UserPublickey> UserPublickeys { get; set; }
|
public virtual DbSet<UserPublickey> UserPublickeys { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<UserSecurityKey> UserSecurityKeys { get; set; }
|
public virtual DbSet<UserSecurityKey> UserSecurityKeys { get; init; }
|
||||||
|
|
||||||
public virtual DbSet<Webhook> Webhooks { get; set; }
|
public virtual DbSet<Webhook> Webhooks { get; init; }
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
|
||||||
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https: //go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
|
//TODO: load from configuration
|
||||||
=> optionsBuilder.UseNpgsql("Host=localhost;Username=zotan;Database=iceshrimp");
|
var dataSourceBuilder = new NpgsqlDataSourceBuilder("Host=localhost;Username=zotan;Database=iceshrimp");
|
||||||
|
dataSourceBuilder.MapEnum<Antenna.AntennaSource>();
|
||||||
|
dataSourceBuilder.MapEnum<Note.NoteVisibility>();
|
||||||
|
dataSourceBuilder.MapEnum<Notification.NotificationType>();
|
||||||
|
dataSourceBuilder.MapEnum<Page.PageVisibility>();
|
||||||
|
//dataSourceBuilder.MapEnum<Poll.PollNoteVisibility>(); // FIXME: WHY IS THIS ITS OWN ENUM
|
||||||
|
dataSourceBuilder.MapEnum<Relay.RelayStatus>();
|
||||||
|
dataSourceBuilder.MapEnum<UserProfile.UserProfileFFVisibility>();
|
||||||
|
//dataSourceBuilder.MapEnum<UserProfile.MutingNotificationTypes>(); // FIXME: WHY IS THIS ITS OWN ENUM
|
||||||
|
|
||||||
|
optionsBuilder.UseNpgsql(dataSourceBuilder.Build());
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder) {
|
protected override void OnModelCreating(ModelBuilder modelBuilder) {
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasPostgresEnum("antenna_src_enum", new[] { "home", "all", "users", "list", "group", "instances" })
|
.HasPostgresEnum<Antenna.AntennaSource>()
|
||||||
.HasPostgresEnum("log_level_enum", new[] { "error", "warning", "info", "success", "debug" })
|
//.HasPostgresEnum("log_level_enum", ["error", "warning", "info", "success", "debug"]) // TODO: not in use, add migration that removes this if it exists
|
||||||
.HasPostgresEnum("note_visibility_enum", new[] { "public", "home", "followers", "specified", "hidden" })
|
.HasPostgresEnum<Note.NoteVisibility>()
|
||||||
.HasPostgresEnum("notification_type_enum",
|
.HasPostgresEnum<Notification.NotificationType>()
|
||||||
new[] {
|
.HasPostgresEnum<Page.PageVisibility>()
|
||||||
"follow", "mention", "reply", "renote", "quote", "reaction", "pollVote", "pollEnded",
|
.HasPostgresEnum("poll_notevisibility_enum", ["public", "home", "followers", "specified", "hidden"])
|
||||||
"receiveFollowRequest", "followRequestAccepted", "groupInvited", "app"
|
.HasPostgresEnum<Relay.RelayStatus>()
|
||||||
})
|
.HasPostgresEnum<UserProfile.UserProfileFFVisibility>()
|
||||||
.HasPostgresEnum("page_visibility_enum", new[] { "public", "followers", "specified" })
|
|
||||||
.HasPostgresEnum("poll_notevisibility_enum", new[] { "public", "home", "followers", "specified", "hidden" })
|
|
||||||
.HasPostgresEnum("relay_status_enum", new[] { "requesting", "accepted", "rejected" })
|
|
||||||
.HasPostgresEnum("user_profile_ffvisibility_enum", new[] { "public", "followers", "private" })
|
|
||||||
.HasPostgresEnum("user_profile_mutingnotificationtypes_enum",
|
.HasPostgresEnum("user_profile_mutingnotificationtypes_enum",
|
||||||
new[] {
|
[
|
||||||
"follow", "mention", "reply", "renote", "quote", "reaction", "pollVote", "pollEnded",
|
"follow", "mention", "reply", "renote", "quote", "reaction", "pollVote", "pollEnded",
|
||||||
"receiveFollowRequest", "followRequestAccepted", "groupInvited", "app"
|
"receiveFollowRequest", "followRequestAccepted", "groupInvited", "app"
|
||||||
})
|
])
|
||||||
.HasPostgresExtension("pg_trgm");
|
.HasPostgresExtension("pg_trgm");
|
||||||
|
|
||||||
modelBuilder.Entity<AbuseUserReport>(entity => {
|
modelBuilder.Entity<AbuseUserReport>(entity => {
|
||||||
|
@ -1095,7 +1103,7 @@ public partial class DatabaseContext : DbContext {
|
||||||
entity.Property(e => e.UseObjectStorage).HasDefaultValue(false);
|
entity.Property(e => e.UseObjectStorage).HasDefaultValue(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<Migration>(entity => {
|
modelBuilder.Entity<LegacyMigrations>(entity => {
|
||||||
entity.HasKey(e => e.Id).HasName("PK_8c82d7f526340ab734260ea46be");
|
entity.HasKey(e => e.Id).HasName("PK_8c82d7f526340ab734260ea46be");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using NpgsqlTypes;
|
||||||
|
|
||||||
namespace Iceshrimp.Backend.Core.Database.Tables;
|
namespace Iceshrimp.Backend.Core.Database.Tables;
|
||||||
|
|
||||||
|
@ -32,6 +33,8 @@ public class Antenna {
|
||||||
[StringLength(128)]
|
[StringLength(128)]
|
||||||
public string Name { get; set; } = null!;
|
public string Name { get; set; } = null!;
|
||||||
|
|
||||||
|
[Column("src")] public AntennaSource Source { get; set; }
|
||||||
|
|
||||||
[Column("userListId")]
|
[Column("userListId")]
|
||||||
[StringLength(32)]
|
[StringLength(32)]
|
||||||
public string? UserListId { get; set; }
|
public string? UserListId { get; set; }
|
||||||
|
@ -75,4 +78,14 @@ public class Antenna {
|
||||||
[ForeignKey("UserListId")]
|
[ForeignKey("UserListId")]
|
||||||
[InverseProperty("Antennas")]
|
[InverseProperty("Antennas")]
|
||||||
public virtual UserList? UserList { get; set; }
|
public virtual UserList? UserList { get; set; }
|
||||||
|
|
||||||
|
[PgName("antenna_src_enum")]
|
||||||
|
public enum AntennaSource {
|
||||||
|
[PgName("home")] Home,
|
||||||
|
[PgName("all")] All,
|
||||||
|
[PgName("users")] Users,
|
||||||
|
[PgName("list")] List,
|
||||||
|
[PgName("group")] Group,
|
||||||
|
[PgName("instances")] Instances
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||||
namespace Iceshrimp.Backend.Core.Database.Tables;
|
namespace Iceshrimp.Backend.Core.Database.Tables;
|
||||||
|
|
||||||
[Table("migrations")]
|
[Table("migrations")]
|
||||||
public class Migration {
|
public class LegacyMigrations {
|
||||||
[Key] [Column("id")] public int Id { get; set; }
|
[Key] [Column("id")] public int Id { get; set; }
|
||||||
|
|
||||||
[Column("timestamp")] public long Timestamp { get; set; }
|
[Column("timestamp")] public long Timestamp { get; set; }
|
|
@ -1,6 +1,7 @@
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using NpgsqlTypes;
|
||||||
|
|
||||||
namespace Iceshrimp.Backend.Core.Database.Tables;
|
namespace Iceshrimp.Backend.Core.Database.Tables;
|
||||||
|
|
||||||
|
@ -61,6 +62,8 @@ public class Note {
|
||||||
[StringLength(32)]
|
[StringLength(32)]
|
||||||
public string UserId { get; set; } = null!;
|
public string UserId { get; set; } = null!;
|
||||||
|
|
||||||
|
[Column("visibility")] public NoteVisibility Visibility { get; set; }
|
||||||
|
|
||||||
[Column("localOnly")] public bool LocalOnly { get; set; }
|
[Column("localOnly")] public bool LocalOnly { get; set; }
|
||||||
|
|
||||||
[Column("renoteCount")] public short RenoteCount { get; set; }
|
[Column("renoteCount")] public short RenoteCount { get; set; }
|
||||||
|
@ -213,4 +216,13 @@ public class Note {
|
||||||
|
|
||||||
[InverseProperty("Note")]
|
[InverseProperty("Note")]
|
||||||
public virtual ICollection<UserNotePining> UserNotePinings { get; set; } = new List<UserNotePining>();
|
public virtual ICollection<UserNotePining> UserNotePinings { get; set; } = new List<UserNotePining>();
|
||||||
|
|
||||||
|
[PgName("note_visibility_enum")]
|
||||||
|
public enum NoteVisibility {
|
||||||
|
[PgName("public")] Public,
|
||||||
|
[PgName("home")] Home,
|
||||||
|
[PgName("followers")] Followers,
|
||||||
|
[PgName("specified")] Specified,
|
||||||
|
[PgName("hidden")] Hidden
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using NpgsqlTypes;
|
||||||
|
|
||||||
namespace Iceshrimp.Backend.Core.Database.Tables;
|
namespace Iceshrimp.Backend.Core.Database.Tables;
|
||||||
|
|
||||||
|
@ -42,6 +43,8 @@ public class Notification {
|
||||||
[Column("isRead")]
|
[Column("isRead")]
|
||||||
public bool IsRead { get; set; }
|
public bool IsRead { get; set; }
|
||||||
|
|
||||||
|
[Column("type")] public NotificationType Type { get; set; }
|
||||||
|
|
||||||
[Column("noteId")] [StringLength(32)] public string? NoteId { get; set; }
|
[Column("noteId")] [StringLength(32)] public string? NoteId { get; set; }
|
||||||
|
|
||||||
[Column("reaction")]
|
[Column("reaction")]
|
||||||
|
@ -97,4 +100,20 @@ public class Notification {
|
||||||
[ForeignKey("UserGroupInvitationId")]
|
[ForeignKey("UserGroupInvitationId")]
|
||||||
[InverseProperty("Notifications")]
|
[InverseProperty("Notifications")]
|
||||||
public virtual UserGroupInvitation? UserGroupInvitation { get; set; }
|
public virtual UserGroupInvitation? UserGroupInvitation { get; set; }
|
||||||
|
|
||||||
|
[PgName("notification_type_enum")]
|
||||||
|
public enum NotificationType {
|
||||||
|
[PgName("follow")] Follow,
|
||||||
|
[PgName("mention")] Mention,
|
||||||
|
[PgName("reply")] Reply,
|
||||||
|
[PgName("renote")] Renote,
|
||||||
|
[PgName("quote")] Quote,
|
||||||
|
[PgName("reaction")] Reaction,
|
||||||
|
[PgName("pollVote")] PollVote,
|
||||||
|
[PgName("pollEnded")] PollEnded,
|
||||||
|
[PgName("receiveFollowRequest")] FollowRequestReceived,
|
||||||
|
[PgName("followRequestAccepted")] FollowRequestAccepted,
|
||||||
|
[PgName("groupInvited")] GroupInvited,
|
||||||
|
[PgName("app")] App,
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using NpgsqlTypes;
|
||||||
|
|
||||||
namespace Iceshrimp.Backend.Core.Database.Tables;
|
namespace Iceshrimp.Backend.Core.Database.Tables;
|
||||||
|
|
||||||
|
@ -33,6 +34,8 @@ public class Page {
|
||||||
|
|
||||||
[Column("name")] [StringLength(256)] public string Name { get; set; } = null!;
|
[Column("name")] [StringLength(256)] public string Name { get; set; } = null!;
|
||||||
|
|
||||||
|
[Column("visibility")] public PageVisibility Visibility { get; set; }
|
||||||
|
|
||||||
[Column("summary")]
|
[Column("summary")]
|
||||||
[StringLength(256)]
|
[StringLength(256)]
|
||||||
public string? Summary { get; set; }
|
public string? Summary { get; set; }
|
||||||
|
@ -82,4 +85,11 @@ public class Page {
|
||||||
public virtual User User { get; set; } = null!;
|
public virtual User User { get; set; } = null!;
|
||||||
|
|
||||||
[InverseProperty("PinnedPage")] public virtual UserProfile? UserProfile { get; set; }
|
[InverseProperty("PinnedPage")] public virtual UserProfile? UserProfile { get; set; }
|
||||||
|
|
||||||
|
[PgName("page_visibility_enum")]
|
||||||
|
public enum PageVisibility {
|
||||||
|
[PgName("public")] Public,
|
||||||
|
[PgName("followers")] Followers,
|
||||||
|
[PgName("specified")] Specified,
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -39,4 +39,10 @@ public class Poll {
|
||||||
[ForeignKey("NoteId")]
|
[ForeignKey("NoteId")]
|
||||||
[InverseProperty("Poll")]
|
[InverseProperty("Poll")]
|
||||||
public virtual Note Note { get; set; } = null!;
|
public virtual Note Note { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// [Denormalized]
|
||||||
|
/// </summary>
|
||||||
|
[Column("noteVisibility")]
|
||||||
|
public Note.NoteVisibility NoteVisibility { get; set; }
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using NpgsqlTypes;
|
||||||
|
|
||||||
namespace Iceshrimp.Backend.Core.Database.Tables;
|
namespace Iceshrimp.Backend.Core.Database.Tables;
|
||||||
|
|
||||||
|
@ -13,4 +14,13 @@ public class Relay {
|
||||||
public string Id { get; set; } = null!;
|
public string Id { get; set; } = null!;
|
||||||
|
|
||||||
[Column("inbox")] [StringLength(512)] public string Inbox { get; set; } = null!;
|
[Column("inbox")] [StringLength(512)] public string Inbox { get; set; } = null!;
|
||||||
|
|
||||||
|
[Column("status")] public RelayStatus Status { get; set; }
|
||||||
|
|
||||||
|
[PgName("relay_status_enum")]
|
||||||
|
public enum RelayStatus {
|
||||||
|
[PgName("requesting")] Requesting,
|
||||||
|
[PgName("accepted")] Accepted,
|
||||||
|
[PgName("rejected")] Rejected,
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using NpgsqlTypes;
|
||||||
|
|
||||||
namespace Iceshrimp.Backend.Core.Database.Tables;
|
namespace Iceshrimp.Backend.Core.Database.Tables;
|
||||||
|
|
||||||
|
@ -44,6 +45,12 @@ public class UserProfile {
|
||||||
[StringLength(512)]
|
[StringLength(512)]
|
||||||
public string? Url { get; set; }
|
public string? Url { get; set; }
|
||||||
|
|
||||||
|
[Column("ffVisibility")]
|
||||||
|
public UserProfileFFVisibility FFVisibility { get; set; }
|
||||||
|
|
||||||
|
[Column("mutingNotificationTypes")]
|
||||||
|
public List<Notification.NotificationType> MutingNotificationTypes { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The email address of the User.
|
/// The email address of the User.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -154,4 +161,11 @@ public class UserProfile {
|
||||||
[ForeignKey("UserId")]
|
[ForeignKey("UserId")]
|
||||||
[InverseProperty("UserProfile")]
|
[InverseProperty("UserProfile")]
|
||||||
public virtual User User { get; set; } = null!;
|
public virtual User User { get; set; } = null!;
|
||||||
|
|
||||||
|
[PgName("user_profile_ffvisibility_enum")]
|
||||||
|
public enum UserProfileFFVisibility {
|
||||||
|
[PgName("public")] Public,
|
||||||
|
[PgName("followers")] Followers,
|
||||||
|
[PgName("private")] Private,
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -29,6 +29,7 @@
|
||||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/TYPE_DECLARATION_BRACES/@EntryValue">END_OF_LINE</s:String>
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/TYPE_DECLARATION_BRACES/@EntryValue">END_OF_LINE</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AP/@EntryIndexedValue">AP</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AP/@EntryIndexedValue">AP</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AS/@EntryIndexedValue">AS</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AS/@EntryIndexedValue">AS</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FF/@EntryIndexedValue">FF</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LD/@EntryIndexedValue">LD</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LD/@EntryIndexedValue">LD</s:String>
|
||||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
|
Loading…
Add table
Reference in a new issue