From 523515f71df75fe44e0ddcb514949ac517afe2cc Mon Sep 17 00:00:00 2001 From: Masterjun3 Date: Thu, 28 Jul 2022 16:51:43 +0200 Subject: [PATCH 1/6] add autohistory nuget package and configure it properly --- NuGet.Config | 1 + TASVideos.Data/ApplicationDbContext.cs | 42 +++++++++++++++++- TASVideos.Data/TASVideos.Data.csproj | 1 + ...ntityFrameworkCore.AutoHistory.6.0.0.nupkg | Bin 0 -> 11217 bytes 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 custompackages/Microsoft.EntityFrameworkCore.AutoHistory.6.0.0.nupkg diff --git a/NuGet.Config b/NuGet.Config index 3a8d572c2..bb227654c 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -3,5 +3,6 @@ + \ No newline at end of file diff --git a/TASVideos.Data/ApplicationDbContext.cs b/TASVideos.Data/ApplicationDbContext.cs index 81c2301f5..ea0b2cfac 100644 --- a/TASVideos.Data/ApplicationDbContext.cs +++ b/TASVideos.Data/ApplicationDbContext.cs @@ -27,6 +27,8 @@ public ApplicationDbContext(DbContextOptions options, IHtt _httpContext = httpContextAccessor; } + public DbSet AutoHistory { get; set; } = null!; + public DbSet RolePermission { get; set; } = null!; public DbSet WikiPages { get; set; } = null!; public DbSet WikiReferrals { get; set; } = null!; @@ -94,16 +96,50 @@ public override int SaveChanges(bool acceptAllChangesOnSuccess) PerformTrackingUpdates(); ChangeTracker.AutoDetectChangesEnabled = false; + + // remember added entries, + // before EF Core is assigning valid Ids (it does on save changes, + // when ids equal zero) and setting their state to + // Unchanged (it does on every save changes) + var addedEntities = ChangeTracker + .Entries() + .Where(e => e.State == EntityState.Added) + .ToArray(); + + this.EnsureAutoHistory(); var result = base.SaveChanges(acceptAllChangesOnSuccess); + + // after "SaveChanges" added enties now have gotten valid ids (if it was necessary) + // and the history for them can be ensured and be saved with another "SaveChanges" + this.EnsureAddedHistory(addedEntities); + result += base.SaveChanges(acceptAllChangesOnSuccess); + ChangeTracker.AutoDetectChangesEnabled = true; return result; } - public override Task SaveChangesAsync(CancellationToken cancellationToken = default) + public override async Task SaveChangesAsync(CancellationToken cancellationToken = default) { PerformTrackingUpdates(); - return base.SaveChangesAsync(cancellationToken); + + // remember added entries, + // before EF Core is assigning valid Ids (it does on save changes, + // when ids equal zero) and setting their state to + // Unchanged (it does on every save changes) + var addedEntities = ChangeTracker + .Entries() + .Where(e => e.State == EntityState.Added) + .ToArray(); + + this.EnsureAutoHistory(); + var result = await base.SaveChangesAsync(cancellationToken); + + // after "SaveChanges" added enties now have gotten valid ids (if it was necessary) + // and the history for them can be ensured and be saved with another "SaveChanges" + this.EnsureAddedHistory(addedEntities); + result += await base.SaveChangesAsync(CancellationToken.None); + return result; } /// @@ -421,6 +457,8 @@ protected override void OnModelCreating(ModelBuilder builder) { entity.HasIndex(e => e.FileExtension).IsUnique(); }); + + builder.EnableAutoHistory(); } private void PerformTrackingUpdates() diff --git a/TASVideos.Data/TASVideos.Data.csproj b/TASVideos.Data/TASVideos.Data.csproj index 53a04b6bc..b1f857697 100644 --- a/TASVideos.Data/TASVideos.Data.csproj +++ b/TASVideos.Data/TASVideos.Data.csproj @@ -16,6 +16,7 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/custompackages/Microsoft.EntityFrameworkCore.AutoHistory.6.0.0.nupkg b/custompackages/Microsoft.EntityFrameworkCore.AutoHistory.6.0.0.nupkg new file mode 100644 index 0000000000000000000000000000000000000000..460af493372705f31c5e5059ce0e721ae2ddba2d GIT binary patch literal 11217 zcmcJVbxdYYv*&SlcZNY8+#Lpca2(IrIfcb%ygNP8$~U>SUy+UjSWAL% zL|G}t?MMn48Zn;;5>su9ly#pRZPSCetRF3{$t+@Y1>ujHze$|@L9&a=2_>+7NvP?d zvi@b=T+z_e7xv1r-&=tRpMyNfHUP{?ulH}!_3Ny-6631_^zXQa7=biKnj|%H>Y@N+ zmP#c+grr-3{Q0h^s6vde61(jUlqy59)NYwBDDWTsp+PO|X6S@Tn z2FCoEP&spugRP^ji4&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9Qv!fn{d0$|6WmPQXWcb20 z7WI55(l0tBo{uklw$hP^D(%~^bg*Qk_DS74`a*J2fj2mtb@mxXBP^lv{RRW)sk8@T zm|hANQh=DcyZ_K~m(C!rp6NHmi2g_i*P-{&@|TvyHElM2v0VW2k3F9yv>ETbzoKNg zWo6V17&{88x%0>hC=d>nJvCc;KZD^1K5#T!1>9W!9oG4z=KfA2liz+qUQVBom*Qs* z>Zly<{)E7CTn9S10w?`118WX<;7s>%rYf z!(YbDPE@n8ZcJ72n8~CNqSpx1t2eJ)b)$>7k%=WF5^dw`k!Vp}OTIR~i%!iFsprUAw=LRN)8dN^+j z`My2bcU<3Pz#*`}{_kYwXPN!m^KYEyKR5o9K>XJ(#m|!c@55yOhe!NR-v0|u?O)!* zKM%wIlv?{|lz(1v{uQN(?0*>LQ Date: Thu, 28 Jul 2022 19:40:02 +0200 Subject: [PATCH 2/6] add user id to autohistory --- TASVideos.Core/Services/SignInManager.cs | 1 - TASVideos.Data/ApplicationDbContext.cs | 28 +++++++++++++++---- TASVideos.Data/CustomAutoHistory.cs | 8 ++++++ .../Extensions/ClaimsExtensions.cs | 2 +- .../Extensions/ClaimsPrincipalExtensions.cs | 1 - 5 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 TASVideos.Data/CustomAutoHistory.cs rename {TASVideos.Core => TASVideos.Data}/Extensions/ClaimsExtensions.cs (92%) rename {TASVideos.Core => TASVideos.Data}/Extensions/ClaimsPrincipalExtensions.cs (97%) diff --git a/TASVideos.Core/Services/SignInManager.cs b/TASVideos.Core/Services/SignInManager.cs index ad468e001..a22527d74 100644 --- a/TASVideos.Core/Services/SignInManager.cs +++ b/TASVideos.Core/Services/SignInManager.cs @@ -6,7 +6,6 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using TASVideos.Core.Extensions; using TASVideos.Data; using TASVideos.Data.Entity; diff --git a/TASVideos.Data/ApplicationDbContext.cs b/TASVideos.Data/ApplicationDbContext.cs index ea0b2cfac..ee3650a8a 100644 --- a/TASVideos.Data/ApplicationDbContext.cs +++ b/TASVideos.Data/ApplicationDbContext.cs @@ -106,12 +106,19 @@ public override int SaveChanges(bool acceptAllChangesOnSuccess) .Where(e => e.State == EntityState.Added) .ToArray(); - this.EnsureAutoHistory(); + this.EnsureAutoHistory(() => new CustomAutoHistory() + { + UserId = _httpContext?.HttpContext?.User.GetUserId() ?? -1 + }); var result = base.SaveChanges(acceptAllChangesOnSuccess); // after "SaveChanges" added enties now have gotten valid ids (if it was necessary) // and the history for them can be ensured and be saved with another "SaveChanges" - this.EnsureAddedHistory(addedEntities); + this.EnsureAddedHistory( + () => new CustomAutoHistory() + { + UserId = _httpContext?.HttpContext?.User.GetUserId() ?? -1 + }, addedEntities); result += base.SaveChanges(acceptAllChangesOnSuccess); ChangeTracker.AutoDetectChangesEnabled = true; @@ -132,13 +139,21 @@ public override async Task SaveChangesAsync(CancellationToken cancellationT .Where(e => e.State == EntityState.Added) .ToArray(); - this.EnsureAutoHistory(); + this.EnsureAutoHistory(() => new CustomAutoHistory() + { + UserId = _httpContext?.HttpContext?.User.GetUserId() ?? -1 + }); var result = await base.SaveChangesAsync(cancellationToken); // after "SaveChanges" added enties now have gotten valid ids (if it was necessary) // and the history for them can be ensured and be saved with another "SaveChanges" - this.EnsureAddedHistory(addedEntities); + this.EnsureAddedHistory( + () => new CustomAutoHistory() + { + UserId = _httpContext?.HttpContext?.User.GetUserId() ?? -1 + }, addedEntities); result += await base.SaveChangesAsync(CancellationToken.None); + return result; } @@ -458,7 +473,10 @@ protected override void OnModelCreating(ModelBuilder builder) entity.HasIndex(e => e.FileExtension).IsUnique(); }); - builder.EnableAutoHistory(); + builder.EnableAutoHistory(o => + { + o.LimitChangedLength = false; + }); } private void PerformTrackingUpdates() diff --git a/TASVideos.Data/CustomAutoHistory.cs b/TASVideos.Data/CustomAutoHistory.cs new file mode 100644 index 000000000..1ad3e3aa2 --- /dev/null +++ b/TASVideos.Data/CustomAutoHistory.cs @@ -0,0 +1,8 @@ +using Microsoft.EntityFrameworkCore; + +namespace TASVideos.Data; + +internal class CustomAutoHistory : AutoHistory +{ + public int UserId { get; set; } +} diff --git a/TASVideos.Core/Extensions/ClaimsExtensions.cs b/TASVideos.Data/Extensions/ClaimsExtensions.cs similarity index 92% rename from TASVideos.Core/Extensions/ClaimsExtensions.cs rename to TASVideos.Data/Extensions/ClaimsExtensions.cs index e3c5f715f..dcd96b7f0 100644 --- a/TASVideos.Core/Extensions/ClaimsExtensions.cs +++ b/TASVideos.Data/Extensions/ClaimsExtensions.cs @@ -1,7 +1,7 @@ using System.Security.Claims; using TASVideos.Data.Entity; -namespace TASVideos.Core.Extensions; +namespace TASVideos; public static class ClaimsExtensions { diff --git a/TASVideos.Core/Extensions/ClaimsPrincipalExtensions.cs b/TASVideos.Data/Extensions/ClaimsPrincipalExtensions.cs similarity index 97% rename from TASVideos.Core/Extensions/ClaimsPrincipalExtensions.cs rename to TASVideos.Data/Extensions/ClaimsPrincipalExtensions.cs index 8fac700a3..3133f210d 100644 --- a/TASVideos.Core/Extensions/ClaimsPrincipalExtensions.cs +++ b/TASVideos.Data/Extensions/ClaimsPrincipalExtensions.cs @@ -1,5 +1,4 @@ using System.Security.Claims; -using TASVideos.Core.Extensions; using TASVideos.Data.Entity; namespace TASVideos; From c24d82faace30bd4c2b81a0a98f6b18d3d008a28 Mon Sep 17 00:00:00 2001 From: Masterjun3 Date: Thu, 28 Jul 2022 20:57:57 +0200 Subject: [PATCH 3/6] use the proper autohistory package --- ...ntityFrameworkCore.AutoHistory.6.0.0.nupkg | Bin 11217 -> 11040 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/custompackages/Microsoft.EntityFrameworkCore.AutoHistory.6.0.0.nupkg b/custompackages/Microsoft.EntityFrameworkCore.AutoHistory.6.0.0.nupkg index 460af493372705f31c5e5059ce0e721ae2ddba2d..c75d2ce7ba2344f350a168fd87d6fcbc09ff205c 100644 GIT binary patch delta 8180 zc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1I;%5`$)CHx7|WwrWBDrAi%c0}smaLG^%06I);NzLo1fV{&&mF=&cYbp!iv*{ zdhlo$-mjMVB^yIw-jn{1?{dCa z`{H4Z18edrfdb!jC=}2%RipFRIMOaPo=67z1p*-Vq45STw)=NxfXgc zkTWiM@xY&#MBgL<Qs0;I+ye$B7$ds{^~ZxgF+#Z@X^tRDFU{-s9Oi z$)LC5mFGSAQ}&GLXOB$Zl5|iiP97CJ41y|iB|If?p8j0iJVy#X+!|UIo3Y`vqn2Jp zavk40Ft*}|v+-BWo%?Fx_C4>Y2hq+URdG*|$nId=L8cS(kWXoJ)rmX9PtEf5Ch>+X z@kacAQRCFdCL9`HB*cG2zA2so9{xXxQQ2Kgz^OkDq6%gIcRr2Y@{|q Date: Wed, 3 Aug 2022 20:40:18 +0200 Subject: [PATCH 4/6] exclude all entities from autohistory for now --- TASVideos.Data/Entity/Awards/Award.cs | 5 ++++- TASVideos.Data/Entity/Awards/PublicationAward.cs | 5 ++++- TASVideos.Data/Entity/Awards/UserAward.cs | 5 ++++- TASVideos.Data/Entity/BaseEntity.cs | 8 +++++++- TASVideos.Data/Entity/DeprecatedMovieFormat.cs | 5 ++++- TASVideos.Data/Entity/Flag.cs | 5 ++++- TASVideos.Data/Entity/Forum/Forum.cs | 5 ++++- TASVideos.Data/Entity/Forum/ForumCategory.cs | 5 ++++- TASVideos.Data/Entity/Forum/ForumPoll.cs | 5 ++++- TASVideos.Data/Entity/Forum/ForumPollOption.cs | 5 ++++- TASVideos.Data/Entity/Forum/ForumPollOptionVote.cs | 5 ++++- TASVideos.Data/Entity/Forum/ForumPost.cs | 2 ++ TASVideos.Data/Entity/Forum/ForumTopic.cs | 5 ++++- TASVideos.Data/Entity/Forum/ForumTopicWatch.cs | 5 ++++- TASVideos.Data/Entity/Game/Game.cs | 5 ++++- TASVideos.Data/Entity/Game/GameGameGroup.cs | 5 ++++- TASVideos.Data/Entity/Game/GameGenre.cs | 5 ++++- TASVideos.Data/Entity/Game/GameGroup.cs | 5 ++++- TASVideos.Data/Entity/Game/GameSystem.cs | 5 ++++- TASVideos.Data/Entity/Game/GameSystemFrameRate.cs | 5 ++++- TASVideos.Data/Entity/Game/GameVersion.cs | 5 ++++- TASVideos.Data/Entity/Game/Genre.cs | 5 ++++- TASVideos.Data/Entity/IpBan.cs | 5 ++++- TASVideos.Data/Entity/MediaPosts.cs | 5 ++++- TASVideos.Data/Entity/PrivateMessage.cs | 5 ++++- TASVideos.Data/Entity/Publication.cs | 4 +++- TASVideos.Data/Entity/PublicationAuthor.cs | 5 ++++- TASVideos.Data/Entity/PublicationClass.cs | 5 ++++- TASVideos.Data/Entity/PublicationFile.cs | 5 ++++- TASVideos.Data/Entity/PublicationFlag.cs | 5 ++++- TASVideos.Data/Entity/PublicationMaintenanceLog.cs | 5 ++++- TASVideos.Data/Entity/PublicationRating.cs | 5 ++++- TASVideos.Data/Entity/PublicationTag.cs | 5 ++++- TASVideos.Data/Entity/PublicationUrl.cs | 5 ++++- TASVideos.Data/Entity/Role.cs | 2 ++ TASVideos.Data/Entity/RoleClaim.cs | 2 ++ TASVideos.Data/Entity/RoleLinks.cs | 5 ++++- TASVideos.Data/Entity/RolePermission.cs | 5 ++++- TASVideos.Data/Entity/Submission.cs | 4 +++- TASVideos.Data/Entity/SubmissionAuthor.cs | 5 ++++- TASVideos.Data/Entity/SubmissionRejectionReason.cs | 5 ++++- TASVideos.Data/Entity/SubmissionStatusHistory.cs | 1 + TASVideos.Data/Entity/Tag.cs | 5 ++++- TASVideos.Data/Entity/User.cs | 1 + TASVideos.Data/Entity/UserClaim.cs | 2 ++ TASVideos.Data/Entity/UserDisallow.cs | 5 ++++- TASVideos.Data/Entity/UserFile.cs | 5 ++++- TASVideos.Data/Entity/UserFileComment.cs | 5 ++++- TASVideos.Data/Entity/UserLogin.cs | 2 ++ TASVideos.Data/Entity/UserMaintenanceLog.cs | 5 ++++- TASVideos.Data/Entity/UserRole.cs | 2 ++ TASVideos.Data/Entity/UserToken.cs | 2 ++ TASVideos.Data/Entity/WikiPage.cs | 2 ++ TASVideos.Data/Entity/WikiPageReferral.cs | 5 ++++- 54 files changed, 195 insertions(+), 44 deletions(-) diff --git a/TASVideos.Data/Entity/Awards/Award.cs b/TASVideos.Data/Entity/Awards/Award.cs index eabd8e4f3..097bf728b 100644 --- a/TASVideos.Data/Entity/Awards/Award.cs +++ b/TASVideos.Data/Entity/Awards/Award.cs @@ -1,4 +1,6 @@ -namespace TASVideos.Data.Entity.Awards; +using Microsoft.EntityFrameworkCore; + +namespace TASVideos.Data.Entity.Awards; public enum AwardType { @@ -6,6 +8,7 @@ public enum AwardType Movie } +[ExcludeFromHistory] public class Award { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/Awards/PublicationAward.cs b/TASVideos.Data/Entity/Awards/PublicationAward.cs index 091c431be..0b9c2db4c 100644 --- a/TASVideos.Data/Entity/Awards/PublicationAward.cs +++ b/TASVideos.Data/Entity/Awards/PublicationAward.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity.Awards; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity.Awards; + +[ExcludeFromHistory] public class PublicationAward { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/Awards/UserAward.cs b/TASVideos.Data/Entity/Awards/UserAward.cs index 900a68af8..376c0b398 100644 --- a/TASVideos.Data/Entity/Awards/UserAward.cs +++ b/TASVideos.Data/Entity/Awards/UserAward.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity.Awards; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity.Awards; + +[ExcludeFromHistory] public class UserAward { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/BaseEntity.cs b/TASVideos.Data/Entity/BaseEntity.cs index c55191739..49b5155e4 100644 --- a/TASVideos.Data/Entity/BaseEntity.cs +++ b/TASVideos.Data/Entity/BaseEntity.cs @@ -1,4 +1,6 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; + +namespace TASVideos.Data.Entity; public interface ITrackable { @@ -11,10 +13,14 @@ public interface ITrackable public class BaseEntity : ITrackable { + [ExcludeFromHistory] public DateTime CreateTimestamp { get; set; } + [ExcludeFromHistory] public string? CreateUserName { get; set; } + [ExcludeFromHistory] public DateTime LastUpdateTimestamp { get; set; } + [ExcludeFromHistory] public string? LastUpdateUserName { get; set; } } diff --git a/TASVideos.Data/Entity/DeprecatedMovieFormat.cs b/TASVideos.Data/Entity/DeprecatedMovieFormat.cs index 6aabfd0db..04daf5089 100644 --- a/TASVideos.Data/Entity/DeprecatedMovieFormat.cs +++ b/TASVideos.Data/Entity/DeprecatedMovieFormat.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity; + +[ExcludeFromHistory] public class DeprecatedMovieFormat : BaseEntity { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/Flag.cs b/TASVideos.Data/Entity/Flag.cs index 2ec2ee484..1ea0a658a 100644 --- a/TASVideos.Data/Entity/Flag.cs +++ b/TASVideos.Data/Entity/Flag.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity; + +[ExcludeFromHistory] public class Flag : BaseEntity { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/Forum/Forum.cs b/TASVideos.Data/Entity/Forum/Forum.cs index c9c763109..fb8b28f30 100644 --- a/TASVideos.Data/Entity/Forum/Forum.cs +++ b/TASVideos.Data/Entity/Forum/Forum.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity.Forum; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity.Forum; + +[ExcludeFromHistory] public class Forum : BaseEntity { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/Forum/ForumCategory.cs b/TASVideos.Data/Entity/Forum/ForumCategory.cs index d40751279..8450b9209 100644 --- a/TASVideos.Data/Entity/Forum/ForumCategory.cs +++ b/TASVideos.Data/Entity/Forum/ForumCategory.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity.Forum; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity.Forum; + +[ExcludeFromHistory] public class ForumCategory : BaseEntity { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/Forum/ForumPoll.cs b/TASVideos.Data/Entity/Forum/ForumPoll.cs index fb44ef5fd..5424a5666 100644 --- a/TASVideos.Data/Entity/Forum/ForumPoll.cs +++ b/TASVideos.Data/Entity/Forum/ForumPoll.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity.Forum; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity.Forum; + +[ExcludeFromHistory] public class ForumPoll : BaseEntity { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/Forum/ForumPollOption.cs b/TASVideos.Data/Entity/Forum/ForumPollOption.cs index 008b4ce11..650c950a7 100644 --- a/TASVideos.Data/Entity/Forum/ForumPollOption.cs +++ b/TASVideos.Data/Entity/Forum/ForumPollOption.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity.Forum; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity.Forum; + +[ExcludeFromHistory] public class ForumPollOption : BaseEntity { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/Forum/ForumPollOptionVote.cs b/TASVideos.Data/Entity/Forum/ForumPollOptionVote.cs index b087b1151..02d59b0af 100644 --- a/TASVideos.Data/Entity/Forum/ForumPollOptionVote.cs +++ b/TASVideos.Data/Entity/Forum/ForumPollOptionVote.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity.Forum; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity.Forum; + +[ExcludeFromHistory] public class ForumPollOptionVote { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/Forum/ForumPost.cs b/TASVideos.Data/Entity/Forum/ForumPost.cs index 953437292..242cc3bc1 100644 --- a/TASVideos.Data/Entity/Forum/ForumPost.cs +++ b/TASVideos.Data/Entity/Forum/ForumPost.cs @@ -1,8 +1,10 @@ using System.Text.Json.Serialization; +using Microsoft.EntityFrameworkCore; using NpgsqlTypes; namespace TASVideos.Data.Entity.Forum; +[ExcludeFromHistory] public class ForumPost : BaseEntity { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/Forum/ForumTopic.cs b/TASVideos.Data/Entity/Forum/ForumTopic.cs index 3fc7fdccd..3f18dec90 100644 --- a/TASVideos.Data/Entity/Forum/ForumTopic.cs +++ b/TASVideos.Data/Entity/Forum/ForumTopic.cs @@ -1,4 +1,6 @@ -namespace TASVideos.Data.Entity.Forum; +using Microsoft.EntityFrameworkCore; + +namespace TASVideos.Data.Entity.Forum; public enum ForumTopicType { @@ -7,6 +9,7 @@ public enum ForumTopicType Announcement = 2 } +[ExcludeFromHistory] public class ForumTopic : BaseEntity { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/Forum/ForumTopicWatch.cs b/TASVideos.Data/Entity/Forum/ForumTopicWatch.cs index f90cfa761..b216bbe65 100644 --- a/TASVideos.Data/Entity/Forum/ForumTopicWatch.cs +++ b/TASVideos.Data/Entity/Forum/ForumTopicWatch.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity.Forum; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity.Forum; + +[ExcludeFromHistory] public class ForumTopicWatch { public int UserId { get; set; } diff --git a/TASVideos.Data/Entity/Game/Game.cs b/TASVideos.Data/Entity/Game/Game.cs index b379e32fd..8a9c25af2 100644 --- a/TASVideos.Data/Entity/Game/Game.cs +++ b/TASVideos.Data/Entity/Game/Game.cs @@ -1,9 +1,12 @@ -namespace TASVideos.Data.Entity.Game; +using Microsoft.EntityFrameworkCore; + +namespace TASVideos.Data.Entity.Game; /// /// Represents a Game /// This is the central reference point for all site content /// +[ExcludeFromHistory] public class Game : BaseEntity { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/Game/GameGameGroup.cs b/TASVideos.Data/Entity/Game/GameGameGroup.cs index c29d0985c..4594c8b45 100644 --- a/TASVideos.Data/Entity/Game/GameGameGroup.cs +++ b/TASVideos.Data/Entity/Game/GameGameGroup.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity.Game; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity.Game; + +[ExcludeFromHistory] public class GameGameGroup { public int GameId { get; set; } diff --git a/TASVideos.Data/Entity/Game/GameGenre.cs b/TASVideos.Data/Entity/Game/GameGenre.cs index 0544b3d87..bbecb01bf 100644 --- a/TASVideos.Data/Entity/Game/GameGenre.cs +++ b/TASVideos.Data/Entity/Game/GameGenre.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity.Game; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity.Game; + +[ExcludeFromHistory] public class GameGenre { public int GameId { get; set; } diff --git a/TASVideos.Data/Entity/Game/GameGroup.cs b/TASVideos.Data/Entity/Game/GameGroup.cs index 93e84e7c4..1b33d88ea 100644 --- a/TASVideos.Data/Entity/Game/GameGroup.cs +++ b/TASVideos.Data/Entity/Game/GameGroup.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity.Game; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity.Game; + +[ExcludeFromHistory] public class GameGroup { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/Game/GameSystem.cs b/TASVideos.Data/Entity/Game/GameSystem.cs index 08937404a..5e0519419 100644 --- a/TASVideos.Data/Entity/Game/GameSystem.cs +++ b/TASVideos.Data/Entity/Game/GameSystem.cs @@ -1,8 +1,11 @@ -namespace TASVideos.Data.Entity.Game; +using Microsoft.EntityFrameworkCore; + +namespace TASVideos.Data.Entity.Game; /// /// Represents the system that a game runs on, such as NES, SNES, Commodore 64, PSX, etc /// +[ExcludeFromHistory] public class GameSystem : BaseEntity { public int Id { get; set; } // Note that this is Non-auto-incrementing, we need Ids to be identical across any database diff --git a/TASVideos.Data/Entity/Game/GameSystemFrameRate.cs b/TASVideos.Data/Entity/Game/GameSystemFrameRate.cs index 9b38f4e78..d7777c496 100644 --- a/TASVideos.Data/Entity/Game/GameSystemFrameRate.cs +++ b/TASVideos.Data/Entity/Game/GameSystemFrameRate.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity.Game; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity.Game; + +[ExcludeFromHistory] public class GameSystemFrameRate : BaseEntity { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/Game/GameVersion.cs b/TASVideos.Data/Entity/Game/GameVersion.cs index 62f1af7a7..29bd828dc 100644 --- a/TASVideos.Data/Entity/Game/GameVersion.cs +++ b/TASVideos.Data/Entity/Game/GameVersion.cs @@ -1,4 +1,6 @@ -namespace TASVideos.Data.Entity.Game; +using Microsoft.EntityFrameworkCore; + +namespace TASVideos.Data.Entity.Game; public enum VersionTypes { @@ -8,6 +10,7 @@ public enum VersionTypes Bad } +[ExcludeFromHistory] public class GameVersion : BaseEntity { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/Game/Genre.cs b/TASVideos.Data/Entity/Game/Genre.cs index 0ea8b1d44..ec8649e50 100644 --- a/TASVideos.Data/Entity/Game/Genre.cs +++ b/TASVideos.Data/Entity/Game/Genre.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity.Game; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity.Game; + +[ExcludeFromHistory] public class Genre { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/IpBan.cs b/TASVideos.Data/Entity/IpBan.cs index 91a4d9394..15e47dd48 100644 --- a/TASVideos.Data/Entity/IpBan.cs +++ b/TASVideos.Data/Entity/IpBan.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity; + +[ExcludeFromHistory] public class IpBan : BaseEntity { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/MediaPosts.cs b/TASVideos.Data/Entity/MediaPosts.cs index 54c1f31c9..664ee16ce 100644 --- a/TASVideos.Data/Entity/MediaPosts.cs +++ b/TASVideos.Data/Entity/MediaPosts.cs @@ -1,8 +1,11 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; + +namespace TASVideos.Data.Entity; /// /// Data storage for an external media post (such as Irc, Discord). /// +[ExcludeFromHistory] public class MediaPost : BaseEntity { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/PrivateMessage.cs b/TASVideos.Data/Entity/PrivateMessage.cs index 4bec527ba..758fc56bb 100644 --- a/TASVideos.Data/Entity/PrivateMessage.cs +++ b/TASVideos.Data/Entity/PrivateMessage.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity; + +[ExcludeFromHistory] public class PrivateMessage : BaseEntity { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/Publication.cs b/TASVideos.Data/Entity/Publication.cs index c733d52d9..992ff8cd4 100644 --- a/TASVideos.Data/Entity/Publication.cs +++ b/TASVideos.Data/Entity/Publication.cs @@ -1,4 +1,5 @@ -using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; using TASVideos.Common; using TASVideos.Data.Entity.Awards; using TASVideos.Data.Entity.Game; @@ -26,6 +27,7 @@ public interface IPublicationTokens int? Limit { get; } } +[ExcludeFromHistory] public class Publication : BaseEntity, ITimeable { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/PublicationAuthor.cs b/TASVideos.Data/Entity/PublicationAuthor.cs index 5594e70b9..21ea353b9 100644 --- a/TASVideos.Data/Entity/PublicationAuthor.cs +++ b/TASVideos.Data/Entity/PublicationAuthor.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity; + +[ExcludeFromHistory] public class PublicationAuthor { public int UserId { get; set; } diff --git a/TASVideos.Data/Entity/PublicationClass.cs b/TASVideos.Data/Entity/PublicationClass.cs index ecf2d370f..f739ef8fe 100644 --- a/TASVideos.Data/Entity/PublicationClass.cs +++ b/TASVideos.Data/Entity/PublicationClass.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity; + +[ExcludeFromHistory] public class PublicationClass { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/PublicationFile.cs b/TASVideos.Data/Entity/PublicationFile.cs index b5a957d81..de1788e0b 100644 --- a/TASVideos.Data/Entity/PublicationFile.cs +++ b/TASVideos.Data/Entity/PublicationFile.cs @@ -1,10 +1,13 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; + +namespace TASVideos.Data.Entity; public enum FileType { Screenshot, MovieFile } +[ExcludeFromHistory] public class PublicationFile : BaseEntity { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/PublicationFlag.cs b/TASVideos.Data/Entity/PublicationFlag.cs index ec72a295d..33a818c9b 100644 --- a/TASVideos.Data/Entity/PublicationFlag.cs +++ b/TASVideos.Data/Entity/PublicationFlag.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity; + +[ExcludeFromHistory] public class PublicationFlag { public int PublicationId { get; set; } diff --git a/TASVideos.Data/Entity/PublicationMaintenanceLog.cs b/TASVideos.Data/Entity/PublicationMaintenanceLog.cs index 62f26386c..0eaec1d6c 100644 --- a/TASVideos.Data/Entity/PublicationMaintenanceLog.cs +++ b/TASVideos.Data/Entity/PublicationMaintenanceLog.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity; + +[ExcludeFromHistory] public class PublicationMaintenanceLog { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/PublicationRating.cs b/TASVideos.Data/Entity/PublicationRating.cs index 6400417ee..eef973928 100644 --- a/TASVideos.Data/Entity/PublicationRating.cs +++ b/TASVideos.Data/Entity/PublicationRating.cs @@ -1,10 +1,13 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; + +namespace TASVideos.Data.Entity; public enum PublicationRatingType { Entertainment, TechQuality } +[ExcludeFromHistory] public class PublicationRating { public int UserId { get; set; } diff --git a/TASVideos.Data/Entity/PublicationTag.cs b/TASVideos.Data/Entity/PublicationTag.cs index 95e2e2945..7f95139ff 100644 --- a/TASVideos.Data/Entity/PublicationTag.cs +++ b/TASVideos.Data/Entity/PublicationTag.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity; + +[ExcludeFromHistory] public class PublicationTag { public int PublicationId { get; set; } diff --git a/TASVideos.Data/Entity/PublicationUrl.cs b/TASVideos.Data/Entity/PublicationUrl.cs index 347fd2135..99ad9b6cc 100644 --- a/TASVideos.Data/Entity/PublicationUrl.cs +++ b/TASVideos.Data/Entity/PublicationUrl.cs @@ -1,7 +1,10 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; + +namespace TASVideos.Data.Entity; public enum PublicationUrlType { Streaming, Mirror } +[ExcludeFromHistory] public class PublicationUrl : BaseEntity { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/Role.cs b/TASVideos.Data/Entity/Role.cs index 5cf36ee24..31a7008e8 100644 --- a/TASVideos.Data/Entity/Role.cs +++ b/TASVideos.Data/Entity/Role.cs @@ -1,7 +1,9 @@ using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; namespace TASVideos.Data.Entity; +[ExcludeFromHistory] public class Role : IdentityRole, ITrackable { /// diff --git a/TASVideos.Data/Entity/RoleClaim.cs b/TASVideos.Data/Entity/RoleClaim.cs index 5ed15c0c1..f378df8f5 100644 --- a/TASVideos.Data/Entity/RoleClaim.cs +++ b/TASVideos.Data/Entity/RoleClaim.cs @@ -1,7 +1,9 @@ using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; namespace TASVideos.Data.Entity; +[ExcludeFromHistory] public class RoleClaim : IdentityRoleClaim { } diff --git a/TASVideos.Data/Entity/RoleLinks.cs b/TASVideos.Data/Entity/RoleLinks.cs index 97c391223..07b12f478 100644 --- a/TASVideos.Data/Entity/RoleLinks.cs +++ b/TASVideos.Data/Entity/RoleLinks.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity; + +[ExcludeFromHistory] public class RoleLink { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/RolePermission.cs b/TASVideos.Data/Entity/RolePermission.cs index 6ae6910ab..e3042b32f 100644 --- a/TASVideos.Data/Entity/RolePermission.cs +++ b/TASVideos.Data/Entity/RolePermission.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity; + +[ExcludeFromHistory] public class RolePermission { public int RoleId { get; set; } diff --git a/TASVideos.Data/Entity/Submission.cs b/TASVideos.Data/Entity/Submission.cs index 1fc652c06..f769850ff 100644 --- a/TASVideos.Data/Entity/Submission.cs +++ b/TASVideos.Data/Entity/Submission.cs @@ -1,4 +1,5 @@ -using TASVideos.Common; +using Microsoft.EntityFrameworkCore; +using TASVideos.Common; using TASVideos.Data.Entity.Forum; using TASVideos.Data.Entity.Game; @@ -13,6 +14,7 @@ public interface ISubmissionFilter IEnumerable GameIds { get; } } +[ExcludeFromHistory] public class Submission : BaseEntity, ITimeable { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/SubmissionAuthor.cs b/TASVideos.Data/Entity/SubmissionAuthor.cs index fe3822b50..2bb485e97 100644 --- a/TASVideos.Data/Entity/SubmissionAuthor.cs +++ b/TASVideos.Data/Entity/SubmissionAuthor.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity; + +[ExcludeFromHistory] public class SubmissionAuthor { public int UserId { get; set; } diff --git a/TASVideos.Data/Entity/SubmissionRejectionReason.cs b/TASVideos.Data/Entity/SubmissionRejectionReason.cs index 6c75e7f92..1da7a6f94 100644 --- a/TASVideos.Data/Entity/SubmissionRejectionReason.cs +++ b/TASVideos.Data/Entity/SubmissionRejectionReason.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity; + +[ExcludeFromHistory] public class SubmissionRejectionReason { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/SubmissionStatusHistory.cs b/TASVideos.Data/Entity/SubmissionStatusHistory.cs index 0c9b2d81f..5e51982e8 100644 --- a/TASVideos.Data/Entity/SubmissionStatusHistory.cs +++ b/TASVideos.Data/Entity/SubmissionStatusHistory.cs @@ -3,6 +3,7 @@ namespace TASVideos.Data.Entity; +[ExcludeFromHistory] public class SubmissionStatusHistory : BaseEntity { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/Tag.cs b/TASVideos.Data/Entity/Tag.cs index 4e0b4b255..2ca904a53 100644 --- a/TASVideos.Data/Entity/Tag.cs +++ b/TASVideos.Data/Entity/Tag.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity; + +[ExcludeFromHistory] public class Tag { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/User.cs b/TASVideos.Data/Entity/User.cs index 70644d5f0..dfa9d1cf7 100644 --- a/TASVideos.Data/Entity/User.cs +++ b/TASVideos.Data/Entity/User.cs @@ -6,6 +6,7 @@ namespace TASVideos.Data.Entity; +[ExcludeFromHistory] public class User : IdentityUser, ITrackable { public DateTime? LastLoggedInTimeStamp { get; set; } diff --git a/TASVideos.Data/Entity/UserClaim.cs b/TASVideos.Data/Entity/UserClaim.cs index 637883eb2..74121dc2b 100644 --- a/TASVideos.Data/Entity/UserClaim.cs +++ b/TASVideos.Data/Entity/UserClaim.cs @@ -1,7 +1,9 @@ using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; namespace TASVideos.Data.Entity; +[ExcludeFromHistory] public class UserClaim : IdentityUserClaim { } diff --git a/TASVideos.Data/Entity/UserDisallow.cs b/TASVideos.Data/Entity/UserDisallow.cs index 4d68d03c4..0140e0d3f 100644 --- a/TASVideos.Data/Entity/UserDisallow.cs +++ b/TASVideos.Data/Entity/UserDisallow.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity; + +[ExcludeFromHistory] public class UserDisallow : BaseEntity { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/UserFile.cs b/TASVideos.Data/Entity/UserFile.cs index daac07925..8cff9026c 100644 --- a/TASVideos.Data/Entity/UserFile.cs +++ b/TASVideos.Data/Entity/UserFile.cs @@ -1,4 +1,6 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; + +namespace TASVideos.Data.Entity; public enum UserFileClass { @@ -15,6 +17,7 @@ public enum Compression Gzip } +[ExcludeFromHistory] public class UserFile { public long Id { get; set; } diff --git a/TASVideos.Data/Entity/UserFileComment.cs b/TASVideos.Data/Entity/UserFileComment.cs index cfd33e3b8..f4ed38830 100644 --- a/TASVideos.Data/Entity/UserFileComment.cs +++ b/TASVideos.Data/Entity/UserFileComment.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity; + +[ExcludeFromHistory] public class UserFileComment { [Key] diff --git a/TASVideos.Data/Entity/UserLogin.cs b/TASVideos.Data/Entity/UserLogin.cs index 5c093cfdf..cc7c760d9 100644 --- a/TASVideos.Data/Entity/UserLogin.cs +++ b/TASVideos.Data/Entity/UserLogin.cs @@ -1,7 +1,9 @@ using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; namespace TASVideos.Data.Entity; +[ExcludeFromHistory] public class UserLogin : IdentityUserLogin { } diff --git a/TASVideos.Data/Entity/UserMaintenanceLog.cs b/TASVideos.Data/Entity/UserMaintenanceLog.cs index 84f031f5b..e1389e8f1 100644 --- a/TASVideos.Data/Entity/UserMaintenanceLog.cs +++ b/TASVideos.Data/Entity/UserMaintenanceLog.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity; + +[ExcludeFromHistory] public class UserMaintenanceLog { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/UserRole.cs b/TASVideos.Data/Entity/UserRole.cs index 4f622f05f..331e21e3a 100644 --- a/TASVideos.Data/Entity/UserRole.cs +++ b/TASVideos.Data/Entity/UserRole.cs @@ -1,7 +1,9 @@ using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; namespace TASVideos.Data.Entity; +[ExcludeFromHistory] public class UserRole : IdentityUserRole { public virtual User? User { get; set; } diff --git a/TASVideos.Data/Entity/UserToken.cs b/TASVideos.Data/Entity/UserToken.cs index f6aedcaa9..256f56e27 100644 --- a/TASVideos.Data/Entity/UserToken.cs +++ b/TASVideos.Data/Entity/UserToken.cs @@ -1,7 +1,9 @@ using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; namespace TASVideos.Data.Entity; +[ExcludeFromHistory] public class UserToken : IdentityUserToken { } diff --git a/TASVideos.Data/Entity/WikiPage.cs b/TASVideos.Data/Entity/WikiPage.cs index 861801398..77885445e 100644 --- a/TASVideos.Data/Entity/WikiPage.cs +++ b/TASVideos.Data/Entity/WikiPage.cs @@ -1,8 +1,10 @@ using System.Text.Json.Serialization; +using Microsoft.EntityFrameworkCore; using NpgsqlTypes; namespace TASVideos.Data.Entity; +[ExcludeFromHistory] public class WikiPage : BaseEntity, ISoftDeletable { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/WikiPageReferral.cs b/TASVideos.Data/Entity/WikiPageReferral.cs index 04e2739bf..3e4828bdb 100644 --- a/TASVideos.Data/Entity/WikiPageReferral.cs +++ b/TASVideos.Data/Entity/WikiPageReferral.cs @@ -1,5 +1,8 @@ -namespace TASVideos.Data.Entity; +using Microsoft.EntityFrameworkCore; +namespace TASVideos.Data.Entity; + +[ExcludeFromHistory] public class WikiPageReferral { public int Id { get; set; } From b25dba269257f8bdf0a1bd8128a52a566fbeddd4 Mon Sep 17 00:00:00 2001 From: Masterjun3 Date: Wed, 3 Aug 2022 20:42:45 +0200 Subject: [PATCH 5/6] enable autohistory for game and gameversion --- TASVideos.Data/Entity/Game/Game.cs | 5 +---- TASVideos.Data/Entity/Game/GameVersion.cs | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/TASVideos.Data/Entity/Game/Game.cs b/TASVideos.Data/Entity/Game/Game.cs index 8a9c25af2..b379e32fd 100644 --- a/TASVideos.Data/Entity/Game/Game.cs +++ b/TASVideos.Data/Entity/Game/Game.cs @@ -1,12 +1,9 @@ -using Microsoft.EntityFrameworkCore; - -namespace TASVideos.Data.Entity.Game; +namespace TASVideos.Data.Entity.Game; /// /// Represents a Game /// This is the central reference point for all site content /// -[ExcludeFromHistory] public class Game : BaseEntity { public int Id { get; set; } diff --git a/TASVideos.Data/Entity/Game/GameVersion.cs b/TASVideos.Data/Entity/Game/GameVersion.cs index 29bd828dc..62f1af7a7 100644 --- a/TASVideos.Data/Entity/Game/GameVersion.cs +++ b/TASVideos.Data/Entity/Game/GameVersion.cs @@ -1,6 +1,4 @@ -using Microsoft.EntityFrameworkCore; - -namespace TASVideos.Data.Entity.Game; +namespace TASVideos.Data.Entity.Game; public enum VersionTypes { @@ -10,7 +8,6 @@ public enum VersionTypes Bad } -[ExcludeFromHistory] public class GameVersion : BaseEntity { public int Id { get; set; } From 0c03c10caf3521d087e0f975813e8947fbd841fe Mon Sep 17 00:00:00 2001 From: Masterjun3 Date: Wed, 3 Aug 2022 20:44:46 +0200 Subject: [PATCH 6/6] add autohistory migration --- .../20220728191447_AddAutoHistory.Designer.cs | 3631 +++++++++++++++++ .../20220728191447_AddAutoHistory.cs | 38 + .../ApplicationDbContextModelSnapshot.cs | 57 + 3 files changed, 3726 insertions(+) create mode 100644 TASVideos.Data/Migrations/20220728191447_AddAutoHistory.Designer.cs create mode 100644 TASVideos.Data/Migrations/20220728191447_AddAutoHistory.cs diff --git a/TASVideos.Data/Migrations/20220728191447_AddAutoHistory.Designer.cs b/TASVideos.Data/Migrations/20220728191447_AddAutoHistory.Designer.cs new file mode 100644 index 000000000..6d51df591 --- /dev/null +++ b/TASVideos.Data/Migrations/20220728191447_AddAutoHistory.Designer.cs @@ -0,0 +1,3631 @@ +// +using System; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using NpgsqlTypes; +using TASVideos.Data; + +#nullable disable + +namespace TASVideos.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20220728191447_AddAutoHistory")] + partial class AddAutoHistory + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.6") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "citext"); + NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "pg_trgm"); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Microsoft.EntityFrameworkCore.AutoHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Changed") + .HasColumnType("citext") + .HasColumnName("changed"); + + b.Property("Created") + .HasColumnType("timestamp without time zone") + .HasColumnName("created"); + + b.Property("Discriminator") + .IsRequired() + .HasColumnType("text") + .HasColumnName("discriminator"); + + b.Property("Kind") + .HasColumnType("integer") + .HasColumnName("kind"); + + b.Property("RowId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("citext") + .HasColumnName("row_id"); + + b.Property("TableName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("citext") + .HasColumnName("table_name"); + + b.HasKey("Id") + .HasName("pk_auto_history"); + + b.ToTable("auto_history", (string)null); + + b.HasDiscriminator("Discriminator").HasValue("AutoHistory"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Awards.Award", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("citext") + .HasColumnName("description"); + + b.Property("ShortName") + .IsRequired() + .HasMaxLength(25) + .HasColumnType("citext") + .HasColumnName("short_name"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.HasKey("Id") + .HasName("pk_awards"); + + b.ToTable("awards", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Awards.PublicationAward", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AwardId") + .HasColumnType("integer") + .HasColumnName("award_id"); + + b.Property("PublicationId") + .HasColumnType("integer") + .HasColumnName("publication_id"); + + b.Property("Year") + .HasColumnType("integer") + .HasColumnName("year"); + + b.HasKey("Id") + .HasName("pk_publication_awards"); + + b.HasIndex("AwardId") + .HasDatabaseName("ix_publication_awards_award_id"); + + b.HasIndex("PublicationId") + .HasDatabaseName("ix_publication_awards_publication_id"); + + b.ToTable("publication_awards", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Awards.UserAward", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AwardId") + .HasColumnType("integer") + .HasColumnName("award_id"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.Property("Year") + .HasColumnType("integer") + .HasColumnName("year"); + + b.HasKey("Id") + .HasName("pk_user_awards"); + + b.HasIndex("AwardId") + .HasDatabaseName("ix_user_awards_award_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_user_awards_user_id"); + + b.ToTable("user_awards", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.DeprecatedMovieFormat", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("Deprecated") + .HasColumnType("boolean") + .HasColumnName("deprecated"); + + b.Property("FileExtension") + .IsRequired() + .HasColumnType("citext") + .HasColumnName("file_extension"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.HasKey("Id") + .HasName("pk_deprecated_movie_formats"); + + b.HasIndex("FileExtension") + .IsUnique() + .HasDatabaseName("ix_deprecated_movie_formats_file_extension"); + + b.ToTable("deprecated_movie_formats", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Flag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("IconPath") + .HasMaxLength(48) + .HasColumnType("citext") + .HasColumnName("icon_path"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("LinkPath") + .HasMaxLength(48) + .HasColumnType("citext") + .HasColumnName("link_path"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("citext") + .HasColumnName("name"); + + b.Property("PermissionRestriction") + .HasColumnType("integer") + .HasColumnName("permission_restriction"); + + b.Property("Token") + .IsRequired() + .HasMaxLength(24) + .HasColumnType("citext") + .HasColumnName("token"); + + b.HasKey("Id") + .HasName("pk_flags"); + + b.HasIndex("Token") + .IsUnique() + .HasDatabaseName("ix_flags_token"); + + b.ToTable("flags", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Forum.Forum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CategoryId") + .HasColumnType("integer") + .HasColumnName("category_id"); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("citext") + .HasColumnName("description"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("citext") + .HasColumnName("name"); + + b.Property("Ordinal") + .HasColumnType("integer") + .HasColumnName("ordinal"); + + b.Property("Restricted") + .HasColumnType("boolean") + .HasColumnName("restricted"); + + b.Property("ShortName") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("citext") + .HasColumnName("short_name"); + + b.HasKey("Id") + .HasName("pk_forums"); + + b.HasIndex("CategoryId") + .HasDatabaseName("ix_forums_category_id"); + + b.ToTable("forums", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Forum.ForumCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("citext") + .HasColumnName("description"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("Ordinal") + .HasColumnType("integer") + .HasColumnName("ordinal"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("citext") + .HasColumnName("title"); + + b.HasKey("Id") + .HasName("pk_forum_categories"); + + b.ToTable("forum_categories", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Forum.ForumPoll", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CloseDate") + .HasColumnType("timestamp without time zone") + .HasColumnName("close_date"); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("MultiSelect") + .HasColumnType("boolean") + .HasColumnName("multi_select"); + + b.Property("Question") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("citext") + .HasColumnName("question"); + + b.Property("TopicId") + .HasColumnType("integer") + .HasColumnName("topic_id"); + + b.HasKey("Id") + .HasName("pk_forum_polls"); + + b.ToTable("forum_polls", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Forum.ForumPollOption", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("Ordinal") + .HasColumnType("integer") + .HasColumnName("ordinal"); + + b.Property("PollId") + .HasColumnType("integer") + .HasColumnName("poll_id"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("citext") + .HasColumnName("text"); + + b.HasKey("Id") + .HasName("pk_forum_poll_options"); + + b.HasIndex("PollId") + .HasDatabaseName("ix_forum_poll_options_poll_id"); + + b.ToTable("forum_poll_options", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Forum.ForumPollOptionVote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("IpAddress") + .HasMaxLength(50) + .HasColumnType("citext") + .HasColumnName("ip_address"); + + b.Property("PollOptionId") + .HasColumnType("integer") + .HasColumnName("poll_option_id"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_forum_poll_option_votes"); + + b.HasIndex("PollOptionId") + .HasDatabaseName("ix_forum_poll_option_votes_poll_option_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_forum_poll_option_votes_user_id"); + + b.ToTable("forum_poll_option_votes", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Forum.ForumPost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("EnableBbCode") + .HasColumnType("boolean") + .HasColumnName("enable_bb_code"); + + b.Property("EnableHtml") + .HasColumnType("boolean") + .HasColumnName("enable_html"); + + b.Property("ForumId") + .HasColumnType("integer") + .HasColumnName("forum_id"); + + b.Property("IpAddress") + .HasMaxLength(50) + .HasColumnType("citext") + .HasColumnName("ip_address"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("PosterId") + .HasColumnType("integer") + .HasColumnName("poster_id"); + + b.Property("PosterMood") + .HasColumnType("integer") + .HasColumnName("poster_mood"); + + b.Property("SearchVector") + .IsRequired() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("tsvector") + .HasColumnName("search_vector") + .HasAnnotation("Npgsql:TsVectorConfig", "english") + .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Text" }); + + b.Property("Subject") + .HasMaxLength(500) + .HasColumnType("citext") + .HasColumnName("subject"); + + b.Property("Text") + .IsRequired() + .HasColumnType("citext") + .HasColumnName("text"); + + b.Property("TopicId") + .HasColumnType("integer") + .HasColumnName("topic_id"); + + b.HasKey("Id") + .HasName("pk_forum_posts"); + + b.HasIndex("ForumId") + .HasDatabaseName("ix_forum_posts_forum_id"); + + b.HasIndex("PosterId") + .HasDatabaseName("ix_forum_posts_poster_id"); + + b.HasIndex("SearchVector") + .HasDatabaseName("ix_forum_posts_search_vector"); + + NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); + + b.HasIndex("Text") + .HasDatabaseName("ix_forum_posts_text"); + + NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("Text"), "gin"); + NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex("Text"), new[] { "gin_trgm_ops" }); + + b.HasIndex("TopicId") + .HasDatabaseName("ix_forum_posts_topic_id"); + + b.ToTable("forum_posts", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Forum.ForumTopic", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("ForumId") + .HasColumnType("integer") + .HasColumnName("forum_id"); + + b.Property("IsLocked") + .HasColumnType("boolean") + .HasColumnName("is_locked"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("PollId") + .HasColumnType("integer") + .HasColumnName("poll_id"); + + b.Property("PosterId") + .HasColumnType("integer") + .HasColumnName("poster_id"); + + b.Property("SubmissionId") + .HasColumnType("integer") + .HasColumnName("submission_id"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("citext") + .HasColumnName("title"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.HasKey("Id") + .HasName("pk_forum_topics"); + + b.HasIndex("ForumId") + .HasDatabaseName("ix_forum_topics_forum_id"); + + b.HasIndex("PollId") + .IsUnique() + .HasDatabaseName("ix_forum_topics_poll_id"); + + b.HasIndex("PosterId") + .HasDatabaseName("ix_forum_topics_poster_id"); + + b.HasIndex("SubmissionId") + .IsUnique() + .HasDatabaseName("ix_forum_topics_submission_id"); + + b.ToTable("forum_topics", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Forum.ForumTopicWatch", b => + { + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.Property("ForumTopicId") + .HasColumnType("integer") + .HasColumnName("forum_topic_id"); + + b.Property("IsNotified") + .HasColumnType("boolean") + .HasColumnName("is_notified"); + + b.HasKey("UserId", "ForumTopicId") + .HasName("pk_forum_topic_watches"); + + b.HasIndex("ForumTopicId") + .HasDatabaseName("ix_forum_topic_watches_forum_topic_id"); + + b.ToTable("forum_topic_watches", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Game.Game", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Abbreviation") + .HasMaxLength(24) + .HasColumnType("citext") + .HasColumnName("abbreviation"); + + b.Property("Aliases") + .HasMaxLength(250) + .HasColumnType("citext") + .HasColumnName("aliases"); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("citext") + .HasColumnName("display_name"); + + b.Property("GameResourcesPage") + .HasMaxLength(300) + .HasColumnType("citext") + .HasColumnName("game_resources_page"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("ScreenshotUrl") + .HasMaxLength(250) + .HasColumnType("citext") + .HasColumnName("screenshot_url"); + + b.HasKey("Id") + .HasName("pk_games"); + + b.HasIndex("Abbreviation") + .IsUnique() + .HasDatabaseName("ix_games_abbreviation"); + + b.ToTable("games", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Game.GameGameGroup", b => + { + b.Property("GameId") + .HasColumnType("integer") + .HasColumnName("game_id"); + + b.Property("GameGroupId") + .HasColumnType("integer") + .HasColumnName("game_group_id"); + + b.HasKey("GameId", "GameGroupId") + .HasName("pk_game_game_groups"); + + b.HasIndex("GameGroupId") + .HasDatabaseName("ix_game_game_groups_game_group_id"); + + b.HasIndex("GameId") + .HasDatabaseName("ix_game_game_groups_game_id"); + + b.ToTable("game_game_groups", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Game.GameGenre", b => + { + b.Property("GameId") + .HasColumnType("integer") + .HasColumnName("game_id"); + + b.Property("GenreId") + .HasColumnType("integer") + .HasColumnName("genre_id"); + + b.HasKey("GameId", "GenreId") + .HasName("pk_game_genres"); + + b.HasIndex("GameId") + .HasDatabaseName("ix_game_genres_game_id"); + + b.HasIndex("GenreId") + .HasDatabaseName("ix_game_genres_genre_id"); + + b.ToTable("game_genres", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Game.GameGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .HasMaxLength(2000) + .HasColumnType("citext") + .HasColumnName("description"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("citext") + .HasColumnName("name"); + + b.Property("SearchKey") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("citext") + .HasColumnName("search_key"); + + b.HasKey("Id") + .HasName("pk_game_groups"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("ix_game_groups_name"); + + b.ToTable("game_groups", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Game.GameSystem", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("DatabaseGenerated", DatabaseGeneratedOption.None); + + b.Property("Code") + .IsRequired() + .HasMaxLength(8) + .HasColumnType("citext") + .HasColumnName("code"); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("citext") + .HasColumnName("display_name"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.HasKey("Id") + .HasName("pk_game_systems"); + + b.HasIndex("Code") + .IsUnique() + .HasDatabaseName("ix_game_systems_code"); + + b.ToTable("game_systems", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Game.GameSystemFrameRate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("FrameRate") + .HasColumnType("double precision") + .HasColumnName("frame_rate"); + + b.Property("GameSystemId") + .HasColumnType("integer") + .HasColumnName("game_system_id"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("Obsolete") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("obsolete"); + + b.Property("Preliminary") + .HasColumnType("boolean") + .HasColumnName("preliminary"); + + b.Property("RegionCode") + .IsRequired() + .HasMaxLength(8) + .HasColumnType("citext") + .HasColumnName("region_code"); + + b.HasKey("Id") + .HasName("pk_game_system_frame_rates"); + + b.HasIndex("GameSystemId") + .HasDatabaseName("ix_game_system_frame_rates_game_system_id"); + + b.ToTable("game_system_frame_rates", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Game.GameVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("GameId") + .HasColumnType("integer") + .HasColumnName("game_id"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("Md5") + .HasMaxLength(32) + .HasColumnType("citext") + .HasColumnName("md5"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("citext") + .HasColumnName("name"); + + b.Property("Region") + .HasMaxLength(50) + .HasColumnType("citext") + .HasColumnName("region"); + + b.Property("Sha1") + .HasMaxLength(40) + .HasColumnType("citext") + .HasColumnName("sha1"); + + b.Property("SystemId") + .HasColumnType("integer") + .HasColumnName("system_id"); + + b.Property("TitleOverride") + .HasMaxLength(255) + .HasColumnType("citext") + .HasColumnName("title_override"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.Property("Version") + .HasMaxLength(50) + .HasColumnType("citext") + .HasColumnName("version"); + + b.HasKey("Id") + .HasName("pk_game_versions"); + + b.HasIndex("GameId") + .HasDatabaseName("ix_game_versions_game_id"); + + b.HasIndex("SystemId") + .HasDatabaseName("ix_game_versions_system_id"); + + b.ToTable("game_versions", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Game.Genre", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("citext") + .HasColumnName("display_name"); + + b.HasKey("Id") + .HasName("pk_genres"); + + b.ToTable("genres", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.IpBan", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("Mask") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("citext") + .HasColumnName("mask"); + + b.HasKey("Id") + .HasName("pk_ip_bans"); + + b.HasIndex("Mask") + .IsUnique() + .HasDatabaseName("ix_ip_bans_mask"); + + b.ToTable("ip_bans", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.MediaPost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Body") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("citext") + .HasColumnName("body"); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("Group") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("citext") + .HasColumnName("group"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("Link") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("citext") + .HasColumnName("link"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("citext") + .HasColumnName("title"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("citext") + .HasColumnName("type"); + + b.Property("User") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("citext") + .HasColumnName("user"); + + b.HasKey("Id") + .HasName("pk_media_posts"); + + b.ToTable("media_posts", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.PrivateMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("DeletedForFromUser") + .HasColumnType("boolean") + .HasColumnName("deleted_for_from_user"); + + b.Property("DeletedForToUser") + .HasColumnType("boolean") + .HasColumnName("deleted_for_to_user"); + + b.Property("EnableBbCode") + .HasColumnType("boolean") + .HasColumnName("enable_bb_code"); + + b.Property("EnableHtml") + .HasColumnType("boolean") + .HasColumnName("enable_html"); + + b.Property("FromUserId") + .HasColumnType("integer") + .HasColumnName("from_user_id"); + + b.Property("IpAddress") + .HasMaxLength(50) + .HasColumnType("citext") + .HasColumnName("ip_address"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("ReadOn") + .HasColumnType("timestamp without time zone") + .HasColumnName("read_on"); + + b.Property("SavedForFromUser") + .HasColumnType("boolean") + .HasColumnName("saved_for_from_user"); + + b.Property("SavedForToUser") + .HasColumnType("boolean") + .HasColumnName("saved_for_to_user"); + + b.Property("Subject") + .HasMaxLength(500) + .HasColumnType("citext") + .HasColumnName("subject"); + + b.Property("Text") + .IsRequired() + .HasColumnType("citext") + .HasColumnName("text"); + + b.Property("ToUserId") + .HasColumnType("integer") + .HasColumnName("to_user_id"); + + b.HasKey("Id") + .HasName("pk_private_messages"); + + b.HasIndex("FromUserId") + .HasDatabaseName("ix_private_messages_from_user_id"); + + b.HasIndex("ToUserId", "ReadOn", "DeletedForToUser") + .HasDatabaseName("ix_private_messages_to_user_id_read_on_deleted_for_to_user"); + + b.ToTable("private_messages", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Publication", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AdditionalAuthors") + .HasMaxLength(200) + .HasColumnType("citext") + .HasColumnName("additional_authors"); + + b.Property("Branch") + .HasMaxLength(50) + .HasColumnType("citext") + .HasColumnName("branch"); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("EmulatorVersion") + .HasMaxLength(50) + .HasColumnType("citext") + .HasColumnName("emulator_version"); + + b.Property("Frames") + .HasColumnType("integer") + .HasColumnName("frames"); + + b.Property("GameId") + .HasColumnType("integer") + .HasColumnName("game_id"); + + b.Property("GameVersionId") + .HasColumnType("integer") + .HasColumnName("game_version_id"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("MovieFile") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("movie_file"); + + b.Property("MovieFileName") + .IsRequired() + .HasColumnType("citext") + .HasColumnName("movie_file_name"); + + b.Property("ObsoletedById") + .HasColumnType("integer") + .HasColumnName("obsoleted_by_id"); + + b.Property("PublicationClassId") + .HasColumnType("integer") + .HasColumnName("publication_class_id"); + + b.Property("RerecordCount") + .HasColumnType("integer") + .HasColumnName("rerecord_count"); + + b.Property("SubmissionId") + .HasColumnType("integer") + .HasColumnName("submission_id"); + + b.Property("SystemFrameRateId") + .HasColumnType("integer") + .HasColumnName("system_frame_rate_id"); + + b.Property("SystemId") + .HasColumnType("integer") + .HasColumnName("system_id"); + + b.Property("Title") + .IsRequired() + .HasColumnType("citext") + .HasColumnName("title"); + + b.Property("WikiContentId") + .HasColumnType("integer") + .HasColumnName("wiki_content_id"); + + b.HasKey("Id") + .HasName("pk_publications"); + + b.HasIndex("GameId") + .HasDatabaseName("ix_publications_game_id"); + + b.HasIndex("GameVersionId") + .HasDatabaseName("ix_publications_game_version_id"); + + b.HasIndex("ObsoletedById") + .HasDatabaseName("ix_publications_obsoleted_by_id"); + + b.HasIndex("PublicationClassId") + .HasDatabaseName("ix_publications_publication_class_id"); + + b.HasIndex("SubmissionId") + .IsUnique() + .HasDatabaseName("ix_publications_submission_id"); + + b.HasIndex("SystemFrameRateId") + .HasDatabaseName("ix_publications_system_frame_rate_id"); + + b.HasIndex("SystemId") + .HasDatabaseName("ix_publications_system_id"); + + b.HasIndex("WikiContentId") + .HasDatabaseName("ix_publications_wiki_content_id"); + + b.ToTable("publications", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.PublicationAuthor", b => + { + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.Property("PublicationId") + .HasColumnType("integer") + .HasColumnName("publication_id"); + + b.Property("Ordinal") + .HasColumnType("integer") + .HasColumnName("ordinal"); + + b.HasKey("UserId", "PublicationId") + .HasName("pk_publication_authors"); + + b.HasIndex("PublicationId") + .HasDatabaseName("ix_publication_authors_publication_id"); + + b.ToTable("publication_authors", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.PublicationClass", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("DatabaseGenerated", DatabaseGeneratedOption.None); + + b.Property("IconPath") + .HasMaxLength(100) + .HasColumnType("citext") + .HasColumnName("icon_path"); + + b.Property("Link") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("citext") + .HasColumnName("link"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("citext") + .HasColumnName("name"); + + b.Property("Weight") + .HasColumnType("double precision") + .HasColumnName("weight"); + + b.HasKey("Id") + .HasName("pk_publication_classes"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("ix_publication_classes_name"); + + b.ToTable("publication_classes", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.PublicationFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("Description") + .HasMaxLength(250) + .HasColumnType("citext") + .HasColumnName("description"); + + b.Property("FileData") + .HasColumnType("bytea") + .HasColumnName("file_data"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("citext") + .HasColumnName("path"); + + b.Property("PublicationId") + .HasColumnType("integer") + .HasColumnName("publication_id"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.HasKey("Id") + .HasName("pk_publication_files"); + + b.HasIndex("PublicationId") + .HasDatabaseName("ix_publication_files_publication_id"); + + b.ToTable("publication_files", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.PublicationFlag", b => + { + b.Property("PublicationId") + .HasColumnType("integer") + .HasColumnName("publication_id"); + + b.Property("FlagId") + .HasColumnType("integer") + .HasColumnName("flag_id"); + + b.HasKey("PublicationId", "FlagId") + .HasName("pk_publication_flags"); + + b.HasIndex("FlagId") + .HasDatabaseName("ix_publication_flags_flag_id"); + + b.HasIndex("PublicationId") + .HasDatabaseName("ix_publication_flags_publication_id"); + + b.ToTable("publication_flags", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.PublicationMaintenanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Log") + .IsRequired() + .HasColumnType("citext") + .HasColumnName("log"); + + b.Property("PublicationId") + .HasColumnType("integer") + .HasColumnName("publication_id"); + + b.Property("TimeStamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("time_stamp"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_publication_maintenance_logs"); + + b.HasIndex("PublicationId") + .HasDatabaseName("ix_publication_maintenance_logs_publication_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_publication_maintenance_logs_user_id"); + + b.ToTable("publication_maintenance_logs", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.PublicationRating", b => + { + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.Property("PublicationId") + .HasColumnType("integer") + .HasColumnName("publication_id"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.Property("Value") + .HasColumnType("double precision") + .HasColumnName("value"); + + b.HasKey("UserId", "PublicationId", "Type") + .HasName("pk_publication_ratings"); + + b.HasIndex("PublicationId") + .HasDatabaseName("ix_publication_ratings_publication_id"); + + b.HasIndex("UserId", "PublicationId", "Type") + .IsUnique() + .HasDatabaseName("ix_publication_ratings_user_id_publication_id_type"); + + b.ToTable("publication_ratings", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.PublicationTag", b => + { + b.Property("PublicationId") + .HasColumnType("integer") + .HasColumnName("publication_id"); + + b.Property("TagId") + .HasColumnType("integer") + .HasColumnName("tag_id"); + + b.HasKey("PublicationId", "TagId") + .HasName("pk_publication_tags"); + + b.HasIndex("PublicationId") + .HasDatabaseName("ix_publication_tags_publication_id"); + + b.HasIndex("TagId") + .HasDatabaseName("ix_publication_tags_tag_id"); + + b.ToTable("publication_tags", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.PublicationUrl", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("DisplayName") + .HasMaxLength(100) + .HasColumnType("citext") + .HasColumnName("display_name"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("PublicationId") + .HasColumnType("integer") + .HasColumnName("publication_id"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("citext") + .HasColumnName("url"); + + b.HasKey("Id") + .HasName("pk_publication_urls"); + + b.HasIndex("PublicationId") + .HasDatabaseName("ix_publication_urls_publication_id"); + + b.HasIndex("Type") + .HasDatabaseName("ix_publication_urls_type"); + + b.ToTable("publication_urls", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AutoAssignPostCount") + .HasColumnType("integer") + .HasColumnName("auto_assign_post_count"); + + b.Property("AutoAssignPublications") + .HasColumnType("boolean") + .HasColumnName("auto_assign_publications"); + + b.Property("ConcurrencyStamp") + .HasColumnType("citext") + .HasColumnName("concurrency_stamp"); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("citext") + .HasColumnName("description"); + + b.Property("IsDefault") + .HasColumnType("boolean") + .HasColumnName("is_default"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("Name") + .HasColumnType("citext") + .HasColumnName("name"); + + b.Property("NormalizedName") + .HasColumnType("citext") + .HasColumnName("normalized_name"); + + b.HasKey("Id") + .HasName("pk_roles"); + + b.ToTable("roles", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.RoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("citext") + .HasColumnName("claim_type"); + + b.Property("ClaimValue") + .HasColumnType("citext") + .HasColumnName("claim_value"); + + b.Property("RoleId") + .HasColumnType("integer") + .HasColumnName("role_id"); + + b.HasKey("Id") + .HasName("pk_role_claims"); + + b.HasIndex("RoleId") + .HasDatabaseName("ix_role_claims_role_id"); + + b.ToTable("role_claims", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.RoleLink", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Link") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("citext") + .HasColumnName("link"); + + b.Property("RoleId") + .HasColumnType("integer") + .HasColumnName("role_id"); + + b.HasKey("Id") + .HasName("pk_role_links"); + + b.HasIndex("RoleId") + .HasDatabaseName("ix_role_links_role_id"); + + b.ToTable("role_links", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.RolePermission", b => + { + b.Property("RoleId") + .HasColumnType("integer") + .HasColumnName("role_id"); + + b.Property("PermissionId") + .HasColumnType("integer") + .HasColumnName("permission_id"); + + b.Property("CanAssign") + .HasColumnType("boolean") + .HasColumnName("can_assign"); + + b.HasKey("RoleId", "PermissionId") + .HasName("pk_role_permission"); + + b.ToTable("role_permission", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Submission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AdditionalAuthors") + .HasMaxLength(200) + .HasColumnType("citext") + .HasColumnName("additional_authors"); + + b.Property("Branch") + .HasMaxLength(50) + .HasColumnType("citext") + .HasColumnName("branch"); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("EmulatorVersion") + .HasMaxLength(50) + .HasColumnType("citext") + .HasColumnName("emulator_version"); + + b.Property("EncodeEmbedLink") + .HasMaxLength(100) + .HasColumnType("citext") + .HasColumnName("encode_embed_link"); + + b.Property("Frames") + .HasColumnType("integer") + .HasColumnName("frames"); + + b.Property("GameId") + .HasColumnType("integer") + .HasColumnName("game_id"); + + b.Property("GameName") + .HasMaxLength(100) + .HasColumnType("citext") + .HasColumnName("game_name"); + + b.Property("GameVersionId") + .HasColumnType("integer") + .HasColumnName("game_version_id"); + + b.Property("ImportedTime") + .ValueGeneratedOnAdd() + .HasColumnType("numeric(16,4)") + .HasDefaultValue(0m) + .HasColumnName("imported_time"); + + b.Property("IntendedClassId") + .HasColumnType("integer") + .HasColumnName("intended_class_id"); + + b.Property("JudgeId") + .HasColumnType("integer") + .HasColumnName("judge_id"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("LegacyTime") + .ValueGeneratedOnAdd() + .HasColumnType("numeric(16,4)") + .HasDefaultValue(0m) + .HasColumnName("legacy_time"); + + b.Property("MovieExtension") + .HasColumnType("citext") + .HasColumnName("movie_extension"); + + b.Property("MovieFile") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("movie_file"); + + b.Property("MovieStartType") + .HasColumnType("integer") + .HasColumnName("movie_start_type"); + + b.Property("PublisherId") + .HasColumnType("integer") + .HasColumnName("publisher_id"); + + b.Property("RejectionReasonId") + .HasColumnType("integer") + .HasColumnName("rejection_reason_id"); + + b.Property("RerecordCount") + .HasColumnType("integer") + .HasColumnName("rerecord_count"); + + b.Property("RomName") + .HasMaxLength(250) + .HasColumnType("citext") + .HasColumnName("rom_name"); + + b.Property("Status") + .HasColumnType("integer") + .HasColumnName("status"); + + b.Property("SubmittedGameVersion") + .HasMaxLength(100) + .HasColumnType("citext") + .HasColumnName("submitted_game_version"); + + b.Property("SubmitterId") + .HasColumnType("integer") + .HasColumnName("submitter_id"); + + b.Property("SystemFrameRateId") + .HasColumnType("integer") + .HasColumnName("system_frame_rate_id"); + + b.Property("SystemId") + .HasColumnType("integer") + .HasColumnName("system_id"); + + b.Property("Title") + .IsRequired() + .HasColumnType("citext") + .HasColumnName("title"); + + b.Property("TopicId") + .HasColumnType("integer") + .HasColumnName("topic_id"); + + b.Property("Warnings") + .HasMaxLength(4096) + .HasColumnType("citext") + .HasColumnName("warnings"); + + b.Property("WikiContentId") + .HasColumnType("integer") + .HasColumnName("wiki_content_id"); + + b.HasKey("Id") + .HasName("pk_submissions"); + + b.HasIndex("GameId") + .HasDatabaseName("ix_submissions_game_id"); + + b.HasIndex("GameVersionId") + .HasDatabaseName("ix_submissions_game_version_id"); + + b.HasIndex("IntendedClassId") + .HasDatabaseName("ix_submissions_intended_class_id"); + + b.HasIndex("JudgeId") + .HasDatabaseName("ix_submissions_judge_id"); + + b.HasIndex("PublisherId") + .HasDatabaseName("ix_submissions_publisher_id"); + + b.HasIndex("RejectionReasonId") + .HasDatabaseName("ix_submissions_rejection_reason_id"); + + b.HasIndex("Status") + .HasDatabaseName("ix_submissions_status"); + + b.HasIndex("SubmitterId") + .HasDatabaseName("ix_submissions_submitter_id"); + + b.HasIndex("SystemFrameRateId") + .HasDatabaseName("ix_submissions_system_frame_rate_id"); + + b.HasIndex("SystemId") + .HasDatabaseName("ix_submissions_system_id"); + + b.HasIndex("WikiContentId") + .HasDatabaseName("ix_submissions_wiki_content_id"); + + b.ToTable("submissions", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.SubmissionAuthor", b => + { + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.Property("SubmissionId") + .HasColumnType("integer") + .HasColumnName("submission_id"); + + b.Property("Ordinal") + .HasColumnType("integer") + .HasColumnName("ordinal"); + + b.HasKey("UserId", "SubmissionId") + .HasName("pk_submission_authors"); + + b.HasIndex("SubmissionId") + .HasDatabaseName("ix_submission_authors_submission_id"); + + b.ToTable("submission_authors", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.SubmissionRejectionReason", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("citext") + .HasColumnName("display_name"); + + b.HasKey("Id") + .HasName("pk_submission_rejection_reasons"); + + b.HasIndex("DisplayName") + .IsUnique() + .HasDatabaseName("ix_submission_rejection_reasons_display_name"); + + b.ToTable("submission_rejection_reasons", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.SubmissionStatusHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("Status") + .HasColumnType("integer") + .HasColumnName("status"); + + b.Property("SubmissionId") + .HasColumnType("integer") + .HasColumnName("submission_id"); + + b.HasKey("Id") + .HasName("pk_submission_status_history"); + + b.HasIndex("SubmissionId") + .HasDatabaseName("ix_submission_status_history_submission_id"); + + b.ToTable("submission_status_history", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Code") + .IsRequired() + .HasMaxLength(25) + .HasColumnType("citext") + .HasColumnName("code"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("citext") + .HasColumnName("display_name"); + + b.HasKey("Id") + .HasName("pk_tags"); + + b.HasIndex("Code") + .IsUnique() + .HasDatabaseName("ix_tags_code"); + + b.ToTable("tags", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccessFailedCount") + .HasColumnType("integer") + .HasColumnName("access_failed_count"); + + b.Property("Avatar") + .HasMaxLength(250) + .HasColumnType("citext") + .HasColumnName("avatar"); + + b.Property("ConcurrencyStamp") + .HasColumnType("citext") + .HasColumnName("concurrency_stamp"); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("Email") + .HasColumnType("citext") + .HasColumnName("email"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean") + .HasColumnName("email_confirmed"); + + b.Property("EmailOnPrivateMessage") + .HasColumnType("boolean") + .HasColumnName("email_on_private_message"); + + b.Property("From") + .HasMaxLength(100) + .HasColumnType("citext") + .HasColumnName("from"); + + b.Property("LastLoggedInTimeStamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_logged_in_time_stamp"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean") + .HasColumnName("lockout_enabled"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone") + .HasColumnName("lockout_end"); + + b.Property("ModeratorComments") + .HasColumnType("citext") + .HasColumnName("moderator_comments"); + + b.Property("MoodAvatarUrlBase") + .HasMaxLength(250) + .HasColumnType("citext") + .HasColumnName("mood_avatar_url_base"); + + b.Property("NormalizedEmail") + .HasColumnType("citext") + .HasColumnName("normalized_email"); + + b.Property("NormalizedUserName") + .HasColumnType("citext") + .HasColumnName("normalized_user_name"); + + b.Property("PasswordHash") + .HasColumnType("citext") + .HasColumnName("password_hash"); + + b.Property("PhoneNumber") + .HasColumnType("citext") + .HasColumnName("phone_number"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean") + .HasColumnName("phone_number_confirmed"); + + b.Property("PreferredPronouns") + .HasColumnType("integer") + .HasColumnName("preferred_pronouns"); + + b.Property("PublicRatings") + .HasColumnType("boolean") + .HasColumnName("public_ratings"); + + b.Property("SecurityStamp") + .HasColumnType("citext") + .HasColumnName("security_stamp"); + + b.Property("Signature") + .HasMaxLength(1000) + .HasColumnType("citext") + .HasColumnName("signature"); + + b.Property("TimeZoneId") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("citext") + .HasColumnName("time_zone_id"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean") + .HasColumnName("two_factor_enabled"); + + b.Property("UseRatings") + .HasColumnType("boolean") + .HasColumnName("use_ratings"); + + b.Property("UserName") + .HasColumnType("citext") + .HasColumnName("user_name"); + + b.HasKey("Id") + .HasName("pk_users"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("ix_users_normalized_user_name"); + + b.ToTable("users", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.UserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("citext") + .HasColumnName("claim_type"); + + b.Property("ClaimValue") + .HasColumnType("citext") + .HasColumnName("claim_value"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_user_claims"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_user_claims_user_id"); + + b.ToTable("user_claims", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.UserDisallow", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("RegexPattern") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("citext") + .HasColumnName("regex_pattern"); + + b.HasKey("Id") + .HasName("pk_user_disallows"); + + b.HasIndex("RegexPattern") + .IsUnique() + .HasDatabaseName("ix_user_disallows_regex_pattern"); + + b.ToTable("user_disallows", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.UserFile", b => + { + b.Property("Id") + .HasColumnType("bigint") + .HasColumnName("id") + .HasAnnotation("DatabaseGenerated", DatabaseGeneratedOption.None); + + b.Property("AuthorId") + .HasColumnType("integer") + .HasColumnName("author_id"); + + b.Property("Class") + .HasColumnType("integer") + .HasColumnName("class"); + + b.Property("CompressionType") + .HasColumnType("integer") + .HasColumnName("compression_type"); + + b.Property("Content") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("content"); + + b.Property("Description") + .HasColumnType("citext") + .HasColumnName("description"); + + b.Property("Downloads") + .HasColumnType("integer") + .HasColumnName("downloads"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("citext") + .HasColumnName("file_name"); + + b.Property("Frames") + .HasColumnType("integer") + .HasColumnName("frames"); + + b.Property("GameId") + .HasColumnType("integer") + .HasColumnName("game_id"); + + b.Property("Hidden") + .HasColumnType("boolean") + .HasColumnName("hidden"); + + b.Property("Length") + .HasColumnType("numeric(10,3)") + .HasColumnName("length"); + + b.Property("LogicalLength") + .HasColumnType("integer") + .HasColumnName("logical_length"); + + b.Property("PhysicalLength") + .HasColumnType("integer") + .HasColumnName("physical_length"); + + b.Property("Rerecords") + .HasColumnType("integer") + .HasColumnName("rerecords"); + + b.Property("SystemId") + .HasColumnType("integer") + .HasColumnName("system_id"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("citext") + .HasColumnName("title"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("citext") + .HasColumnName("type"); + + b.Property("UploadTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("upload_timestamp"); + + b.Property("Views") + .HasColumnType("integer") + .HasColumnName("views"); + + b.Property("Warnings") + .HasColumnType("citext") + .HasColumnName("warnings"); + + b.HasKey("Id") + .HasName("pk_user_files"); + + b.HasIndex("AuthorId") + .HasDatabaseName("ix_user_files_author_id"); + + b.HasIndex("GameId") + .HasDatabaseName("ix_user_files_game_id"); + + b.HasIndex("Hidden") + .HasDatabaseName("ix_user_files_hidden"); + + b.HasIndex("SystemId") + .HasDatabaseName("ix_user_files_system_id"); + + b.ToTable("user_files", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.UserFileComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("creation_time_stamp"); + + b.Property("Ip") + .HasMaxLength(255) + .HasColumnType("citext") + .HasColumnName("ip"); + + b.Property("ParentId") + .HasColumnType("integer") + .HasColumnName("parent_id"); + + b.Property("Text") + .IsRequired() + .HasColumnType("citext") + .HasColumnName("text"); + + b.Property("Title") + .HasMaxLength(255) + .HasColumnType("citext") + .HasColumnName("title"); + + b.Property("UserFileId") + .HasColumnType("bigint") + .HasColumnName("user_file_id"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_user_file_comments"); + + b.HasIndex("ParentId") + .HasDatabaseName("ix_user_file_comments_parent_id"); + + b.HasIndex("UserFileId") + .HasDatabaseName("ix_user_file_comments_user_file_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_user_file_comments_user_id"); + + b.ToTable("user_file_comments", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.UserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("citext") + .HasColumnName("login_provider"); + + b.Property("ProviderKey") + .HasColumnType("citext") + .HasColumnName("provider_key"); + + b.Property("ProviderDisplayName") + .HasColumnType("citext") + .HasColumnName("provider_display_name"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("LoginProvider", "ProviderKey") + .HasName("pk_user_logins"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_user_logins_user_id"); + + b.ToTable("user_logins", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.UserMaintenanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EditorId") + .HasColumnType("integer") + .HasColumnName("editor_id"); + + b.Property("Log") + .IsRequired() + .HasColumnType("citext") + .HasColumnName("log"); + + b.Property("TimeStamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("time_stamp"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_user_maintenance_logs"); + + b.HasIndex("EditorId") + .HasDatabaseName("ix_user_maintenance_logs_editor_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_user_maintenance_logs_user_id"); + + b.ToTable("user_maintenance_logs", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.UserRole", b => + { + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.Property("RoleId") + .HasColumnType("integer") + .HasColumnName("role_id"); + + b.HasKey("UserId", "RoleId") + .HasName("pk_user_roles"); + + b.HasIndex("RoleId") + .HasDatabaseName("ix_user_roles_role_id"); + + b.ToTable("user_roles", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.UserToken", b => + { + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.Property("LoginProvider") + .HasColumnType("citext") + .HasColumnName("login_provider"); + + b.Property("Name") + .HasColumnType("citext") + .HasColumnName("name"); + + b.Property("Value") + .HasColumnType("citext") + .HasColumnName("value"); + + b.HasKey("UserId", "LoginProvider", "Name") + .HasName("pk_user_tokens"); + + b.ToTable("user_tokens", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.WikiPage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AuthorId") + .HasColumnType("integer") + .HasColumnName("author_id"); + + b.Property("ChildId") + .HasColumnType("integer") + .HasColumnName("child_id"); + + b.Property("CreateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("create_timestamp"); + + b.Property("CreateUserName") + .HasColumnType("citext") + .HasColumnName("create_user_name"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("LastUpdateTimestamp") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_update_timestamp"); + + b.Property("LastUpdateUserName") + .HasColumnType("citext") + .HasColumnName("last_update_user_name"); + + b.Property("Markup") + .IsRequired() + .HasColumnType("citext") + .HasColumnName("markup"); + + b.Property("MinorEdit") + .HasColumnType("boolean") + .HasColumnName("minor_edit"); + + b.Property("PageName") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("citext") + .HasColumnName("page_name"); + + b.Property("Revision") + .HasColumnType("integer") + .HasColumnName("revision"); + + b.Property("RevisionMessage") + .HasMaxLength(1000) + .HasColumnType("citext") + .HasColumnName("revision_message"); + + b.Property("SearchVector") + .IsRequired() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("tsvector") + .HasColumnName("search_vector") + .HasAnnotation("Npgsql:TsVectorConfig", "english") + .HasAnnotation("Npgsql:TsVectorProperties", new[] { "PageName", "Markup" }); + + b.HasKey("Id") + .HasName("pk_wiki_pages"); + + b.HasIndex("AuthorId") + .HasDatabaseName("ix_wiki_pages_author_id"); + + b.HasIndex("ChildId") + .HasDatabaseName("ix_wiki_pages_child_id"); + + b.HasIndex("Markup") + .HasDatabaseName("ix_wiki_pages_markup"); + + NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("Markup"), "gin"); + NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex("Markup"), new[] { "gin_trgm_ops" }); + + b.HasIndex("SearchVector") + .HasDatabaseName("ix_wiki_pages_search_vector"); + + NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); + + b.HasIndex("PageName", "Revision") + .IsUnique() + .HasDatabaseName("ix_wiki_pages_page_name_revision"); + + b.ToTable("wiki_pages", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.WikiPageReferral", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Excerpt") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("citext") + .HasColumnName("excerpt"); + + b.Property("Referral") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("citext") + .HasColumnName("referral"); + + b.Property("Referrer") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("citext") + .HasColumnName("referrer"); + + b.HasKey("Id") + .HasName("pk_wiki_referrals"); + + b.ToTable("wiki_referrals", (string)null); + }); + + modelBuilder.Entity("TASVideos.Data.CustomAutoHistory", b => + { + b.HasBaseType("Microsoft.EntityFrameworkCore.AutoHistory"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasDiscriminator().HasValue("CustomAutoHistory"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Awards.PublicationAward", b => + { + b.HasOne("TASVideos.Data.Entity.Awards.Award", "Award") + .WithMany() + .HasForeignKey("AwardId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_publication_awards_awards_award_id"); + + b.HasOne("TASVideos.Data.Entity.Publication", "Publication") + .WithMany("PublicationAwards") + .HasForeignKey("PublicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_publication_awards_publications_publication_id"); + + b.Navigation("Award"); + + b.Navigation("Publication"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Awards.UserAward", b => + { + b.HasOne("TASVideos.Data.Entity.Awards.Award", "Award") + .WithMany() + .HasForeignKey("AwardId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_user_awards_awards_award_id"); + + b.HasOne("TASVideos.Data.Entity.User", "User") + .WithMany("UserAwards") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_user_awards_users_user_id"); + + b.Navigation("Award"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Forum.Forum", b => + { + b.HasOne("TASVideos.Data.Entity.Forum.ForumCategory", "Category") + .WithMany("Forums") + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_forums_forum_categories_category_id"); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Forum.ForumPollOption", b => + { + b.HasOne("TASVideos.Data.Entity.Forum.ForumPoll", "Poll") + .WithMany("PollOptions") + .HasForeignKey("PollId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_forum_poll_options_forum_polls_poll_id"); + + b.Navigation("Poll"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Forum.ForumPollOptionVote", b => + { + b.HasOne("TASVideos.Data.Entity.Forum.ForumPollOption", "PollOption") + .WithMany("Votes") + .HasForeignKey("PollOptionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_forum_poll_option_votes_forum_poll_options_poll_option_id"); + + b.HasOne("TASVideos.Data.Entity.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_forum_poll_option_votes_users_user_id"); + + b.Navigation("PollOption"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Forum.ForumPost", b => + { + b.HasOne("TASVideos.Data.Entity.Forum.Forum", "Forum") + .WithMany("ForumPosts") + .HasForeignKey("ForumId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_forum_posts_forums_forum_id"); + + b.HasOne("TASVideos.Data.Entity.User", "Poster") + .WithMany("Posts") + .HasForeignKey("PosterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_forum_posts_users_poster_id"); + + b.HasOne("TASVideos.Data.Entity.Forum.ForumTopic", "Topic") + .WithMany("ForumPosts") + .HasForeignKey("TopicId") + .HasConstraintName("fk_forum_posts_forum_topics_topic_id"); + + b.Navigation("Forum"); + + b.Navigation("Poster"); + + b.Navigation("Topic"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Forum.ForumTopic", b => + { + b.HasOne("TASVideos.Data.Entity.Forum.Forum", "Forum") + .WithMany("ForumTopics") + .HasForeignKey("ForumId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_forum_topics_forums_forum_id"); + + b.HasOne("TASVideos.Data.Entity.Forum.ForumPoll", "Poll") + .WithOne("Topic") + .HasForeignKey("TASVideos.Data.Entity.Forum.ForumTopic", "PollId") + .HasConstraintName("fk_forum_topics_forum_polls_poll_id"); + + b.HasOne("TASVideos.Data.Entity.User", "Poster") + .WithMany("Topics") + .HasForeignKey("PosterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_forum_topics_users_poster_id"); + + b.HasOne("TASVideos.Data.Entity.Submission", "Submission") + .WithOne("Topic") + .HasForeignKey("TASVideos.Data.Entity.Forum.ForumTopic", "SubmissionId") + .HasConstraintName("fk_forum_topics_submissions_submission_id1"); + + b.Navigation("Forum"); + + b.Navigation("Poll"); + + b.Navigation("Poster"); + + b.Navigation("Submission"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Forum.ForumTopicWatch", b => + { + b.HasOne("TASVideos.Data.Entity.Forum.ForumTopic", "ForumTopic") + .WithMany("ForumTopicWatches") + .HasForeignKey("ForumTopicId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_forum_topic_watches_forum_topics_forum_topic_id"); + + b.HasOne("TASVideos.Data.Entity.User", "User") + .WithMany("ForumTopicWatches") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("fk_forum_topic_watches_users_user_id"); + + b.Navigation("ForumTopic"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Game.GameGameGroup", b => + { + b.HasOne("TASVideos.Data.Entity.Game.GameGroup", "GameGroup") + .WithMany("Games") + .HasForeignKey("GameGroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_game_game_groups_game_groups_game_group_id"); + + b.HasOne("TASVideos.Data.Entity.Game.Game", "Game") + .WithMany("GameGroups") + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_game_game_groups_games_game_id"); + + b.Navigation("Game"); + + b.Navigation("GameGroup"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Game.GameGenre", b => + { + b.HasOne("TASVideos.Data.Entity.Game.Game", "Game") + .WithMany("GameGenres") + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_game_genres_games_game_id"); + + b.HasOne("TASVideos.Data.Entity.Game.Genre", "Genre") + .WithMany("GameGenres") + .HasForeignKey("GenreId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_game_genres_genres_genre_id"); + + b.Navigation("Game"); + + b.Navigation("Genre"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Game.GameSystemFrameRate", b => + { + b.HasOne("TASVideos.Data.Entity.Game.GameSystem", "System") + .WithMany("SystemFrameRates") + .HasForeignKey("GameSystemId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("fk_game_system_frame_rates_game_systems_game_system_id"); + + b.Navigation("System"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Game.GameVersion", b => + { + b.HasOne("TASVideos.Data.Entity.Game.Game", "Game") + .WithMany("GameVersions") + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_game_versions_games_game_id"); + + b.HasOne("TASVideos.Data.Entity.Game.GameSystem", "System") + .WithMany("GameVersions") + .HasForeignKey("SystemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_game_versions_game_systems_system_id"); + + b.Navigation("Game"); + + b.Navigation("System"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.PrivateMessage", b => + { + b.HasOne("TASVideos.Data.Entity.User", "FromUser") + .WithMany("SentPrivateMessages") + .HasForeignKey("FromUserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("fk_private_messages_users_from_user_id"); + + b.HasOne("TASVideos.Data.Entity.User", "ToUser") + .WithMany("ReceivedPrivateMessages") + .HasForeignKey("ToUserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("fk_private_messages_users_to_user_id"); + + b.Navigation("FromUser"); + + b.Navigation("ToUser"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Publication", b => + { + b.HasOne("TASVideos.Data.Entity.Game.Game", "Game") + .WithMany("Publications") + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_publications_games_game_id"); + + b.HasOne("TASVideos.Data.Entity.Game.GameVersion", "GameVersion") + .WithMany("Publications") + .HasForeignKey("GameVersionId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("fk_publications_game_versions_game_version_id"); + + b.HasOne("TASVideos.Data.Entity.Publication", "ObsoletedBy") + .WithMany("ObsoletedMovies") + .HasForeignKey("ObsoletedById") + .OnDelete(DeleteBehavior.Restrict) + .HasConstraintName("fk_publications_publications_obsoleted_by_id"); + + b.HasOne("TASVideos.Data.Entity.PublicationClass", "PublicationClass") + .WithMany() + .HasForeignKey("PublicationClassId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_publications_publication_classes_publication_class_id"); + + b.HasOne("TASVideos.Data.Entity.Submission", "Submission") + .WithOne("Publication") + .HasForeignKey("TASVideos.Data.Entity.Publication", "SubmissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_publications_submissions_submission_id"); + + b.HasOne("TASVideos.Data.Entity.Game.GameSystemFrameRate", "SystemFrameRate") + .WithMany() + .HasForeignKey("SystemFrameRateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_publications_game_system_frame_rates_system_frame_rate_id"); + + b.HasOne("TASVideos.Data.Entity.Game.GameSystem", "System") + .WithMany("Publications") + .HasForeignKey("SystemId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("fk_publications_game_systems_system_id"); + + b.HasOne("TASVideos.Data.Entity.WikiPage", "WikiContent") + .WithMany() + .HasForeignKey("WikiContentId") + .HasConstraintName("fk_publications_wiki_pages_wiki_content_id"); + + b.Navigation("Game"); + + b.Navigation("GameVersion"); + + b.Navigation("ObsoletedBy"); + + b.Navigation("PublicationClass"); + + b.Navigation("Submission"); + + b.Navigation("System"); + + b.Navigation("SystemFrameRate"); + + b.Navigation("WikiContent"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.PublicationAuthor", b => + { + b.HasOne("TASVideos.Data.Entity.Publication", "Publication") + .WithMany("Authors") + .HasForeignKey("PublicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_publication_authors_publications_publication_id"); + + b.HasOne("TASVideos.Data.Entity.User", "Author") + .WithMany("Publications") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_publication_authors_users_user_id"); + + b.Navigation("Author"); + + b.Navigation("Publication"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.PublicationFile", b => + { + b.HasOne("TASVideos.Data.Entity.Publication", "Publication") + .WithMany("Files") + .HasForeignKey("PublicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_publication_files_publications_publication_id"); + + b.Navigation("Publication"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.PublicationFlag", b => + { + b.HasOne("TASVideos.Data.Entity.Flag", "Flag") + .WithMany() + .HasForeignKey("FlagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_publication_flags_flags_flag_id"); + + b.HasOne("TASVideos.Data.Entity.Publication", "Publication") + .WithMany("PublicationFlags") + .HasForeignKey("PublicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_publication_flags_publications_publication_id"); + + b.Navigation("Flag"); + + b.Navigation("Publication"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.PublicationMaintenanceLog", b => + { + b.HasOne("TASVideos.Data.Entity.Publication", "Publication") + .WithMany("PublicationMaintenanceLogs") + .HasForeignKey("PublicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_publication_maintenance_logs_publications_publication_id"); + + b.HasOne("TASVideos.Data.Entity.User", "User") + .WithMany("PublicationMaintenanceLogs") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_publication_maintenance_logs_users_user_id"); + + b.Navigation("Publication"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.PublicationRating", b => + { + b.HasOne("TASVideos.Data.Entity.Publication", "Publication") + .WithMany("PublicationRatings") + .HasForeignKey("PublicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_publication_ratings_publications_publication_id"); + + b.HasOne("TASVideos.Data.Entity.User", "User") + .WithMany("PublicationRatings") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_publication_ratings_users_user_id"); + + b.Navigation("Publication"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.PublicationTag", b => + { + b.HasOne("TASVideos.Data.Entity.Publication", "Publication") + .WithMany("PublicationTags") + .HasForeignKey("PublicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_publication_tags_publications_publication_id"); + + b.HasOne("TASVideos.Data.Entity.Tag", "Tag") + .WithMany("PublicationTags") + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_publication_tags_tags_tag_id"); + + b.Navigation("Publication"); + + b.Navigation("Tag"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.PublicationUrl", b => + { + b.HasOne("TASVideos.Data.Entity.Publication", "Publication") + .WithMany("PublicationUrls") + .HasForeignKey("PublicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_publication_urls_publications_publication_id"); + + b.Navigation("Publication"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.RoleLink", b => + { + b.HasOne("TASVideos.Data.Entity.Role", "Role") + .WithMany("RoleLinks") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_role_links_roles_role_id"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.RolePermission", b => + { + b.HasOne("TASVideos.Data.Entity.Role", "Role") + .WithMany("RolePermission") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_role_permission_roles_role_id"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Submission", b => + { + b.HasOne("TASVideos.Data.Entity.Game.Game", "Game") + .WithMany("Submissions") + .HasForeignKey("GameId") + .HasConstraintName("fk_submissions_games_game_id"); + + b.HasOne("TASVideos.Data.Entity.Game.GameVersion", "GameVersion") + .WithMany("Submissions") + .HasForeignKey("GameVersionId") + .HasConstraintName("fk_submissions_game_versions_game_version_id"); + + b.HasOne("TASVideos.Data.Entity.PublicationClass", "IntendedClass") + .WithMany() + .HasForeignKey("IntendedClassId") + .HasConstraintName("fk_submissions_publication_classes_intended_class_id"); + + b.HasOne("TASVideos.Data.Entity.User", "Judge") + .WithMany() + .HasForeignKey("JudgeId") + .HasConstraintName("fk_submissions_users_judge_id"); + + b.HasOne("TASVideos.Data.Entity.User", "Publisher") + .WithMany() + .HasForeignKey("PublisherId") + .HasConstraintName("fk_submissions_users_publisher_id"); + + b.HasOne("TASVideos.Data.Entity.SubmissionRejectionReason", "RejectionReason") + .WithMany("Submissions") + .HasForeignKey("RejectionReasonId") + .HasConstraintName("fk_submissions_submission_rejection_reasons_rejection_reason_id"); + + b.HasOne("TASVideos.Data.Entity.User", "Submitter") + .WithMany() + .HasForeignKey("SubmitterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_submissions_users_submitter_id"); + + b.HasOne("TASVideos.Data.Entity.Game.GameSystemFrameRate", "SystemFrameRate") + .WithMany() + .HasForeignKey("SystemFrameRateId") + .HasConstraintName("fk_submissions_game_system_frame_rates_system_frame_rate_id"); + + b.HasOne("TASVideos.Data.Entity.Game.GameSystem", "System") + .WithMany("Submissions") + .HasForeignKey("SystemId") + .HasConstraintName("fk_submissions_game_systems_system_id"); + + b.HasOne("TASVideos.Data.Entity.WikiPage", "WikiContent") + .WithMany() + .HasForeignKey("WikiContentId") + .HasConstraintName("fk_submissions_wiki_pages_wiki_content_id"); + + b.Navigation("Game"); + + b.Navigation("GameVersion"); + + b.Navigation("IntendedClass"); + + b.Navigation("Judge"); + + b.Navigation("Publisher"); + + b.Navigation("RejectionReason"); + + b.Navigation("Submitter"); + + b.Navigation("System"); + + b.Navigation("SystemFrameRate"); + + b.Navigation("WikiContent"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.SubmissionAuthor", b => + { + b.HasOne("TASVideos.Data.Entity.Submission", "Submission") + .WithMany("SubmissionAuthors") + .HasForeignKey("SubmissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_submission_authors_submissions_submission_id"); + + b.HasOne("TASVideos.Data.Entity.User", "Author") + .WithMany("Submissions") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_submission_authors_users_user_id"); + + b.Navigation("Author"); + + b.Navigation("Submission"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.SubmissionStatusHistory", b => + { + b.HasOne("TASVideos.Data.Entity.Submission", "Submission") + .WithMany("History") + .HasForeignKey("SubmissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_submission_status_history_submissions_submission_id"); + + b.Navigation("Submission"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.UserFile", b => + { + b.HasOne("TASVideos.Data.Entity.User", "Author") + .WithMany("UserFiles") + .HasForeignKey("AuthorId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("fk_user_files_users_author_id"); + + b.HasOne("TASVideos.Data.Entity.Game.Game", "Game") + .WithMany("UserFiles") + .HasForeignKey("GameId") + .HasConstraintName("fk_user_files_games_game_id"); + + b.HasOne("TASVideos.Data.Entity.Game.GameSystem", "System") + .WithMany() + .HasForeignKey("SystemId") + .HasConstraintName("fk_user_files_game_systems_system_id"); + + b.Navigation("Author"); + + b.Navigation("Game"); + + b.Navigation("System"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.UserFileComment", b => + { + b.HasOne("TASVideos.Data.Entity.UserFileComment", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId") + .HasConstraintName("fk_user_file_comments_user_file_comments_parent_id"); + + b.HasOne("TASVideos.Data.Entity.UserFile", "UserFile") + .WithMany("Comments") + .HasForeignKey("UserFileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_user_file_comments_user_files_user_file_id"); + + b.HasOne("TASVideos.Data.Entity.User", "User") + .WithMany("UserFileComments") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("fk_user_file_comments_users_user_id"); + + b.Navigation("Parent"); + + b.Navigation("User"); + + b.Navigation("UserFile"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.UserMaintenanceLog", b => + { + b.HasOne("TASVideos.Data.Entity.User", "Editor") + .WithMany("EditMaintenanceLogs") + .HasForeignKey("EditorId") + .HasConstraintName("fk_user_maintenance_logs_users_editor_id"); + + b.HasOne("TASVideos.Data.Entity.User", "User") + .WithMany("UserMaintenanceLogs") + .HasForeignKey("UserId") + .HasConstraintName("fk_user_maintenance_logs_users_user_id"); + + b.Navigation("Editor"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.UserRole", b => + { + b.HasOne("TASVideos.Data.Entity.Role", "Role") + .WithMany("UserRole") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_user_roles_roles_role_id"); + + b.HasOne("TASVideos.Data.Entity.User", "User") + .WithMany("UserRoles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_user_roles_users_user_id"); + + b.Navigation("Role"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.WikiPage", b => + { + b.HasOne("TASVideos.Data.Entity.User", "Author") + .WithMany("WikiRevisions") + .HasForeignKey("AuthorId") + .HasConstraintName("fk_wiki_pages_users_author_id"); + + b.HasOne("TASVideos.Data.Entity.WikiPage", "Child") + .WithMany() + .HasForeignKey("ChildId") + .HasConstraintName("fk_wiki_pages_wiki_pages_child_id"); + + b.Navigation("Author"); + + b.Navigation("Child"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Forum.Forum", b => + { + b.Navigation("ForumPosts"); + + b.Navigation("ForumTopics"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Forum.ForumCategory", b => + { + b.Navigation("Forums"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Forum.ForumPoll", b => + { + b.Navigation("PollOptions"); + + b.Navigation("Topic"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Forum.ForumPollOption", b => + { + b.Navigation("Votes"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Forum.ForumTopic", b => + { + b.Navigation("ForumPosts"); + + b.Navigation("ForumTopicWatches"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Game.Game", b => + { + b.Navigation("GameGenres"); + + b.Navigation("GameGroups"); + + b.Navigation("GameVersions"); + + b.Navigation("Publications"); + + b.Navigation("Submissions"); + + b.Navigation("UserFiles"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Game.GameGroup", b => + { + b.Navigation("Games"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Game.GameSystem", b => + { + b.Navigation("GameVersions"); + + b.Navigation("Publications"); + + b.Navigation("Submissions"); + + b.Navigation("SystemFrameRates"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Game.GameVersion", b => + { + b.Navigation("Publications"); + + b.Navigation("Submissions"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Game.Genre", b => + { + b.Navigation("GameGenres"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Publication", b => + { + b.Navigation("Authors"); + + b.Navigation("Files"); + + b.Navigation("ObsoletedMovies"); + + b.Navigation("PublicationAwards"); + + b.Navigation("PublicationFlags"); + + b.Navigation("PublicationMaintenanceLogs"); + + b.Navigation("PublicationRatings"); + + b.Navigation("PublicationTags"); + + b.Navigation("PublicationUrls"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Role", b => + { + b.Navigation("RoleLinks"); + + b.Navigation("RolePermission"); + + b.Navigation("UserRole"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Submission", b => + { + b.Navigation("History"); + + b.Navigation("Publication"); + + b.Navigation("SubmissionAuthors"); + + b.Navigation("Topic"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.SubmissionRejectionReason", b => + { + b.Navigation("Submissions"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.Tag", b => + { + b.Navigation("PublicationTags"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.User", b => + { + b.Navigation("EditMaintenanceLogs"); + + b.Navigation("ForumTopicWatches"); + + b.Navigation("Posts"); + + b.Navigation("PublicationMaintenanceLogs"); + + b.Navigation("PublicationRatings"); + + b.Navigation("Publications"); + + b.Navigation("ReceivedPrivateMessages"); + + b.Navigation("SentPrivateMessages"); + + b.Navigation("Submissions"); + + b.Navigation("Topics"); + + b.Navigation("UserAwards"); + + b.Navigation("UserFileComments"); + + b.Navigation("UserFiles"); + + b.Navigation("UserMaintenanceLogs"); + + b.Navigation("UserRoles"); + + b.Navigation("WikiRevisions"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.UserFile", b => + { + b.Navigation("Comments"); + }); + + modelBuilder.Entity("TASVideos.Data.Entity.UserFileComment", b => + { + b.Navigation("Children"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/TASVideos.Data/Migrations/20220728191447_AddAutoHistory.cs b/TASVideos.Data/Migrations/20220728191447_AddAutoHistory.cs new file mode 100644 index 000000000..b5a091345 --- /dev/null +++ b/TASVideos.Data/Migrations/20220728191447_AddAutoHistory.cs @@ -0,0 +1,38 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace TASVideos.Data.Migrations; + +public partial class AddAutoHistory : Migration +{ + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "auto_history", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + row_id = table.Column(type: "citext", maxLength: 50, nullable: false), + table_name = table.Column(type: "citext", maxLength: 128, nullable: false), + changed = table.Column(type: "citext", nullable: true), + kind = table.Column(type: "integer", nullable: false), + created = table.Column(type: "timestamp without time zone", nullable: false), + discriminator = table.Column(type: "text", nullable: false), + user_id = table.Column(type: "integer", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_auto_history", x => x.id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "auto_history"); + } +} diff --git a/TASVideos.Data/Migrations/ApplicationDbContextModelSnapshot.cs b/TASVideos.Data/Migrations/ApplicationDbContextModelSnapshot.cs index df62c9505..b35b48e65 100644 --- a/TASVideos.Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/TASVideos.Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -26,6 +26,52 @@ protected override void BuildModel(ModelBuilder modelBuilder) NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "pg_trgm"); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + modelBuilder.Entity("Microsoft.EntityFrameworkCore.AutoHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Changed") + .HasColumnType("citext") + .HasColumnName("changed"); + + b.Property("Created") + .HasColumnType("timestamp without time zone") + .HasColumnName("created"); + + b.Property("Discriminator") + .IsRequired() + .HasColumnType("text") + .HasColumnName("discriminator"); + + b.Property("Kind") + .HasColumnType("integer") + .HasColumnName("kind"); + + b.Property("RowId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("citext") + .HasColumnName("row_id"); + + b.Property("TableName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("citext") + .HasColumnName("table_name"); + + b.HasKey("Id") + .HasName("pk_auto_history"); + + b.ToTable("auto_history", (string)null); + + b.HasDiscriminator("Discriminator").HasValue("AutoHistory"); + }); + modelBuilder.Entity("TASVideos.Data.Entity.Awards.Award", b => { b.Property("Id") @@ -2688,6 +2734,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("wiki_referrals", (string)null); }); + modelBuilder.Entity("TASVideos.Data.CustomAutoHistory", b => + { + b.HasBaseType("Microsoft.EntityFrameworkCore.AutoHistory"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasDiscriminator().HasValue("CustomAutoHistory"); + }); + modelBuilder.Entity("TASVideos.Data.Entity.Awards.PublicationAward", b => { b.HasOne("TASVideos.Data.Entity.Awards.Award", "Award")