From f02ab0e23a6b455dbc3f9275e21cba685d86a3ab Mon Sep 17 00:00:00 2001 From: Kirk Brauer Date: Sat, 26 Nov 2022 00:10:40 -0600 Subject: [PATCH] Add models and initial migration for database (#24) * Add models and initial migration for database * AddDbContext before builder.Build() * Cleanup proj file Co-authored-by: Brendan Enrick <2243498+benrick@users.noreply.github.com> --- .config/dotnet-tools.json | 12 + Directory.Packages.props | 5 + README.md | 25 + Smilodon.sln | 9 +- src/ActivityPub.Domain/Accounts/Account.cs | 32 +- .../Domain.csproj} | 2 +- src/Domain/Models/Account.cs | 117 + src/Domain/Models/AccountAlias.cs | 14 + src/Domain/Models/AccountConversation.cs | 17 + src/Domain/Models/AccountDeletionRequest.cs | 12 + src/Domain/Models/AccountDomainBlock.cs | 13 + src/Domain/Models/AccountMigration.cs | 16 + src/Domain/Models/AccountModerationNote.cs | 15 + src/Domain/Models/AccountNote.cs | 15 + src/Domain/Models/AccountPin.cs | 14 + src/Domain/Models/AccountStat.cs | 16 + .../Models/AccountStatusesCleanupPolicy.cs | 22 + src/Domain/Models/AccountSummary.cs | 9 + src/Domain/Models/AccountTag.cs | 8 + src/Domain/Models/AccountWarning.cs | 21 + src/Domain/Models/AccountWarningPreset.cs | 11 + src/Domain/Models/AdminActionLog.cs | 18 + src/Domain/Models/Announcement.cs | 20 + src/Domain/Models/AnnouncementMute.cs | 14 + src/Domain/Models/AnnouncementReaction.cs | 17 + src/Domain/Models/Appeal.cs | 21 + src/Domain/Models/ArInternalMetadatum.cs | 10 + src/Domain/Models/Backup.cs | 17 + src/Domain/Models/Block.cs | 15 + src/Domain/Models/Bookmark.cs | 14 + src/Domain/Models/CanonicalEmailBlock.cs | 13 + src/Domain/Models/Conversation.cs | 13 + src/Domain/Models/ConversationMute.cs | 12 + src/Domain/Models/CustomEmoji.cs | 23 + src/Domain/Models/CustomEmojiCategory.cs | 10 + src/Domain/Models/CustomFilter.cs | 18 + src/Domain/Models/CustomFilterKeyword.cs | 14 + src/Domain/Models/CustomFilterStatus.cs | 14 + src/Domain/Models/Device.cs | 20 + src/Domain/Models/DomainAllow.cs | 10 + src/Domain/Models/DomainBlock.cs | 16 + src/Domain/Models/EmailDomainBlock.cs | 14 + src/Domain/Models/EncryptedMessage.cs | 19 + src/Domain/Models/Favourite.cs | 14 + src/Domain/Models/FeaturedTag.cs | 17 + src/Domain/Models/Follow.cs | 19 + src/Domain/Models/FollowRecommendation.cs | 9 + .../Models/FollowRecommendationSuppression.cs | 12 + src/Domain/Models/FollowRequest.cs | 18 + src/Domain/Models/Identity.cs | 14 + src/Domain/Models/Import.cs | 19 + src/Domain/Models/Instance.cs | 8 + src/Domain/Models/Invite.cs | 19 + src/Domain/Models/IpBlock.cs | 15 + src/Domain/Models/List.cs | 15 + src/Domain/Models/ListAccount.cs | 14 + src/Domain/Models/LoginActivity.cs | 19 + src/Domain/Models/Marker.cs | 15 + src/Domain/Models/MediaAttachment.cs | 33 + src/Domain/Models/Mention.cs | 15 + src/Domain/Models/Mute.cs | 16 + src/Domain/Models/Notification.cs | 17 + src/Domain/Models/OAuthAccessGrant.cs | 18 + src/Domain/Models/OAuthAccessToken.cs | 25 + src/Domain/Models/OAuthApplication.cs | 24 + src/Domain/Models/OneTimeKey.cs | 15 + src/Domain/Models/PgheroSpaceStat.cs | 12 + src/Domain/Models/Poll.cs | 24 + src/Domain/Models/PollVote.cs | 16 + src/Domain/Models/PreviewCard.cs | 34 + src/Domain/Models/PreviewCardProvider.cs | 17 + src/Domain/Models/PreviewCardStatus.cs | 8 + src/Domain/Models/PreviewCardTrend.cs | 14 + src/Domain/Models/Relay.cs | 12 + src/Domain/Models/Report.cs | 27 + src/Domain/Models/ReportNote.cs | 15 + src/Domain/Models/Rule.cs | 12 + src/Domain/Models/ScheduledStatus.cs | 13 + src/Domain/Models/SessionActivation.cs | 20 + src/Domain/Models/Setting.cs | 13 + src/Domain/Models/SiteUpload.cs | 16 + src/Domain/Models/Status.cs | 46 + src/Domain/Models/StatusEdit.cs | 20 + src/Domain/Models/StatusPin.cs | 14 + src/Domain/Models/StatusStat.cs | 15 + src/Domain/Models/StatusTag.cs | 11 + src/Domain/Models/StatusTrend.cs | 16 + src/Domain/Models/SystemKey.cs | 10 + src/Domain/Models/Tag.cs | 22 + src/Domain/Models/TagFollow.cs | 14 + src/Domain/Models/Tombstone.cs | 14 + src/Domain/Models/UnavailableDomain.cs | 10 + src/Domain/Models/User.cs | 62 + src/Domain/Models/UserInviteRequest.cs | 13 + src/Domain/Models/UserIp.cs | 11 + src/Domain/Models/UserRole.cs | 16 + src/Domain/Models/WebAuthnCredential.cs | 16 + src/Domain/Models/WebPushSubscription.cs | 18 + src/Domain/Models/WebSetting.cs | 13 + src/Domain/Models/Webhook.cs | 13 + src/Infrastructure/Infrastructure.csproj | 24 + .../AccountAliasEntityConfiguration.cs | 45 + .../AccountConversationEntityConfiguration.cs | 54 + ...countDeletionRequestEntityConfiguration.cs | 35 + .../AccountDomainBlockEntityConfiguration.cs | 41 + .../AccountEntityConfiguration.cs | 198 + .../AccountMigrationEntityConfiguration.cs | 54 + ...ccountModerationNoteEntityConfiguration.cs | 47 + .../AccountNoteEntityConfiguration.cs | 49 + .../AccountPinEntityConfiguration.cs | 47 + .../AccountStatEntityConfiguration.cs | 46 + ...tatusesCleanupPolicyEntityConfiguration.cs | 71 + .../AccountSummaryEntityConfiguration.cs | 23 + .../AccountTagEntityConfiguration.cs | 26 + .../AccountWarningEntityConfiguration.cs | 67 + ...AccountWarningPresetEntityConfiguration.cs | 34 + .../AdminActionLogEntityConfiguration.cs | 61 + .../AnnouncementEntityConfiguration.cs | 51 + .../AnnouncementMuteEntityConfiguration.cs | 48 + ...AnnouncementReactionEntityConfiguration.cs | 64 + .../AppealEntityConfiguration.cs | 81 + .../ArInternalMetadatumEntityConfiguration.cs | 32 + .../BackupsEntityConfiguration.cs | 49 + .../Configuration/BlockEntityConfiguration.cs | 49 + .../BookmarkEntityConfiguration.cs | 45 + .../CanonicalEmailBlockEntityConfiguration.cs | 45 + .../ConversationEntityConfiguration.cs | 35 + .../ConversationMuteEntityConfiguration.cs | 35 + .../CustomEmojiCategoryEntityConfiguration.cs | 33 + .../CustomEmojiEntityConfiguration.cs | 71 + .../CustomFilterEntityConfiguration.cs | 50 + .../CustomFilterKeywordEntityConfiguration.cs | 44 + .../CustomFilterStatusEntityConfiguration.cs | 45 + .../DeviceEntityConfiguration.cs | 63 + .../DomainAllowEntityConfiguration.cs | 34 + .../DomainBlockEntityConfiguration.cs | 48 + .../EmailDomainBlockEntityConfiguration.cs | 42 + .../EncryptedMessageEntityConfiguration.cs | 66 + .../FavouriteEntityConfiguration.cs | 48 + .../FeaturedTagEntityConfiguration.cs | 55 + .../FollowEntityConfiguration.cs | 60 + ...FollowRecommendationEntityConfiguration.cs | 21 + ...mendationSuppressionEntityConfiguration.cs | 37 + .../FollowRequestEntityConfiguration.cs | 58 + .../IdentityEntityConfiguration.cs | 45 + .../ImportEntityConfiguration.cs | 52 + .../InstanceEntityConfiguration.cs | 21 + .../InviteEntityConfiguration.cs | 55 + .../IpBlockEntityConfiguration.cs | 43 + .../ListAccountEntityConfiguration.cs | 50 + .../Configuration/ListEntityConfiguration.cs | 41 + .../LoginActivityEntityConfiguration.cs | 50 + .../MarkerEntityConfiguration.cs | 46 + .../MediaAttachmentEntityConfiguration.cs | 124 + .../MentionEntityConfiguration.cs | 49 + .../Configuration/MuteEntityConfiguration.cs | 54 + .../NotificationEntityConfiguration.cs | 58 + .../OAuthAccessGrantEntityConfiguration.cs | 57 + .../OAuthAccessTokenEntityConfiguration.cs | 75 + .../OAuthApplicationEntityConfiguration.cs | 74 + .../OneTimeKeyEntityConfiguration.cs | 50 + .../PgheroSpaceStatEntityConfiguration.cs | 32 + .../Configuration/PollEntityConfiguration.cs | 72 + .../PollVoteEntityConfiguration.cs | 51 + .../PreviewCardEntityConfiguration.cs | 113 + .../PreviewCardProviderEntityConfiguration.cs | 58 + .../PreviewCardStatusEntityConfiguration.cs | 22 + .../PreviewCardTrendEntityConfiguration.cs | 38 + .../Configuration/RelayEntityConfiguration.cs | 36 + .../ReportEntityConfiguration.cs | 89 + .../ReportNoteEntityConfiguration.cs | 45 + .../Configuration/RuleEntityConfiguration.cs | 35 + .../ScheduledStatusEntityConfiguration.cs | 37 + .../SessionActivationEntityConfiguration.cs | 61 + .../SettingEntityConfiguration.cs | 41 + .../SiteUploadEntityConfiguration.cs | 56 + .../StatusEditEntityConfiguration.cs | 62 + .../StatusEntityConfiguration.cs | 144 + .../StatusPinEntityConfiguration.cs | 47 + .../StatusStatEntityConfiguration.cs | 42 + .../StatusTagEntityConfiguration.cs | 35 + .../StatusTrendEntityConfiguration.cs | 47 + .../SystemKeyEntityConfiguration.cs | 27 + .../Configuration/TagEntityConfiguration.cs | 58 + .../TagFollowEntityConfiguration.cs | 45 + .../TombstoneEntityConfiguration.cs | 43 + .../UnavailableDomainEntityConfiguration.cs | 34 + .../Configuration/UserEntityConfiguration.cs | 183 + .../UserInviteRequestEntityConfiguration.cs | 37 + .../UserIpEntityConfiguration.cs | 23 + .../UserRoleEntityConfiguration.cs | 41 + .../WebAuthnCredentialEntityConfiguration.cs | 52 + .../WebPushSubscriptionEntityConfiguration.cs | 63 + .../WebSettingEntityConfiguration.cs | 40 + .../WebhookEntityConfiguration.cs | 48 + .../20221125033633_InitialCreate.Designer.cs | 6496 +++++++++++++++++ .../20221125033633_InitialCreate.cs | 3835 ++++++++++ .../SmilodonDbContextModelSnapshot.cs | 6493 ++++++++++++++++ .../Persistence/SmilodonDbContext.cs | 127 + .../Persistence/SmilodonDbContextFactory.cs | 26 + src/WebApp/Models/Actor.cs | 6 +- src/WebApp/Models/WebFinger.cs | 6 + src/WebApp/Program.cs | 9 + src/WebApp/WebApp.csproj | 5 + 204 files changed, 23765 insertions(+), 14 deletions(-) create mode 100644 .config/dotnet-tools.json rename src/{Infrastructure.Database/Infrastructure.Database.csproj => Domain/Domain.csproj} (78%) create mode 100644 src/Domain/Models/Account.cs create mode 100644 src/Domain/Models/AccountAlias.cs create mode 100644 src/Domain/Models/AccountConversation.cs create mode 100644 src/Domain/Models/AccountDeletionRequest.cs create mode 100644 src/Domain/Models/AccountDomainBlock.cs create mode 100644 src/Domain/Models/AccountMigration.cs create mode 100644 src/Domain/Models/AccountModerationNote.cs create mode 100644 src/Domain/Models/AccountNote.cs create mode 100644 src/Domain/Models/AccountPin.cs create mode 100644 src/Domain/Models/AccountStat.cs create mode 100644 src/Domain/Models/AccountStatusesCleanupPolicy.cs create mode 100644 src/Domain/Models/AccountSummary.cs create mode 100644 src/Domain/Models/AccountTag.cs create mode 100644 src/Domain/Models/AccountWarning.cs create mode 100644 src/Domain/Models/AccountWarningPreset.cs create mode 100644 src/Domain/Models/AdminActionLog.cs create mode 100644 src/Domain/Models/Announcement.cs create mode 100644 src/Domain/Models/AnnouncementMute.cs create mode 100644 src/Domain/Models/AnnouncementReaction.cs create mode 100644 src/Domain/Models/Appeal.cs create mode 100644 src/Domain/Models/ArInternalMetadatum.cs create mode 100644 src/Domain/Models/Backup.cs create mode 100644 src/Domain/Models/Block.cs create mode 100644 src/Domain/Models/Bookmark.cs create mode 100644 src/Domain/Models/CanonicalEmailBlock.cs create mode 100644 src/Domain/Models/Conversation.cs create mode 100644 src/Domain/Models/ConversationMute.cs create mode 100644 src/Domain/Models/CustomEmoji.cs create mode 100644 src/Domain/Models/CustomEmojiCategory.cs create mode 100644 src/Domain/Models/CustomFilter.cs create mode 100644 src/Domain/Models/CustomFilterKeyword.cs create mode 100644 src/Domain/Models/CustomFilterStatus.cs create mode 100644 src/Domain/Models/Device.cs create mode 100644 src/Domain/Models/DomainAllow.cs create mode 100644 src/Domain/Models/DomainBlock.cs create mode 100644 src/Domain/Models/EmailDomainBlock.cs create mode 100644 src/Domain/Models/EncryptedMessage.cs create mode 100644 src/Domain/Models/Favourite.cs create mode 100644 src/Domain/Models/FeaturedTag.cs create mode 100644 src/Domain/Models/Follow.cs create mode 100644 src/Domain/Models/FollowRecommendation.cs create mode 100644 src/Domain/Models/FollowRecommendationSuppression.cs create mode 100644 src/Domain/Models/FollowRequest.cs create mode 100644 src/Domain/Models/Identity.cs create mode 100644 src/Domain/Models/Import.cs create mode 100644 src/Domain/Models/Instance.cs create mode 100644 src/Domain/Models/Invite.cs create mode 100644 src/Domain/Models/IpBlock.cs create mode 100644 src/Domain/Models/List.cs create mode 100644 src/Domain/Models/ListAccount.cs create mode 100644 src/Domain/Models/LoginActivity.cs create mode 100644 src/Domain/Models/Marker.cs create mode 100644 src/Domain/Models/MediaAttachment.cs create mode 100644 src/Domain/Models/Mention.cs create mode 100644 src/Domain/Models/Mute.cs create mode 100644 src/Domain/Models/Notification.cs create mode 100644 src/Domain/Models/OAuthAccessGrant.cs create mode 100644 src/Domain/Models/OAuthAccessToken.cs create mode 100644 src/Domain/Models/OAuthApplication.cs create mode 100644 src/Domain/Models/OneTimeKey.cs create mode 100644 src/Domain/Models/PgheroSpaceStat.cs create mode 100644 src/Domain/Models/Poll.cs create mode 100644 src/Domain/Models/PollVote.cs create mode 100644 src/Domain/Models/PreviewCard.cs create mode 100644 src/Domain/Models/PreviewCardProvider.cs create mode 100644 src/Domain/Models/PreviewCardStatus.cs create mode 100644 src/Domain/Models/PreviewCardTrend.cs create mode 100644 src/Domain/Models/Relay.cs create mode 100644 src/Domain/Models/Report.cs create mode 100644 src/Domain/Models/ReportNote.cs create mode 100644 src/Domain/Models/Rule.cs create mode 100644 src/Domain/Models/ScheduledStatus.cs create mode 100644 src/Domain/Models/SessionActivation.cs create mode 100644 src/Domain/Models/Setting.cs create mode 100644 src/Domain/Models/SiteUpload.cs create mode 100644 src/Domain/Models/Status.cs create mode 100644 src/Domain/Models/StatusEdit.cs create mode 100644 src/Domain/Models/StatusPin.cs create mode 100644 src/Domain/Models/StatusStat.cs create mode 100644 src/Domain/Models/StatusTag.cs create mode 100644 src/Domain/Models/StatusTrend.cs create mode 100644 src/Domain/Models/SystemKey.cs create mode 100644 src/Domain/Models/Tag.cs create mode 100644 src/Domain/Models/TagFollow.cs create mode 100644 src/Domain/Models/Tombstone.cs create mode 100644 src/Domain/Models/UnavailableDomain.cs create mode 100644 src/Domain/Models/User.cs create mode 100644 src/Domain/Models/UserInviteRequest.cs create mode 100644 src/Domain/Models/UserIp.cs create mode 100644 src/Domain/Models/UserRole.cs create mode 100644 src/Domain/Models/WebAuthnCredential.cs create mode 100644 src/Domain/Models/WebPushSubscription.cs create mode 100644 src/Domain/Models/WebSetting.cs create mode 100644 src/Domain/Models/Webhook.cs create mode 100644 src/Infrastructure/Infrastructure.csproj create mode 100644 src/Infrastructure/Persistence/Configuration/AccountAliasEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/AccountConversationEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/AccountDeletionRequestEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/AccountDomainBlockEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/AccountEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/AccountMigrationEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/AccountModerationNoteEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/AccountNoteEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/AccountPinEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/AccountStatEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/AccountStatusesCleanupPolicyEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/AccountSummaryEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/AccountTagEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/AccountWarningEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/AccountWarningPresetEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/AdminActionLogEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/AnnouncementEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/AnnouncementMuteEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/AnnouncementReactionEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/AppealEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/ArInternalMetadatumEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/BackupsEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/BlockEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/BookmarkEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/CanonicalEmailBlockEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/ConversationEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/ConversationMuteEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/CustomEmojiCategoryEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/CustomEmojiEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/CustomFilterEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/CustomFilterKeywordEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/CustomFilterStatusEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/DeviceEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/DomainAllowEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/DomainBlockEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/EmailDomainBlockEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/EncryptedMessageEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/FavouriteEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/FeaturedTagEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/FollowEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/FollowRecommendationEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/FollowRecommendationSuppressionEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/FollowRequestEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/IdentityEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/ImportEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/InstanceEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/InviteEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/IpBlockEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/ListAccountEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/ListEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/LoginActivityEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/MarkerEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/MediaAttachmentEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/MentionEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/MuteEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/NotificationEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/OAuthAccessGrantEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/OAuthAccessTokenEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/OAuthApplicationEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/OneTimeKeyEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/PgheroSpaceStatEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/PollEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/PollVoteEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/PreviewCardEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/PreviewCardProviderEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/PreviewCardStatusEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/PreviewCardTrendEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/RelayEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/ReportEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/ReportNoteEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/RuleEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/ScheduledStatusEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/SessionActivationEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/SettingEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/SiteUploadEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/StatusEditEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/StatusEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/StatusPinEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/StatusStatEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/StatusTagEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/StatusTrendEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/SystemKeyEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/TagEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/TagFollowEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/TombstoneEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/UnavailableDomainEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/UserEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/UserInviteRequestEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/UserIpEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/UserRoleEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/WebAuthnCredentialEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/WebPushSubscriptionEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/WebSettingEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configuration/WebhookEntityConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Migrations/20221125033633_InitialCreate.Designer.cs create mode 100644 src/Infrastructure/Persistence/Migrations/20221125033633_InitialCreate.cs create mode 100644 src/Infrastructure/Persistence/Migrations/SmilodonDbContextModelSnapshot.cs create mode 100644 src/Infrastructure/Persistence/SmilodonDbContext.cs create mode 100644 src/Infrastructure/Persistence/SmilodonDbContextFactory.cs create mode 100644 src/WebApp/Models/WebFinger.cs diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..fccc806 --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-ef": { + "version": "7.0.0", + "commands": [ + "dotnet-ef" + ] + } + } +} \ No newline at end of file diff --git a/Directory.Packages.props b/Directory.Packages.props index 2cdcd7a..831cb14 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -2,6 +2,11 @@ true + + + + + diff --git a/README.md b/README.md index 4dfedd1..8992c29 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,31 @@ To run the WebApp, you can navigate to the `\WebApp` folder from your preferred dotnet run watch ``` +### Using Entity Framework Core + +#### 1. Install EF Core CLI tool +```bash +dotnet tool restore +``` + +#### 2. Create a local database user for smilodon +```postgresql +CREATE USER smilodon WITH PASSWORD 'smilodon' CREATEDB; +CREATE DATABASE smilodon; +``` + +#### 3. Initialize your local database +```bash +cd ./src/Infrastructure/Persistence +dotnet ef database update +``` + +#### Creating a migration +```bash +cd ./src/Infrastructure/Persistence +dotnet ef migrations add +``` + ## Project Documentation For information about the project, see the [Smilodon Documentation](https://devchatter.github.io/Smilodon) diff --git a/Smilodon.sln b/Smilodon.sln index 5ba0a86..ce10310 100644 --- a/Smilodon.sln +++ b/Smilodon.sln @@ -11,10 +11,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{9EC4E573-0 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApp.Test", "test\WebApp.Test\WebApp.Test.csproj", "{972B3171-DDE1-4CF8-863E-B45875440A80}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infrastructure.Database", "src\Infrastructure.Database\Infrastructure.Database.csproj", "{5D89CB6E-02DA-483F-B0CA-03E235EA795B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infrastructure", "src\Infrastructure\Infrastructure.csproj", "{5D89CB6E-02DA-483F-B0CA-03E235EA795B}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ActivityPub.Domain", "src\ActivityPub.Domain\ActivityPub.Domain.csproj", "{5538990A-29DE-448B-A5F3-30266AA66C17}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Domain", "src\Domain\Domain.csproj", "{46FC91AA-B4F6-4339-A414-5126474048C6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -37,6 +39,10 @@ Global {5538990A-29DE-448B-A5F3-30266AA66C17}.Debug|Any CPU.Build.0 = Debug|Any CPU {5538990A-29DE-448B-A5F3-30266AA66C17}.Release|Any CPU.ActiveCfg = Release|Any CPU {5538990A-29DE-448B-A5F3-30266AA66C17}.Release|Any CPU.Build.0 = Release|Any CPU + {46FC91AA-B4F6-4339-A414-5126474048C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {46FC91AA-B4F6-4339-A414-5126474048C6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {46FC91AA-B4F6-4339-A414-5126474048C6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {46FC91AA-B4F6-4339-A414-5126474048C6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -46,6 +52,7 @@ Global {972B3171-DDE1-4CF8-863E-B45875440A80} = {9EC4E573-048F-40B7-8721-E28857532DF0} {5D89CB6E-02DA-483F-B0CA-03E235EA795B} = {74FC9674-053B-480C-84AC-F6AAF8B82239} {5538990A-29DE-448B-A5F3-30266AA66C17} = {74FC9674-053B-480C-84AC-F6AAF8B82239} + {46FC91AA-B4F6-4339-A414-5126474048C6} = {74FC9674-053B-480C-84AC-F6AAF8B82239} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B464DC23-8514-4B57-BA12-524A7C3994FA} diff --git a/src/ActivityPub.Domain/Accounts/Account.cs b/src/ActivityPub.Domain/Accounts/Account.cs index aeca9f7..0649b16 100644 --- a/src/ActivityPub.Domain/Accounts/Account.cs +++ b/src/ActivityPub.Domain/Accounts/Account.cs @@ -4,13 +4,31 @@ namespace ActivityPub.Domain.Accounts; public class Account { - public Account(string id, string username, string accountUri, - string url, string displayName, string note, string avatar, - string avatarStatic, string headerImage, string headerStatic, - bool isLocked, ProfileField[] fields, Emoji[] emojis, bool isBot, - bool isGroup, bool? isDiscoverable, Account hasMovedTo, bool? isSuspended, - bool isLimited, DateTime createdAt, DateTime? lastStatusAt, - int statusCount, int followerCount, int followingCount) + public Account( + string id, + string username, + string accountUri, + string url, + string displayName, + string note, + string avatar, + string avatarStatic, + string headerImage, + string headerStatic, + bool isLocked, + ProfileField[] fields, + Emoji[] emojis, + bool isBot, + bool isGroup, + bool? isDiscoverable, + Account hasMovedTo, + bool? isSuspended, + bool isLimited, + DateTime createdAt, + DateTime? lastStatusAt, + int statusCount, + int followerCount, + int followingCount) { Id = id; Username = username; diff --git a/src/Infrastructure.Database/Infrastructure.Database.csproj b/src/Domain/Domain.csproj similarity index 78% rename from src/Infrastructure.Database/Infrastructure.Database.csproj rename to src/Domain/Domain.csproj index 4cb84ae..1a9d34a 100644 --- a/src/Infrastructure.Database/Infrastructure.Database.csproj +++ b/src/Domain/Domain.csproj @@ -4,7 +4,7 @@ net7.0 enable enable - true + Smilodon.Domain diff --git a/src/Domain/Models/Account.cs b/src/Domain/Models/Account.cs new file mode 100644 index 0000000..78358ea --- /dev/null +++ b/src/Domain/Models/Account.cs @@ -0,0 +1,117 @@ +namespace Smilodon.Domain.Models +{ + public class Account + { + public long Id { get; set; } + public string Username { get; set; } = null!; + public string? Domain { get; set; } + public string? PrivateKey { get; set; } + public string PublicKey { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public string Note { get; set; } = null!; + public string DisplayName { get; set; } = null!; + public string Uri { get; set; } = null!; + public string? Url { get; set; } + public string? AvatarFileName { get; set; } + public string? AvatarContentType { get; set; } + public int? AvatarFileSize { get; set; } + public DateTime? AvatarUpdatedAt { get; set; } + public string? HeaderFileName { get; set; } + public string? HeaderContentType { get; set; } + public int? HeaderFileSize { get; set; } + public DateTime? HeaderUpdatedAt { get; set; } + public string? AvatarRemoteUrl { get; set; } + public bool Locked { get; set; } + public string HeaderRemoteUrl { get; set; } = null!; + public DateTime? LastWebfingeredAt { get; set; } + public string InboxUrl { get; set; } = null!; + public string OutboxUrl { get; set; } = null!; + public string SharedInboxUrl { get; set; } = null!; + public string FollowersUrl { get; set; } = null!; + public int Protocol { get; set; } + public bool Memorial { get; set; } + public long? MovedToAccountId { get; set; } + public string? FeaturedCollectionUrl { get; set; } + public string? Fields { get; set; } + public string? ActorType { get; set; } + public bool? Discoverable { get; set; } + public string[]? AlsoKnownAs { get; set; } + public DateTime? SilencedAt { get; set; } + public DateTime? SuspendedAt { get; set; } + public bool? HideCollections { get; set; } + public int? AvatarStorageSchemaVersion { get; set; } + public int? HeaderStorageSchemaVersion { get; set; } + public string? DevicesUrl { get; set; } + public int? SuspensionOrigin { get; set; } + public DateTime? SensitizedAt { get; set; } + public bool? Trendable { get; set; } + public DateTime? ReviewedAt { get; set; } + public DateTime? RequestedReviewAt { get; set; } + + public virtual Account? MovedToAccount { get; set; } + public virtual AccountStat AccountStat { get; set; } = null!; + public virtual FollowRecommendationSuppression FollowRecommendationSuppression { get; set; } = null!; + public virtual ICollection AccountAliases { get; set; } = new HashSet(); + public virtual ICollection AccountConversations { get; set; } = new HashSet(); + public virtual ICollection AccountDeletionRequests { get; set; } = new HashSet(); + public virtual ICollection AccountDomainBlocks { get; set; } = new HashSet(); + public virtual ICollection AccountMigrationAccounts { get; set; } = new HashSet(); + public virtual ICollection AccountMigrationTargetAccounts { get; set; } = new HashSet(); + public virtual ICollection AccountModerationNoteAccounts { get; set; } = new HashSet(); + public virtual ICollection AccountModerationNoteTargetAccounts { get; set; } = new HashSet(); + public virtual ICollection AccountNoteAccounts { get; set; } = new HashSet(); + public virtual ICollection AccountNoteTargetAccounts { get; set; } = new HashSet(); + public virtual ICollection AccountPinAccounts { get; set; } = new HashSet(); + public virtual ICollection AccountPinTargetAccounts { get; set; } = new HashSet(); + public virtual ICollection AccountStatusesCleanupPolicies { get; set; } = new HashSet(); + public virtual ICollection AccountWarningAccounts { get; set; } = new HashSet(); + public virtual ICollection AccountWarningTargetAccounts { get; set; } = new HashSet(); + public virtual ICollection AdminActionLogs { get; set; } = new HashSet(); + public virtual ICollection AnnouncementMutes { get; set; } = new HashSet(); + public virtual ICollection AnnouncementReactions { get; set; } = new HashSet(); + public virtual ICollection AppealAccounts { get; set; } = new HashSet(); + public virtual ICollection AppealApprovedByAccounts { get; set; } = new HashSet(); + public virtual ICollection AppealRejectedByAccounts { get; set; } = new HashSet(); + public virtual ICollection BlockAccounts { get; set; } = new HashSet(); + public virtual ICollection BlockTargetAccounts { get; set; } = new HashSet(); + public virtual ICollection Bookmarks { get; set; } = new HashSet(); + public virtual ICollection CanonicalEmailBlocks { get; set; } = new HashSet(); + public virtual ICollection ConversationMutes { get; set; } = new HashSet(); + public virtual ICollection CustomFilters { get; set; } = new HashSet(); + public virtual ICollection Devices { get; set; } = new HashSet(); + public virtual ICollection EncryptedMessages { get; set; } = new HashSet(); + public virtual ICollection Favourites { get; set; } = new HashSet(); + public virtual ICollection FeaturedTags { get; set; } = new HashSet(); + public virtual ICollection FollowAccounts { get; set; } = new HashSet(); + public virtual ICollection FollowRequestAccounts { get; set; } = new HashSet(); + public virtual ICollection FollowRequestTargetAccounts { get; set; } = new HashSet(); + public virtual ICollection FollowTargetAccounts { get; set; } = new HashSet(); + public virtual ICollection Imports { get; set; } = new HashSet(); + public virtual ICollection InverseMovedToAccount { get; set; } = new HashSet(); + public virtual ICollection ListAccounts { get; set; } = new HashSet(); + public virtual ICollection Lists { get; set; } = new HashSet(); + public virtual ICollection MediaAttachments { get; set; } = new HashSet(); + public virtual ICollection Mentions { get; set; } = new HashSet(); + public virtual ICollection MuteAccounts { get; set; } = new HashSet(); + public virtual ICollection MuteTargetAccounts { get; set; } = new HashSet(); + public virtual ICollection NotificationAccounts { get; set; } = new HashSet(); + public virtual ICollection NotificationFromAccounts { get; set; } = new HashSet(); + public virtual ICollection PollVotes { get; set; } = new HashSet(); + public virtual ICollection Polls { get; set; } = new HashSet(); + public virtual ICollection ReportAccounts { get; set; } = new HashSet(); + public virtual ICollection ReportActionTakenByAccounts { get; set; } = new HashSet(); + public virtual ICollection ReportAssignedAccounts { get; set; } = new HashSet(); + public virtual ICollection ReportNotes { get; set; } = new HashSet(); + public virtual ICollection ReportTargetAccounts { get; set; } = new HashSet(); + public virtual ICollection ScheduledStatuses { get; set; } = new HashSet(); + public virtual ICollection StatusAccounts { get; set; } = new HashSet(); + public virtual ICollection StatusEdits { get; set; } = new HashSet(); + public virtual ICollection StatusInReplyToAccounts { get; set; } = new HashSet(); + public virtual ICollection StatusPins { get; set; } = new HashSet(); + public virtual ICollection StatusTrends { get; set; } = new HashSet(); + public virtual ICollection TagFollows { get; set; } = new HashSet(); + public virtual ICollection Tombstones { get; set; } = new HashSet(); + public virtual ICollection Users { get; set; } = new HashSet(); + } +} diff --git a/src/Domain/Models/AccountAlias.cs b/src/Domain/Models/AccountAlias.cs new file mode 100644 index 0000000..b287255 --- /dev/null +++ b/src/Domain/Models/AccountAlias.cs @@ -0,0 +1,14 @@ +namespace Smilodon.Domain.Models +{ + public class AccountAlias + { + public long Id { get; set; } + public long? AccountId { get; set; } + public string Acct { get; set; } = null!; + public string Uri { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual Account? Account { get; set; } + } +} diff --git a/src/Domain/Models/AccountConversation.cs b/src/Domain/Models/AccountConversation.cs new file mode 100644 index 0000000..2cc4bb1 --- /dev/null +++ b/src/Domain/Models/AccountConversation.cs @@ -0,0 +1,17 @@ +namespace Smilodon.Domain.Models +{ + public class AccountConversation + { + public long Id { get; set; } + public long? AccountId { get; set; } + public long? ConversationId { get; set; } + public long[] ParticipantAccountIds { get; set; } = null!; + public long[] StatusIds { get; set; } = null!; + public long? LastStatusId { get; set; } + public int LockVersion { get; set; } + public bool Unread { get; set; } + + public virtual Account? Account { get; set; } + public virtual Conversation? Conversation { get; set; } + } +} diff --git a/src/Domain/Models/AccountDeletionRequest.cs b/src/Domain/Models/AccountDeletionRequest.cs new file mode 100644 index 0000000..0699cba --- /dev/null +++ b/src/Domain/Models/AccountDeletionRequest.cs @@ -0,0 +1,12 @@ +namespace Smilodon.Domain.Models +{ + public class AccountDeletionRequest + { + public long Id { get; set; } + public long? AccountId { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual Account? Account { get; set; } + } +} diff --git a/src/Domain/Models/AccountDomainBlock.cs b/src/Domain/Models/AccountDomainBlock.cs new file mode 100644 index 0000000..8f355d0 --- /dev/null +++ b/src/Domain/Models/AccountDomainBlock.cs @@ -0,0 +1,13 @@ +namespace Smilodon.Domain.Models +{ + public class AccountDomainBlock + { + public long Id { get; set; } + public string? Domain { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public long? AccountId { get; set; } + + public virtual Account? Account { get; set; } + } +} diff --git a/src/Domain/Models/AccountMigration.cs b/src/Domain/Models/AccountMigration.cs new file mode 100644 index 0000000..afc1089 --- /dev/null +++ b/src/Domain/Models/AccountMigration.cs @@ -0,0 +1,16 @@ +namespace Smilodon.Domain.Models +{ + public class AccountMigration + { + public long Id { get; set; } + public long? AccountId { get; set; } + public string Acct { get; set; } = null!; + public long FollowersCount { get; set; } + public long? TargetAccountId { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual Account? Account { get; set; } + public virtual Account? TargetAccount { get; set; } + } +} diff --git a/src/Domain/Models/AccountModerationNote.cs b/src/Domain/Models/AccountModerationNote.cs new file mode 100644 index 0000000..44e06e7 --- /dev/null +++ b/src/Domain/Models/AccountModerationNote.cs @@ -0,0 +1,15 @@ +namespace Smilodon.Domain.Models +{ + public class AccountModerationNote + { + public long Id { get; set; } + public string Content { get; set; } = null!; + public long AccountId { get; set; } + public long TargetAccountId { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual Account TargetAccount { get; set; } = null!; + } +} diff --git a/src/Domain/Models/AccountNote.cs b/src/Domain/Models/AccountNote.cs new file mode 100644 index 0000000..13a2d32 --- /dev/null +++ b/src/Domain/Models/AccountNote.cs @@ -0,0 +1,15 @@ +namespace Smilodon.Domain.Models +{ + public class AccountNote + { + public long Id { get; set; } + public long? AccountId { get; set; } + public long? TargetAccountId { get; set; } + public string Comment { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual Account? Account { get; set; } + public virtual Account? TargetAccount { get; set; } + } +} diff --git a/src/Domain/Models/AccountPin.cs b/src/Domain/Models/AccountPin.cs new file mode 100644 index 0000000..af511b8 --- /dev/null +++ b/src/Domain/Models/AccountPin.cs @@ -0,0 +1,14 @@ +namespace Smilodon.Domain.Models +{ + public class AccountPin + { + public long Id { get; set; } + public long? AccountId { get; set; } + public long? TargetAccountId { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual Account? Account { get; set; } + public virtual Account? TargetAccount { get; set; } + } +} diff --git a/src/Domain/Models/AccountStat.cs b/src/Domain/Models/AccountStat.cs new file mode 100644 index 0000000..1ef23d8 --- /dev/null +++ b/src/Domain/Models/AccountStat.cs @@ -0,0 +1,16 @@ +namespace Smilodon.Domain.Models +{ + public class AccountStat + { + public long Id { get; set; } + public long AccountId { get; set; } + public long StatusesCount { get; set; } + public long FollowingCount { get; set; } + public long FollowersCount { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public DateTime? LastStatusAt { get; set; } + + public virtual Account Account { get; set; } = null!; + } +} diff --git a/src/Domain/Models/AccountStatusesCleanupPolicy.cs b/src/Domain/Models/AccountStatusesCleanupPolicy.cs new file mode 100644 index 0000000..8529dfa --- /dev/null +++ b/src/Domain/Models/AccountStatusesCleanupPolicy.cs @@ -0,0 +1,22 @@ +namespace Smilodon.Domain.Models +{ + public class AccountStatusesCleanupPolicy + { + public long Id { get; set; } + public long AccountId { get; set; } + public bool Enabled { get; set; } + public int MinStatusAge { get; set; } + public bool KeepDirect { get; set; } + public bool KeepPinned { get; set; } + public bool KeepPolls { get; set; } + public bool KeepMedia { get; set; } + public bool KeepSelfFav { get; set; } + public bool KeepSelfBookmark { get; set; } + public int? MinFavs { get; set; } + public int? MinReblogs { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual Account Account { get; set; } = null!; + } +} diff --git a/src/Domain/Models/AccountSummary.cs b/src/Domain/Models/AccountSummary.cs new file mode 100644 index 0000000..82949ca --- /dev/null +++ b/src/Domain/Models/AccountSummary.cs @@ -0,0 +1,9 @@ +namespace Smilodon.Domain.Models +{ + public class AccountSummary + { + public long? AccountId { get; set; } + public string? Language { get; set; } + public bool? Sensitive { get; set; } + } +} diff --git a/src/Domain/Models/AccountTag.cs b/src/Domain/Models/AccountTag.cs new file mode 100644 index 0000000..109b056 --- /dev/null +++ b/src/Domain/Models/AccountTag.cs @@ -0,0 +1,8 @@ +namespace Smilodon.Domain.Models +{ + public class AccountTag + { + public long AccountId { get; set; } + public long TagId { get; set; } + } +} diff --git a/src/Domain/Models/AccountWarning.cs b/src/Domain/Models/AccountWarning.cs new file mode 100644 index 0000000..f706a29 --- /dev/null +++ b/src/Domain/Models/AccountWarning.cs @@ -0,0 +1,21 @@ +namespace Smilodon.Domain.Models +{ + public class AccountWarning + { + public long Id { get; set; } + public long? AccountId { get; set; } + public long? TargetAccountId { get; set; } + public int Action { get; set; } + public string Text { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public long? ReportId { get; set; } + public string[]? StatusIds { get; set; } + public DateTime? OverruledAt { get; set; } + + public virtual Account? Account { get; set; } + public virtual Report? Report { get; set; } + public virtual Account? TargetAccount { get; set; } + public virtual Appeal Appeal { get; set; } = null!; + } +} diff --git a/src/Domain/Models/AccountWarningPreset.cs b/src/Domain/Models/AccountWarningPreset.cs new file mode 100644 index 0000000..1bc6003 --- /dev/null +++ b/src/Domain/Models/AccountWarningPreset.cs @@ -0,0 +1,11 @@ +namespace Smilodon.Domain.Models +{ + public class AccountWarningPreset + { + public long Id { get; set; } + public string Text { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public string Title { get; set; } = null!; + } +} diff --git a/src/Domain/Models/AdminActionLog.cs b/src/Domain/Models/AdminActionLog.cs new file mode 100644 index 0000000..282a7c9 --- /dev/null +++ b/src/Domain/Models/AdminActionLog.cs @@ -0,0 +1,18 @@ +namespace Smilodon.Domain.Models +{ + public class AdminActionLog + { + public long Id { get; set; } + public long? AccountId { get; set; } + public string Action { get; set; } = null!; + public string? TargetType { get; set; } + public long? TargetId { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public string? HumanIdentifier { get; set; } + public string? RouteParam { get; set; } + public string? Permalink { get; set; } + + public virtual Account? Account { get; set; } + } +} diff --git a/src/Domain/Models/Announcement.cs b/src/Domain/Models/Announcement.cs new file mode 100644 index 0000000..0329225 --- /dev/null +++ b/src/Domain/Models/Announcement.cs @@ -0,0 +1,20 @@ +namespace Smilodon.Domain.Models +{ + public class Announcement + { + public long Id { get; set; } + public string Text { get; set; } = null!; + public bool Published { get; set; } + public bool AllDay { get; set; } + public DateTime? ScheduledAt { get; set; } + public DateTime? StartsAt { get; set; } + public DateTime? EndsAt { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public DateTime? PublishedAt { get; set; } + public long[]? StatusIds { get; set; } + + public virtual ICollection AnnouncementMutes { get; set; } = new HashSet(); + public virtual ICollection AnnouncementReactions { get; set; } = new HashSet(); + } +} diff --git a/src/Domain/Models/AnnouncementMute.cs b/src/Domain/Models/AnnouncementMute.cs new file mode 100644 index 0000000..64df353 --- /dev/null +++ b/src/Domain/Models/AnnouncementMute.cs @@ -0,0 +1,14 @@ +namespace Smilodon.Domain.Models +{ + public class AnnouncementMute + { + public long Id { get; set; } + public long? AccountId { get; set; } + public long? AnnouncementId { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual Account? Account { get; set; } + public virtual Announcement? Announcement { get; set; } + } +} diff --git a/src/Domain/Models/AnnouncementReaction.cs b/src/Domain/Models/AnnouncementReaction.cs new file mode 100644 index 0000000..f3c4b53 --- /dev/null +++ b/src/Domain/Models/AnnouncementReaction.cs @@ -0,0 +1,17 @@ +namespace Smilodon.Domain.Models +{ + public class AnnouncementReaction + { + public long Id { get; set; } + public long? AccountId { get; set; } + public long? AnnouncementId { get; set; } + public string Name { get; set; } = null!; + public long? CustomEmojiId { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual Account? Account { get; set; } + public virtual Announcement? Announcement { get; set; } + public virtual CustomEmoji? CustomEmoji { get; set; } + } +} diff --git a/src/Domain/Models/Appeal.cs b/src/Domain/Models/Appeal.cs new file mode 100644 index 0000000..d8199b3 --- /dev/null +++ b/src/Domain/Models/Appeal.cs @@ -0,0 +1,21 @@ +namespace Smilodon.Domain.Models +{ + public class Appeal + { + public long Id { get; set; } + public long AccountId { get; set; } + public long AccountWarningId { get; set; } + public string Text { get; set; } = null!; + public DateTime? ApprovedAt { get; set; } + public long? ApprovedByAccountId { get; set; } + public DateTime? RejectedAt { get; set; } + public long? RejectedByAccountId { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual AccountWarning AccountWarning { get; set; } = null!; + public virtual Account? ApprovedByAccount { get; set; } + public virtual Account? RejectedByAccount { get; set; } + } +} diff --git a/src/Domain/Models/ArInternalMetadatum.cs b/src/Domain/Models/ArInternalMetadatum.cs new file mode 100644 index 0000000..2a49a2e --- /dev/null +++ b/src/Domain/Models/ArInternalMetadatum.cs @@ -0,0 +1,10 @@ +namespace Smilodon.Domain.Models +{ + public class ArInternalMetadatum + { + public string Key { get; set; } = null!; + public string? Value { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + } +} diff --git a/src/Domain/Models/Backup.cs b/src/Domain/Models/Backup.cs new file mode 100644 index 0000000..46c98b7 --- /dev/null +++ b/src/Domain/Models/Backup.cs @@ -0,0 +1,17 @@ +namespace Smilodon.Domain.Models +{ + public class Backup + { + public long Id { get; set; } + public long? UserId { get; set; } + public string? DumpFileName { get; set; } + public string? DumpContentType { get; set; } + public DateTime? DumpUpdatedAt { get; set; } + public bool Processed { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public long? DumpFileSize { get; set; } + + public virtual User? User { get; set; } + } +} diff --git a/src/Domain/Models/Block.cs b/src/Domain/Models/Block.cs new file mode 100644 index 0000000..8d362e1 --- /dev/null +++ b/src/Domain/Models/Block.cs @@ -0,0 +1,15 @@ +namespace Smilodon.Domain.Models +{ + public class Block + { + public long Id { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public long AccountId { get; set; } + public long TargetAccountId { get; set; } + public string? Uri { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual Account TargetAccount { get; set; } = null!; + } +} diff --git a/src/Domain/Models/Bookmark.cs b/src/Domain/Models/Bookmark.cs new file mode 100644 index 0000000..8c282aa --- /dev/null +++ b/src/Domain/Models/Bookmark.cs @@ -0,0 +1,14 @@ +namespace Smilodon.Domain.Models +{ + public class Bookmark + { + public long Id { get; set; } + public long AccountId { get; set; } + public long StatusId { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual Status Status { get; set; } = null!; + } +} diff --git a/src/Domain/Models/CanonicalEmailBlock.cs b/src/Domain/Models/CanonicalEmailBlock.cs new file mode 100644 index 0000000..7e22f1c --- /dev/null +++ b/src/Domain/Models/CanonicalEmailBlock.cs @@ -0,0 +1,13 @@ +namespace Smilodon.Domain.Models +{ + public class CanonicalEmailBlock + { + public long Id { get; set; } + public string CanonicalEmailHash { get; set; } = null!; + public long? ReferenceAccountId { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual Account? ReferenceAccount { get; set; } + } +} diff --git a/src/Domain/Models/Conversation.cs b/src/Domain/Models/Conversation.cs new file mode 100644 index 0000000..d112be1 --- /dev/null +++ b/src/Domain/Models/Conversation.cs @@ -0,0 +1,13 @@ +namespace Smilodon.Domain.Models +{ + public class Conversation + { + public long Id { get; set; } + public string? Uri { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual ICollection AccountConversations { get; set; } = new HashSet(); + public virtual ICollection ConversationMutes { get; set; } = new HashSet(); + } +} diff --git a/src/Domain/Models/ConversationMute.cs b/src/Domain/Models/ConversationMute.cs new file mode 100644 index 0000000..3850ba2 --- /dev/null +++ b/src/Domain/Models/ConversationMute.cs @@ -0,0 +1,12 @@ +namespace Smilodon.Domain.Models +{ + public class ConversationMute + { + public long Id { get; set; } + public long ConversationId { get; set; } + public long AccountId { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual Conversation Conversation { get; set; } = null!; + } +} diff --git a/src/Domain/Models/CustomEmoji.cs b/src/Domain/Models/CustomEmoji.cs new file mode 100644 index 0000000..2c637df --- /dev/null +++ b/src/Domain/Models/CustomEmoji.cs @@ -0,0 +1,23 @@ +namespace Smilodon.Domain.Models +{ + public class CustomEmoji + { + public long Id { get; set; } + public string Shortcode { get; set; } = null!; + public string? Domain { get; set; } + public string? ImageFileName { get; set; } + public string? ImageContentType { get; set; } + public int? ImageFileSize { get; set; } + public DateTime? ImageUpdatedAt { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public bool Disabled { get; set; } + public string? Uri { get; set; } + public string? ImageRemoteUrl { get; set; } + public bool VisibleInPicker { get; set; } + public long? CategoryId { get; set; } + public int? ImageStorageSchemaVersion { get; set; } + + public virtual ICollection AnnouncementReactions { get; set; } = new HashSet(); + } +} diff --git a/src/Domain/Models/CustomEmojiCategory.cs b/src/Domain/Models/CustomEmojiCategory.cs new file mode 100644 index 0000000..ca7ef6f --- /dev/null +++ b/src/Domain/Models/CustomEmojiCategory.cs @@ -0,0 +1,10 @@ +namespace Smilodon.Domain.Models +{ + public class CustomEmojiCategory + { + public long Id { get; set; } + public string? Name { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + } +} diff --git a/src/Domain/Models/CustomFilter.cs b/src/Domain/Models/CustomFilter.cs new file mode 100644 index 0000000..6a01029 --- /dev/null +++ b/src/Domain/Models/CustomFilter.cs @@ -0,0 +1,18 @@ +namespace Smilodon.Domain.Models +{ + public class CustomFilter + { + public long Id { get; set; } + public long? AccountId { get; set; } + public DateTime? ExpiresAt { get; set; } + public string Phrase { get; set; } = null!; + public string[] Context { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public int Action { get; set; } + + public virtual Account? Account { get; set; } + public virtual ICollection CustomFilterKeywords { get; set; } = new HashSet(); + public virtual ICollection CustomFilterStatuses { get; set; } = new HashSet(); + } +} diff --git a/src/Domain/Models/CustomFilterKeyword.cs b/src/Domain/Models/CustomFilterKeyword.cs new file mode 100644 index 0000000..1b416eb --- /dev/null +++ b/src/Domain/Models/CustomFilterKeyword.cs @@ -0,0 +1,14 @@ +namespace Smilodon.Domain.Models +{ + public class CustomFilterKeyword + { + public long Id { get; set; } + public long CustomFilterId { get; set; } + public string Keyword { get; set; } = null!; + public bool WholeWord { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual CustomFilter CustomFilter { get; set; } = null!; + } +} diff --git a/src/Domain/Models/CustomFilterStatus.cs b/src/Domain/Models/CustomFilterStatus.cs new file mode 100644 index 0000000..47fe785 --- /dev/null +++ b/src/Domain/Models/CustomFilterStatus.cs @@ -0,0 +1,14 @@ +namespace Smilodon.Domain.Models +{ + public class CustomFilterStatus + { + public long Id { get; set; } + public long CustomFilterId { get; set; } + public long StatusId { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual CustomFilter CustomFilter { get; set; } = null!; + public virtual Status Status { get; set; } = null!; + } +} diff --git a/src/Domain/Models/Device.cs b/src/Domain/Models/Device.cs new file mode 100644 index 0000000..0c5188f --- /dev/null +++ b/src/Domain/Models/Device.cs @@ -0,0 +1,20 @@ +namespace Smilodon.Domain.Models +{ + public class Device + { + public long Id { get; set; } + public long? AccessTokenId { get; set; } + public long? AccountId { get; set; } + public string DeviceId { get; set; } = null!; + public string Name { get; set; } = null!; + public string FingerprintKey { get; set; } = null!; + public string IdentityKey { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual OAuthAccessToken? AccessToken { get; set; } + public virtual Account? Account { get; set; } + public virtual ICollection EncryptedMessages { get; set; } = new HashSet(); + public virtual ICollection OneTimeKeys { get; set; } = new HashSet(); + } +} diff --git a/src/Domain/Models/DomainAllow.cs b/src/Domain/Models/DomainAllow.cs new file mode 100644 index 0000000..4941e4b --- /dev/null +++ b/src/Domain/Models/DomainAllow.cs @@ -0,0 +1,10 @@ +namespace Smilodon.Domain.Models +{ + public class DomainAllow + { + public long Id { get; set; } + public string Domain { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + } +} diff --git a/src/Domain/Models/DomainBlock.cs b/src/Domain/Models/DomainBlock.cs new file mode 100644 index 0000000..31be2b2 --- /dev/null +++ b/src/Domain/Models/DomainBlock.cs @@ -0,0 +1,16 @@ +namespace Smilodon.Domain.Models +{ + public class DomainBlock + { + public long Id { get; set; } + public string Domain { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public int? Severity { get; set; } + public bool RejectMedia { get; set; } + public bool RejectReports { get; set; } + public string? PrivateComment { get; set; } + public string? PublicComment { get; set; } + public bool Obfuscate { get; set; } + } +} diff --git a/src/Domain/Models/EmailDomainBlock.cs b/src/Domain/Models/EmailDomainBlock.cs new file mode 100644 index 0000000..63e585c --- /dev/null +++ b/src/Domain/Models/EmailDomainBlock.cs @@ -0,0 +1,14 @@ +namespace Smilodon.Domain.Models +{ + public class EmailDomainBlock + { + public long Id { get; set; } + public string Domain { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public long? ParentId { get; set; } + + public virtual EmailDomainBlock? Parent { get; set; } + public virtual ICollection InverseParent { get; set; } = new HashSet(); + } +} diff --git a/src/Domain/Models/EncryptedMessage.cs b/src/Domain/Models/EncryptedMessage.cs new file mode 100644 index 0000000..31e29a3 --- /dev/null +++ b/src/Domain/Models/EncryptedMessage.cs @@ -0,0 +1,19 @@ +namespace Smilodon.Domain.Models +{ + public class EncryptedMessage + { + public long Id { get; set; } + public long? DeviceId { get; set; } + public long? FromAccountId { get; set; } + public string FromDeviceId { get; set; } = null!; + public int Type { get; set; } + public string Body { get; set; } = null!; + public string Digest { get; set; } = null!; + public string MessageFranking { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual Device? Device { get; set; } + public virtual Account? FromAccount { get; set; } + } +} diff --git a/src/Domain/Models/Favourite.cs b/src/Domain/Models/Favourite.cs new file mode 100644 index 0000000..8eb965b --- /dev/null +++ b/src/Domain/Models/Favourite.cs @@ -0,0 +1,14 @@ +namespace Smilodon.Domain.Models +{ + public class Favourite + { + public long Id { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public long AccountId { get; set; } + public long StatusId { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual Status Status { get; set; } = null!; + } +} diff --git a/src/Domain/Models/FeaturedTag.cs b/src/Domain/Models/FeaturedTag.cs new file mode 100644 index 0000000..f934d40 --- /dev/null +++ b/src/Domain/Models/FeaturedTag.cs @@ -0,0 +1,17 @@ +namespace Smilodon.Domain.Models +{ + public class FeaturedTag + { + public long Id { get; set; } + public long AccountId { get; set; } + public long TagId { get; set; } + public long StatusesCount { get; set; } + public DateTime? LastStatusAt { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public string? Name { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual Tag Tag { get; set; } = null!; + } +} diff --git a/src/Domain/Models/Follow.cs b/src/Domain/Models/Follow.cs new file mode 100644 index 0000000..3c54bf0 --- /dev/null +++ b/src/Domain/Models/Follow.cs @@ -0,0 +1,19 @@ +namespace Smilodon.Domain.Models +{ + public class Follow + { + public long Id { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public long AccountId { get; set; } + public long TargetAccountId { get; set; } + public bool ShowReblogs { get; set; } + public string? Uri { get; set; } + public bool Notify { get; set; } + public string[]? Languages { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual Account TargetAccount { get; set; } = null!; + public virtual ICollection ListAccounts { get; set; } = new HashSet(); + } +} diff --git a/src/Domain/Models/FollowRecommendation.cs b/src/Domain/Models/FollowRecommendation.cs new file mode 100644 index 0000000..dd8bbe8 --- /dev/null +++ b/src/Domain/Models/FollowRecommendation.cs @@ -0,0 +1,9 @@ +namespace Smilodon.Domain.Models +{ + public class FollowRecommendation + { + public long? AccountId { get; set; } + public decimal? Rank { get; set; } + public string[]? Reason { get; set; } + } +} diff --git a/src/Domain/Models/FollowRecommendationSuppression.cs b/src/Domain/Models/FollowRecommendationSuppression.cs new file mode 100644 index 0000000..7205119 --- /dev/null +++ b/src/Domain/Models/FollowRecommendationSuppression.cs @@ -0,0 +1,12 @@ +namespace Smilodon.Domain.Models +{ + public class FollowRecommendationSuppression + { + public long Id { get; set; } + public long AccountId { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual Account Account { get; set; } = null!; + } +} diff --git a/src/Domain/Models/FollowRequest.cs b/src/Domain/Models/FollowRequest.cs new file mode 100644 index 0000000..362d3df --- /dev/null +++ b/src/Domain/Models/FollowRequest.cs @@ -0,0 +1,18 @@ +namespace Smilodon.Domain.Models +{ + public class FollowRequest + { + public long Id { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public long AccountId { get; set; } + public long TargetAccountId { get; set; } + public bool ShowReblogs { get; set; } + public string? Uri { get; set; } + public bool Notify { get; set; } + public string[]? Languages { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual Account TargetAccount { get; set; } = null!; + } +} diff --git a/src/Domain/Models/Identity.cs b/src/Domain/Models/Identity.cs new file mode 100644 index 0000000..424670e --- /dev/null +++ b/src/Domain/Models/Identity.cs @@ -0,0 +1,14 @@ +namespace Smilodon.Domain.Models +{ + public class Identity + { + public long Id { get; set; } + public string Provider { get; set; } = null!; + public string Uid { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public long? UserId { get; set; } + + public virtual User? User { get; set; } + } +} diff --git a/src/Domain/Models/Import.cs b/src/Domain/Models/Import.cs new file mode 100644 index 0000000..89a0af3 --- /dev/null +++ b/src/Domain/Models/Import.cs @@ -0,0 +1,19 @@ +namespace Smilodon.Domain.Models +{ + public class Import + { + public long Id { get; set; } + public int Type { get; set; } + public bool Approved { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public string? DataFileName { get; set; } + public string? DataContentType { get; set; } + public int? DataFileSize { get; set; } + public DateTime? DataUpdatedAt { get; set; } + public long AccountId { get; set; } + public bool Overwrite { get; set; } + + public virtual Account Account { get; set; } = null!; + } +} diff --git a/src/Domain/Models/Instance.cs b/src/Domain/Models/Instance.cs new file mode 100644 index 0000000..e0e5ee4 --- /dev/null +++ b/src/Domain/Models/Instance.cs @@ -0,0 +1,8 @@ +namespace Smilodon.Domain.Models +{ + public class Instance + { + public string? Domain { get; set; } + public long? AccountsCount { get; set; } + } +} diff --git a/src/Domain/Models/Invite.cs b/src/Domain/Models/Invite.cs new file mode 100644 index 0000000..647abbb --- /dev/null +++ b/src/Domain/Models/Invite.cs @@ -0,0 +1,19 @@ +namespace Smilodon.Domain.Models +{ + public class Invite + { + public long Id { get; set; } + public long UserId { get; set; } + public string Code { get; set; } = null!; + public DateTime? ExpiresAt { get; set; } + public int? MaxUses { get; set; } + public int Uses { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public bool Autofollow { get; set; } + public string? Comment { get; set; } + + public virtual User User { get; set; } = null!; + public virtual ICollection Users { get; set; } = new HashSet(); + } +} diff --git a/src/Domain/Models/IpBlock.cs b/src/Domain/Models/IpBlock.cs new file mode 100644 index 0000000..558b49b --- /dev/null +++ b/src/Domain/Models/IpBlock.cs @@ -0,0 +1,15 @@ +using System.Net; + +namespace Smilodon.Domain.Models +{ + public class IpBlock + { + public long Id { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public DateTime? ExpiresAt { get; set; } + public IPAddress Ip { get; set; } = null!; + public int Severity { get; set; } + public string Comment { get; set; } = null!; + } +} diff --git a/src/Domain/Models/List.cs b/src/Domain/Models/List.cs new file mode 100644 index 0000000..a60c1b3 --- /dev/null +++ b/src/Domain/Models/List.cs @@ -0,0 +1,15 @@ +namespace Smilodon.Domain.Models +{ + public class List + { + public long Id { get; set; } + public long AccountId { get; set; } + public string Title { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public int RepliesPolicy { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual ICollection ListAccounts { get; set; } = new HashSet(); + } +} diff --git a/src/Domain/Models/ListAccount.cs b/src/Domain/Models/ListAccount.cs new file mode 100644 index 0000000..6a21dc0 --- /dev/null +++ b/src/Domain/Models/ListAccount.cs @@ -0,0 +1,14 @@ +namespace Smilodon.Domain.Models +{ + public class ListAccount + { + public long Id { get; set; } + public long ListId { get; set; } + public long AccountId { get; set; } + public long? FollowId { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual Follow? Follow { get; set; } + public virtual List List { get; set; } = null!; + } +} diff --git a/src/Domain/Models/LoginActivity.cs b/src/Domain/Models/LoginActivity.cs new file mode 100644 index 0000000..92e1736 --- /dev/null +++ b/src/Domain/Models/LoginActivity.cs @@ -0,0 +1,19 @@ +using System.Net; + +namespace Smilodon.Domain.Models +{ + public class LoginActivity + { + public long Id { get; set; } + public long UserId { get; set; } + public string? AuthenticationMethod { get; set; } + public string? Provider { get; set; } + public bool? Success { get; set; } + public string? FailureReason { get; set; } + public IPAddress? Ip { get; set; } + public string? UserAgent { get; set; } + public DateTime? CreatedAt { get; set; } + + public virtual User User { get; set; } = null!; + } +} diff --git a/src/Domain/Models/Marker.cs b/src/Domain/Models/Marker.cs new file mode 100644 index 0000000..d996a0e --- /dev/null +++ b/src/Domain/Models/Marker.cs @@ -0,0 +1,15 @@ +namespace Smilodon.Domain.Models +{ + public class Marker + { + public long Id { get; set; } + public long? UserId { get; set; } + public string Timeline { get; set; } = null!; + public long LastReadId { get; set; } + public int LockVersion { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual User? User { get; set; } + } +} diff --git a/src/Domain/Models/MediaAttachment.cs b/src/Domain/Models/MediaAttachment.cs new file mode 100644 index 0000000..2df3afb --- /dev/null +++ b/src/Domain/Models/MediaAttachment.cs @@ -0,0 +1,33 @@ +namespace Smilodon.Domain.Models +{ + public class MediaAttachment + { + public long Id { get; set; } + public long? StatusId { get; set; } + public string? FileFileName { get; set; } + public string? FileContentType { get; set; } + public int? FileFileSize { get; set; } + public DateTime? FileUpdatedAt { get; set; } + public string RemoteUrl { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public string? Shortcode { get; set; } + public int Type { get; set; } + public string? FileMeta { get; set; } + public long? AccountId { get; set; } + public string? Description { get; set; } + public long? ScheduledStatusId { get; set; } + public string? Blurhash { get; set; } + public int? Processing { get; set; } + public int? FileStorageSchemaVersion { get; set; } + public string? ThumbnailFileName { get; set; } + public string? ThumbnailContentType { get; set; } + public int? ThumbnailFileSize { get; set; } + public DateTime? ThumbnailUpdatedAt { get; set; } + public string? ThumbnailRemoteUrl { get; set; } + + public virtual Account? Account { get; set; } + public virtual ScheduledStatus? ScheduledStatus { get; set; } + public virtual Status? Status { get; set; } + } +} diff --git a/src/Domain/Models/Mention.cs b/src/Domain/Models/Mention.cs new file mode 100644 index 0000000..7c6d59b --- /dev/null +++ b/src/Domain/Models/Mention.cs @@ -0,0 +1,15 @@ +namespace Smilodon.Domain.Models +{ + public class Mention + { + public long Id { get; set; } + public long? StatusId { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public long? AccountId { get; set; } + public bool Silent { get; set; } + + public virtual Account? Account { get; set; } + public virtual Status? Status { get; set; } + } +} diff --git a/src/Domain/Models/Mute.cs b/src/Domain/Models/Mute.cs new file mode 100644 index 0000000..b20c54c --- /dev/null +++ b/src/Domain/Models/Mute.cs @@ -0,0 +1,16 @@ +namespace Smilodon.Domain.Models +{ + public class Mute + { + public long Id { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public bool HideNotifications { get; set; } + public long AccountId { get; set; } + public long TargetAccountId { get; set; } + public DateTime? ExpiresAt { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual Account TargetAccount { get; set; } = null!; + } +} diff --git a/src/Domain/Models/Notification.cs b/src/Domain/Models/Notification.cs new file mode 100644 index 0000000..4fafe7a --- /dev/null +++ b/src/Domain/Models/Notification.cs @@ -0,0 +1,17 @@ +namespace Smilodon.Domain.Models +{ + public class Notification + { + public long Id { get; set; } + public long ActivityId { get; set; } + public string ActivityType { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public long AccountId { get; set; } + public long FromAccountId { get; set; } + public string? Type { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual Account FromAccount { get; set; } = null!; + } +} diff --git a/src/Domain/Models/OAuthAccessGrant.cs b/src/Domain/Models/OAuthAccessGrant.cs new file mode 100644 index 0000000..b92e0a2 --- /dev/null +++ b/src/Domain/Models/OAuthAccessGrant.cs @@ -0,0 +1,18 @@ +namespace Smilodon.Domain.Models +{ + public class OAuthAccessGrant + { + public long Id { get; set; } + public string Token { get; set; } = null!; + public int ExpiresIn { get; set; } + public string RedirectUri { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime? RevokedAt { get; set; } + public string? Scopes { get; set; } + public long ApplicationId { get; set; } + public long ResourceOwnerId { get; set; } + + public virtual OAuthApplication Application { get; set; } = null!; + public virtual User ResourceOwner { get; set; } = null!; + } +} diff --git a/src/Domain/Models/OAuthAccessToken.cs b/src/Domain/Models/OAuthAccessToken.cs new file mode 100644 index 0000000..ce8d4b5 --- /dev/null +++ b/src/Domain/Models/OAuthAccessToken.cs @@ -0,0 +1,25 @@ +using System.Net; + +namespace Smilodon.Domain.Models +{ + public class OAuthAccessToken + { + public long Id { get; set; } + public string Token { get; set; } = null!; + public string? RefreshToken { get; set; } + public int? ExpiresIn { get; set; } + public DateTime? RevokedAt { get; set; } + public DateTime CreatedAt { get; set; } + public string? Scopes { get; set; } + public long? ApplicationId { get; set; } + public long? ResourceOwnerId { get; set; } + public DateTime? LastUsedAt { get; set; } + public IPAddress? LastUsedIp { get; set; } + + public virtual OAuthApplication? Application { get; set; } + public virtual User? ResourceOwner { get; set; } + public virtual ICollection Devices { get; set; } = new HashSet(); + public virtual ICollection SessionActivations { get; set; } = new HashSet(); + public virtual ICollection WebPushSubscriptions { get; set; } = new HashSet(); + } +} diff --git a/src/Domain/Models/OAuthApplication.cs b/src/Domain/Models/OAuthApplication.cs new file mode 100644 index 0000000..1318996 --- /dev/null +++ b/src/Domain/Models/OAuthApplication.cs @@ -0,0 +1,24 @@ +namespace Smilodon.Domain.Models +{ + public class OAuthApplication + { + public long Id { get; set; } + public string Name { get; set; } = null!; + public string Uid { get; set; } = null!; + public string Secret { get; set; } = null!; + public string RedirectUri { get; set; } = null!; + public string Scopes { get; set; } = null!; + public DateTime? CreatedAt { get; set; } + public DateTime? UpdatedAt { get; set; } + public bool Superapp { get; set; } + public string? Website { get; set; } + public string? OwnerType { get; set; } + public long? OwnerId { get; set; } + public bool Confidential { get; set; } + + public virtual User? Owner { get; set; } + public virtual ICollection OAuthAccessGrants { get; set; } = new HashSet(); + public virtual ICollection OAuthAccessTokens { get; set; } = new HashSet(); + public virtual ICollection Users { get; set; } = new HashSet(); + } +} diff --git a/src/Domain/Models/OneTimeKey.cs b/src/Domain/Models/OneTimeKey.cs new file mode 100644 index 0000000..c9ba41b --- /dev/null +++ b/src/Domain/Models/OneTimeKey.cs @@ -0,0 +1,15 @@ +namespace Smilodon.Domain.Models +{ + public class OneTimeKey + { + public long Id { get; set; } + public long? DeviceId { get; set; } + public string KeyId { get; set; } = null!; + public string Key { get; set; } = null!; + public string Signature { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual Device? Device { get; set; } + } +} diff --git a/src/Domain/Models/PgheroSpaceStat.cs b/src/Domain/Models/PgheroSpaceStat.cs new file mode 100644 index 0000000..e0ad123 --- /dev/null +++ b/src/Domain/Models/PgheroSpaceStat.cs @@ -0,0 +1,12 @@ +namespace Smilodon.Domain.Models +{ + public class PgheroSpaceStat + { + public long Id { get; set; } + public string? Database { get; set; } + public string? Schema { get; set; } + public string? Relation { get; set; } + public long? Size { get; set; } + public DateTime? CapturedAt { get; set; } + } +} diff --git a/src/Domain/Models/Poll.cs b/src/Domain/Models/Poll.cs new file mode 100644 index 0000000..2b49e71 --- /dev/null +++ b/src/Domain/Models/Poll.cs @@ -0,0 +1,24 @@ +namespace Smilodon.Domain.Models +{ + public class Poll + { + public long Id { get; set; } + public long? AccountId { get; set; } + public long? StatusId { get; set; } + public DateTime? ExpiresAt { get; set; } + public string[] Options { get; set; } = null!; + public long[] CachedTallies { get; set; } = null!; + public bool Multiple { get; set; } + public bool HideTotals { get; set; } + public long VotesCount { get; set; } + public DateTime? LastFetchedAt { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public int LockVersion { get; set; } + public long? VotersCount { get; set; } + + public virtual Account? Account { get; set; } + public virtual Status? Status { get; set; } + public virtual ICollection PollVotes { get; set; } = new HashSet(); + } +} diff --git a/src/Domain/Models/PollVote.cs b/src/Domain/Models/PollVote.cs new file mode 100644 index 0000000..56f680c --- /dev/null +++ b/src/Domain/Models/PollVote.cs @@ -0,0 +1,16 @@ +namespace Smilodon.Domain.Models +{ + public class PollVote + { + public long Id { get; set; } + public long? AccountId { get; set; } + public long? PollId { get; set; } + public int Choice { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public string? Uri { get; set; } + + public virtual Account? Account { get; set; } + public virtual Poll? Poll { get; set; } + } +} diff --git a/src/Domain/Models/PreviewCard.cs b/src/Domain/Models/PreviewCard.cs new file mode 100644 index 0000000..1613847 --- /dev/null +++ b/src/Domain/Models/PreviewCard.cs @@ -0,0 +1,34 @@ +namespace Smilodon.Domain.Models +{ + public class PreviewCard + { + public long Id { get; set; } + public string Url { get; set; } = null!; + public string Title { get; set; } = null!; + public string Description { get; set; } = null!; + public string? ImageFileName { get; set; } + public string? ImageContentType { get; set; } + public int? ImageFileSize { get; set; } + public DateTime? ImageUpdatedAt { get; set; } + public int Type { get; set; } + public string Html { get; set; } = null!; + public string AuthorName { get; set; } = null!; + public string AuthorUrl { get; set; } = null!; + public string ProviderName { get; set; } = null!; + public string ProviderUrl { get; set; } = null!; + public int Width { get; set; } + public int Height { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public string EmbedUrl { get; set; } = null!; + public int? ImageStorageSchemaVersion { get; set; } + public string? Blurhash { get; set; } + public string? Language { get; set; } + public double? MaxScore { get; set; } + public DateTime? MaxScoreAt { get; set; } + public bool? Trendable { get; set; } + public int? LinkType { get; set; } + + public virtual PreviewCardTrend PreviewCardTrend { get; set; } = null!; + } +} diff --git a/src/Domain/Models/PreviewCardProvider.cs b/src/Domain/Models/PreviewCardProvider.cs new file mode 100644 index 0000000..1f83ff5 --- /dev/null +++ b/src/Domain/Models/PreviewCardProvider.cs @@ -0,0 +1,17 @@ +namespace Smilodon.Domain.Models +{ + public class PreviewCardProvider + { + public long Id { get; set; } + public string Domain { get; set; } = null!; + public string? IconFileName { get; set; } + public string? IconContentType { get; set; } + public long? IconFileSize { get; set; } + public DateTime? IconUpdatedAt { get; set; } + public bool? Trendable { get; set; } + public DateTime? ReviewedAt { get; set; } + public DateTime? RequestedReviewAt { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + } +} diff --git a/src/Domain/Models/PreviewCardStatus.cs b/src/Domain/Models/PreviewCardStatus.cs new file mode 100644 index 0000000..a25919a --- /dev/null +++ b/src/Domain/Models/PreviewCardStatus.cs @@ -0,0 +1,8 @@ +namespace Smilodon.Domain.Models +{ + public class PreviewCardStatus + { + public long PreviewCardId { get; set; } + public long StatusId { get; set; } + } +} diff --git a/src/Domain/Models/PreviewCardTrend.cs b/src/Domain/Models/PreviewCardTrend.cs new file mode 100644 index 0000000..afbe6b9 --- /dev/null +++ b/src/Domain/Models/PreviewCardTrend.cs @@ -0,0 +1,14 @@ +namespace Smilodon.Domain.Models +{ + public class PreviewCardTrend + { + public long Id { get; set; } + public long PreviewCardId { get; set; } + public double Score { get; set; } + public int Rank { get; set; } + public bool Allowed { get; set; } + public string? Language { get; set; } + + public virtual PreviewCard PreviewCard { get; set; } = null!; + } +} diff --git a/src/Domain/Models/Relay.cs b/src/Domain/Models/Relay.cs new file mode 100644 index 0000000..5b3049a --- /dev/null +++ b/src/Domain/Models/Relay.cs @@ -0,0 +1,12 @@ +namespace Smilodon.Domain.Models +{ + public class Relay + { + public long Id { get; set; } + public string InboxUrl { get; set; } = null!; + public string? FollowActivityId { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public int State { get; set; } + } +} diff --git a/src/Domain/Models/Report.cs b/src/Domain/Models/Report.cs new file mode 100644 index 0000000..01e389f --- /dev/null +++ b/src/Domain/Models/Report.cs @@ -0,0 +1,27 @@ +namespace Smilodon.Domain.Models +{ + public class Report + { + public long Id { get; set; } + public long[] StatusIds { get; set; } = null!; + public string Comment { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public long AccountId { get; set; } + public long? ActionTakenByAccountId { get; set; } + public long TargetAccountId { get; set; } + public long? AssignedAccountId { get; set; } + public string? Uri { get; set; } + public bool? Forwarded { get; set; } + public int Category { get; set; } + public DateTime? ActionTakenAt { get; set; } + public long[]? RuleIds { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual Account? ActionTakenByAccount { get; set; } + public virtual Account? AssignedAccount { get; set; } + public virtual Account TargetAccount { get; set; } = null!; + public virtual ICollection AccountWarnings { get; set; } = new HashSet(); + public virtual ICollection ReportNotes { get; set; } = new HashSet(); + } +} diff --git a/src/Domain/Models/ReportNote.cs b/src/Domain/Models/ReportNote.cs new file mode 100644 index 0000000..bae11f1 --- /dev/null +++ b/src/Domain/Models/ReportNote.cs @@ -0,0 +1,15 @@ +namespace Smilodon.Domain.Models +{ + public class ReportNote + { + public long Id { get; set; } + public string Content { get; set; } = null!; + public long ReportId { get; set; } + public long AccountId { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual Report Report { get; set; } = null!; + } +} diff --git a/src/Domain/Models/Rule.cs b/src/Domain/Models/Rule.cs new file mode 100644 index 0000000..fa37cd6 --- /dev/null +++ b/src/Domain/Models/Rule.cs @@ -0,0 +1,12 @@ +namespace Smilodon.Domain.Models +{ + public class Rule + { + public long Id { get; set; } + public int Priority { get; set; } + public DateTime? DeletedAt { get; set; } + public string Text { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + } +} diff --git a/src/Domain/Models/ScheduledStatus.cs b/src/Domain/Models/ScheduledStatus.cs new file mode 100644 index 0000000..9ef2575 --- /dev/null +++ b/src/Domain/Models/ScheduledStatus.cs @@ -0,0 +1,13 @@ +namespace Smilodon.Domain.Models +{ + public class ScheduledStatus + { + public long Id { get; set; } + public long? AccountId { get; set; } + public DateTime? ScheduledAt { get; set; } + public string? Params { get; set; } + + public virtual Account? Account { get; set; } + public virtual ICollection MediaAttachments { get; set; } = new HashSet(); + } +} diff --git a/src/Domain/Models/SessionActivation.cs b/src/Domain/Models/SessionActivation.cs new file mode 100644 index 0000000..3e960aa --- /dev/null +++ b/src/Domain/Models/SessionActivation.cs @@ -0,0 +1,20 @@ +using System.Net; + +namespace Smilodon.Domain.Models +{ + public class SessionActivation + { + public long Id { get; set; } + public string SessionId { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public string UserAgent { get; set; } = null!; + public IPAddress? Ip { get; set; } + public long? AccessTokenId { get; set; } + public long UserId { get; set; } + public long? WebPushSubscriptionId { get; set; } + + public virtual OAuthAccessToken? AccessToken { get; set; } + public virtual User User { get; set; } = null!; + } +} diff --git a/src/Domain/Models/Setting.cs b/src/Domain/Models/Setting.cs new file mode 100644 index 0000000..1db2cec --- /dev/null +++ b/src/Domain/Models/Setting.cs @@ -0,0 +1,13 @@ +namespace Smilodon.Domain.Models +{ + public class Setting + { + public long Id { get; set; } + public string Var { get; set; } = null!; + public string? Value { get; set; } + public string? ThingType { get; set; } + public DateTime? CreatedAt { get; set; } + public DateTime? UpdatedAt { get; set; } + public long? ThingId { get; set; } + } +} diff --git a/src/Domain/Models/SiteUpload.cs b/src/Domain/Models/SiteUpload.cs new file mode 100644 index 0000000..4e18f3f --- /dev/null +++ b/src/Domain/Models/SiteUpload.cs @@ -0,0 +1,16 @@ +namespace Smilodon.Domain.Models +{ + public class SiteUpload + { + public long Id { get; set; } + public string Var { get; set; } = null!; + public string? FileFileName { get; set; } + public string? FileContentType { get; set; } + public int? FileFileSize { get; set; } + public DateTime? FileUpdatedAt { get; set; } + public string? Meta { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public string? Blurhash { get; set; } + } +} diff --git a/src/Domain/Models/Status.cs b/src/Domain/Models/Status.cs new file mode 100644 index 0000000..564f411 --- /dev/null +++ b/src/Domain/Models/Status.cs @@ -0,0 +1,46 @@ +namespace Smilodon.Domain.Models +{ + public class Status + { + public long Id { get; set; } + public string? Uri { get; set; } + public string Text { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public long? InReplyToId { get; set; } + public long? ReblogOfId { get; set; } + public string? Url { get; set; } + public bool Sensitive { get; set; } + public int Visibility { get; set; } + public string SpoilerText { get; set; } = null!; + public bool Reply { get; set; } + public string? Language { get; set; } + public long? ConversationId { get; set; } + public bool? Local { get; set; } + public long AccountId { get; set; } + public long? ApplicationId { get; set; } + public long? InReplyToAccountId { get; set; } + public long? PollId { get; set; } + public DateTime? DeletedAt { get; set; } + public DateTime? EditedAt { get; set; } + public bool? Trendable { get; set; } + public long[]? OrderedMediaAttachmentIds { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual Status? InReplyTo { get; set; } + public virtual Account? InReplyToAccount { get; set; } + public virtual Status? ReblogOf { get; set; } + public virtual StatusStat StatusStat { get; set; } = null!; + public virtual StatusTrend StatusTrend { get; set; } = null!; + public virtual ICollection Bookmarks { get; set; } = new HashSet(); + public virtual ICollection CustomFilterStatuses { get; set; } = new HashSet(); + public virtual ICollection Favourites { get; set; } = new HashSet(); + public virtual ICollection InverseInReplyTo { get; set; } = new HashSet(); + public virtual ICollection InverseReblogOf { get; set; } = new HashSet(); + public virtual ICollection MediaAttachments { get; set; } = new HashSet(); + public virtual ICollection Mentions { get; set; } = new HashSet(); + public virtual ICollection Polls { get; set; } = new HashSet(); + public virtual ICollection StatusEdits { get; set; } = new HashSet(); + public virtual ICollection StatusPins { get; set; } = new HashSet(); + } +} diff --git a/src/Domain/Models/StatusEdit.cs b/src/Domain/Models/StatusEdit.cs new file mode 100644 index 0000000..4acae7a --- /dev/null +++ b/src/Domain/Models/StatusEdit.cs @@ -0,0 +1,20 @@ +namespace Smilodon.Domain.Models +{ + public class StatusEdit + { + public long Id { get; set; } + public long StatusId { get; set; } + public long? AccountId { get; set; } + public string Text { get; set; } = null!; + public string SpoilerText { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public long[]? OrderedMediaAttachmentIds { get; set; } + public string[]? MediaDescriptions { get; set; } + public string[]? PollOptions { get; set; } + public bool? Sensitive { get; set; } + + public virtual Account? Account { get; set; } + public virtual Status Status { get; set; } = null!; + } +} diff --git a/src/Domain/Models/StatusPin.cs b/src/Domain/Models/StatusPin.cs new file mode 100644 index 0000000..8c7fb43 --- /dev/null +++ b/src/Domain/Models/StatusPin.cs @@ -0,0 +1,14 @@ +namespace Smilodon.Domain.Models +{ + public class StatusPin + { + public long Id { get; set; } + public long AccountId { get; set; } + public long StatusId { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual Status Status { get; set; } = null!; + } +} diff --git a/src/Domain/Models/StatusStat.cs b/src/Domain/Models/StatusStat.cs new file mode 100644 index 0000000..1e31b3a --- /dev/null +++ b/src/Domain/Models/StatusStat.cs @@ -0,0 +1,15 @@ +namespace Smilodon.Domain.Models +{ + public class StatusStat + { + public long Id { get; set; } + public long StatusId { get; set; } + public long RepliesCount { get; set; } + public long ReblogsCount { get; set; } + public long FavouritesCount { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual Status Status { get; set; } = null!; + } +} diff --git a/src/Domain/Models/StatusTag.cs b/src/Domain/Models/StatusTag.cs new file mode 100644 index 0000000..210ac6d --- /dev/null +++ b/src/Domain/Models/StatusTag.cs @@ -0,0 +1,11 @@ +namespace Smilodon.Domain.Models +{ + public class StatusTag + { + public long StatusId { get; set; } + public long TagId { get; set; } + + public virtual Status Status { get; set; } = null!; + public virtual Tag Tag { get; set; } = null!; + } +} diff --git a/src/Domain/Models/StatusTrend.cs b/src/Domain/Models/StatusTrend.cs new file mode 100644 index 0000000..0eea60f --- /dev/null +++ b/src/Domain/Models/StatusTrend.cs @@ -0,0 +1,16 @@ +namespace Smilodon.Domain.Models +{ + public class StatusTrend + { + public long Id { get; set; } + public long StatusId { get; set; } + public long AccountId { get; set; } + public double Score { get; set; } + public int Rank { get; set; } + public bool Allowed { get; set; } + public string? Language { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual Status Status { get; set; } = null!; + } +} diff --git a/src/Domain/Models/SystemKey.cs b/src/Domain/Models/SystemKey.cs new file mode 100644 index 0000000..a2dc564 --- /dev/null +++ b/src/Domain/Models/SystemKey.cs @@ -0,0 +1,10 @@ +namespace Smilodon.Domain.Models +{ + public class SystemKey + { + public long Id { get; set; } + public byte[]? Key { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + } +} diff --git a/src/Domain/Models/Tag.cs b/src/Domain/Models/Tag.cs new file mode 100644 index 0000000..f656f43 --- /dev/null +++ b/src/Domain/Models/Tag.cs @@ -0,0 +1,22 @@ +namespace Smilodon.Domain.Models +{ + public class Tag + { + public long Id { get; set; } + public string Name { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public bool? Usable { get; set; } + public bool? Trendable { get; set; } + public bool? Listable { get; set; } + public DateTime? ReviewedAt { get; set; } + public DateTime? RequestedReviewAt { get; set; } + public DateTime? LastStatusAt { get; set; } + public double? MaxScore { get; set; } + public DateTime? MaxScoreAt { get; set; } + public string? DisplayName { get; set; } + + public virtual ICollection FeaturedTags { get; set; } = new HashSet(); + public virtual ICollection TagFollows { get; set; } = new HashSet(); + } +} diff --git a/src/Domain/Models/TagFollow.cs b/src/Domain/Models/TagFollow.cs new file mode 100644 index 0000000..568f851 --- /dev/null +++ b/src/Domain/Models/TagFollow.cs @@ -0,0 +1,14 @@ +namespace Smilodon.Domain.Models +{ + public class TagFollow + { + public long Id { get; set; } + public long TagId { get; set; } + public long AccountId { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual Tag Tag { get; set; } = null!; + } +} diff --git a/src/Domain/Models/Tombstone.cs b/src/Domain/Models/Tombstone.cs new file mode 100644 index 0000000..1946735 --- /dev/null +++ b/src/Domain/Models/Tombstone.cs @@ -0,0 +1,14 @@ +namespace Smilodon.Domain.Models +{ + public class Tombstone + { + public long Id { get; set; } + public long? AccountId { get; set; } + public string Uri { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public bool? ByModerator { get; set; } + + public virtual Account? Account { get; set; } + } +} diff --git a/src/Domain/Models/UnavailableDomain.cs b/src/Domain/Models/UnavailableDomain.cs new file mode 100644 index 0000000..3b06e53 --- /dev/null +++ b/src/Domain/Models/UnavailableDomain.cs @@ -0,0 +1,10 @@ +namespace Smilodon.Domain.Models +{ + public class UnavailableDomain + { + public long Id { get; set; } + public string Domain { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + } +} diff --git a/src/Domain/Models/User.cs b/src/Domain/Models/User.cs new file mode 100644 index 0000000..fb2215c --- /dev/null +++ b/src/Domain/Models/User.cs @@ -0,0 +1,62 @@ +using System.Net; + +namespace Smilodon.Domain.Models +{ + public class User + { + public long Id { get; set; } + public string Email { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public string EncryptedPassword { get; set; } = null!; + public string? ResetPasswordToken { get; set; } + public DateTime? ResetPasswordSentAt { get; set; } + public int SignInCount { get; set; } + public DateTime? CurrentSignInAt { get; set; } + public DateTime? LastSignInAt { get; set; } + public bool Admin { get; set; } + public string? ConfirmationToken { get; set; } + public DateTime? ConfirmedAt { get; set; } + public DateTime? ConfirmationSentAt { get; set; } + public string? UnconfirmedEmail { get; set; } + public string? Locale { get; set; } + public string? EncryptedOtpSecret { get; set; } + public string? EncryptedOtpSecretIv { get; set; } + public string? EncryptedOtpSecretSalt { get; set; } + public int? ConsumedTimestep { get; set; } + public bool OtpRequiredForLogin { get; set; } + public DateTime? LastEmailedAt { get; set; } + public string[]? OtpBackupCodes { get; set; } + public long AccountId { get; set; } + public bool Disabled { get; set; } + public bool Moderator { get; set; } + public long? InviteId { get; set; } + public string[]? ChosenLanguages { get; set; } + public long? CreatedByApplicationId { get; set; } + public bool Approved { get; set; } + public string? SignInToken { get; set; } + public DateTime? SignInTokenSentAt { get; set; } + public string? WebAuthnId { get; set; } + public IPAddress? SignUpIp { get; set; } + public bool? SkipSignInToken { get; set; } + public long? RoleId { get; set; } + + public virtual Account Account { get; set; } = null!; + public virtual OAuthApplication? CreatedByApplication { get; set; } + public virtual Invite? Invite { get; set; } + public virtual UserRole? Role { get; set; } + public virtual WebSetting WebSetting { get; set; } = null!; + public virtual ICollection Backups { get; set; } = new HashSet(); + public virtual ICollection Identities { get; set; } = new HashSet(); + public virtual ICollection Invites { get; set; } = new HashSet(); + public virtual ICollection LoginActivities { get; set; } = new HashSet(); + public virtual ICollection Markers { get; set; } = new HashSet(); + public virtual ICollection OAuthAccessGrants { get; set; } = new HashSet(); + public virtual ICollection OAuthAccessTokens { get; set; } = new HashSet(); + public virtual ICollection OAuthApplications { get; set; } = new HashSet(); + public virtual ICollection SessionActivations { get; set; } = new HashSet(); + public virtual ICollection UserInviteRequests { get; set; } = new HashSet(); + public virtual ICollection WebPushSubscriptions { get; set; } = new HashSet(); + public virtual ICollection WebAuthnCredentials { get; set; } = new HashSet(); + } +} diff --git a/src/Domain/Models/UserInviteRequest.cs b/src/Domain/Models/UserInviteRequest.cs new file mode 100644 index 0000000..7e2c4b5 --- /dev/null +++ b/src/Domain/Models/UserInviteRequest.cs @@ -0,0 +1,13 @@ +namespace Smilodon.Domain.Models +{ + public class UserInviteRequest + { + public long Id { get; set; } + public long? UserId { get; set; } + public string? Text { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual User? User { get; set; } + } +} diff --git a/src/Domain/Models/UserIp.cs b/src/Domain/Models/UserIp.cs new file mode 100644 index 0000000..0ea3c3e --- /dev/null +++ b/src/Domain/Models/UserIp.cs @@ -0,0 +1,11 @@ +using System.Net; + +namespace Smilodon.Domain.Models +{ + public class UserIp + { + public long? UserId { get; set; } + public IPAddress? Ip { get; set; } + public DateTime? UsedAt { get; set; } + } +} diff --git a/src/Domain/Models/UserRole.cs b/src/Domain/Models/UserRole.cs new file mode 100644 index 0000000..cfa0784 --- /dev/null +++ b/src/Domain/Models/UserRole.cs @@ -0,0 +1,16 @@ +namespace Smilodon.Domain.Models +{ + public class UserRole + { + public long Id { get; set; } + public string Name { get; set; } = null!; + public string Color { get; set; } = null!; + public int Position { get; set; } + public long Permissions { get; set; } + public bool Highlighted { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual ICollection Users { get; set; } = new HashSet(); + } +} diff --git a/src/Domain/Models/WebAuthnCredential.cs b/src/Domain/Models/WebAuthnCredential.cs new file mode 100644 index 0000000..6c6e807 --- /dev/null +++ b/src/Domain/Models/WebAuthnCredential.cs @@ -0,0 +1,16 @@ +namespace Smilodon.Domain.Models +{ + public class WebAuthnCredential + { + public long Id { get; set; } + public string ExternalId { get; set; } = null!; + public string PublicKey { get; set; } = null!; + public string Nickname { get; set; } = null!; + public long SignCount { get; set; } + public long? UserId { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + + public virtual User? User { get; set; } + } +} diff --git a/src/Domain/Models/WebPushSubscription.cs b/src/Domain/Models/WebPushSubscription.cs new file mode 100644 index 0000000..e7a4052 --- /dev/null +++ b/src/Domain/Models/WebPushSubscription.cs @@ -0,0 +1,18 @@ +namespace Smilodon.Domain.Models +{ + public class WebPushSubscription + { + public long Id { get; set; } + public string Endpoint { get; set; } = null!; + public string KeyP256dh { get; set; } = null!; + public string KeyAuth { get; set; } = null!; + public string? Data { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public long? AccessTokenId { get; set; } + public long? UserId { get; set; } + + public virtual OAuthAccessToken? AccessToken { get; set; } + public virtual User? User { get; set; } + } +} diff --git a/src/Domain/Models/WebSetting.cs b/src/Domain/Models/WebSetting.cs new file mode 100644 index 0000000..2942ae9 --- /dev/null +++ b/src/Domain/Models/WebSetting.cs @@ -0,0 +1,13 @@ +namespace Smilodon.Domain.Models +{ + public class WebSetting + { + public long Id { get; set; } + public string? Data { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public long UserId { get; set; } + + public virtual User User { get; set; } = null!; + } +} diff --git a/src/Domain/Models/Webhook.cs b/src/Domain/Models/Webhook.cs new file mode 100644 index 0000000..85feefd --- /dev/null +++ b/src/Domain/Models/Webhook.cs @@ -0,0 +1,13 @@ +namespace Smilodon.Domain.Models +{ + public class Webhook + { + public long Id { get; set; } + public string Url { get; set; } = null!; + public string[] Events { get; set; } = null!; + public string Secret { get; set; } = null!; + public bool Enabled { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + } +} diff --git a/src/Infrastructure/Infrastructure.csproj b/src/Infrastructure/Infrastructure.csproj new file mode 100644 index 0000000..58d5827 --- /dev/null +++ b/src/Infrastructure/Infrastructure.csproj @@ -0,0 +1,24 @@ + + + + net7.0 + enable + enable + true + Smilodon.Infrastructure + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + diff --git a/src/Infrastructure/Persistence/Configuration/AccountAliasEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AccountAliasEntityConfiguration.cs new file mode 100644 index 0000000..4158710 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AccountAliasEntityConfiguration.cs @@ -0,0 +1,45 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AccountAliasEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("account_aliases"); + + builder.HasKey(e => e.Id).HasName("account_aliases_pkey"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_account_aliases_on_account_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.Acct) + .HasColumnType("character varying") + .HasColumnName("acct") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.Uri) + .HasColumnType("character varying") + .HasColumnName("uri") + .HasDefaultValueSql("''::character varying"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.AccountAliases) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_fc91575d08"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/AccountConversationEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AccountConversationEntityConfiguration.cs new file mode 100644 index 0000000..e5b3bd4 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AccountConversationEntityConfiguration.cs @@ -0,0 +1,54 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AccountConversationEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("account_conversations"); + + builder.HasKey(e => e.Id).HasName("account_conversations_pkey"); + + builder.HasIndex(e => e.ConversationId) + .HasDatabaseName("index_account_conversations_on_conversation_id"); + + builder.HasIndex(e => new { e.AccountId, e.ConversationId, e.ParticipantAccountIds }) + .HasDatabaseName("index_unique_conversations") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.ConversationId).HasColumnName("conversation_id"); + + builder.Property(e => e.LastStatusId).HasColumnName("last_status_id"); + + builder.Property(e => e.LockVersion).HasColumnName("lock_version"); + + builder.Property(e => e.ParticipantAccountIds) + .HasColumnName("participant_account_ids") + .HasDefaultValueSql("'{}'::bigint[]"); + + builder.Property(e => e.StatusIds) + .HasColumnName("status_ids") + .HasDefaultValueSql("'{}'::bigint[]"); + + builder.Property(e => e.Unread).HasColumnName("unread"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.AccountConversations) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_6f5278b6e9"); + + builder.HasOne(d => d.Conversation) + .WithMany(p => p.AccountConversations) + .HasForeignKey(d => d.ConversationId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_1491654f9f"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/AccountDeletionRequestEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AccountDeletionRequestEntityConfiguration.cs new file mode 100644 index 0000000..ea83072 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AccountDeletionRequestEntityConfiguration.cs @@ -0,0 +1,35 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AccountDeletionRequestEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("account_deletion_requests"); + + builder.HasKey(e => e.Id).HasName("account_deletion_requests_pkey"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_account_deletion_requests_on_account_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.AccountDeletionRequests) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_45bf2626b9"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/AccountDomainBlockEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AccountDomainBlockEntityConfiguration.cs new file mode 100644 index 0000000..ad3a7ba --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AccountDomainBlockEntityConfiguration.cs @@ -0,0 +1,41 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AccountDomainBlockEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("account_domain_blocks"); + + builder.HasKey(e => e.Id).HasName("account_domain_blocks_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.Domain }) + .HasDatabaseName("index_account_domain_blocks_on_account_id_and_domain") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Domain) + .HasColumnType("character varying") + .HasColumnName("domain"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.AccountDomainBlocks) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_206c6029bd"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/AccountEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AccountEntityConfiguration.cs new file mode 100644 index 0000000..584700b --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AccountEntityConfiguration.cs @@ -0,0 +1,198 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AccountEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("accounts"); + + builder.HasKey(e => e.Id).HasName("accounts_pkey"); + + builder.HasIndex(e => e.MovedToAccountId) + .HasDatabaseName("index_accounts_on_moved_to_account_id") + .HasFilter("(moved_to_account_id IS NOT NULL)"); + + builder.HasIndex(e => e.Uri).HasDatabaseName("index_accounts_on_uri"); + + builder.HasIndex(e => e.Url) + .HasDatabaseName("index_accounts_on_url") + .HasFilter("(url IS NOT NULL)") + .HasOperators("text_pattern_ops"); + + builder.Property(e => e.Id) + .HasColumnName("id") + .HasDefaultValueSql("timestamp_id('accounts'::text)"); + + builder.Property(e => e.ActorType) + .HasColumnType("character varying") + .HasColumnName("actor_type"); + + builder.Property(e => e.AlsoKnownAs) + .HasColumnType("character varying[]") + .HasColumnName("also_known_as"); + + builder.Property(e => e.AvatarContentType) + .HasColumnType("character varying") + .HasColumnName("avatar_content_type"); + + builder.Property(e => e.AvatarFileName) + .HasColumnType("character varying") + .HasColumnName("avatar_file_name"); + + builder.Property(e => e.AvatarFileSize).HasColumnName("avatar_file_size"); + + builder.Property(e => e.AvatarRemoteUrl) + .HasColumnType("character varying") + .HasColumnName("avatar_remote_url"); + + builder.Property(e => e.AvatarStorageSchemaVersion).HasColumnName("avatar_storage_schema_version"); + + builder.Property(e => e.AvatarUpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("avatar_updated_at"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.DevicesUrl) + .HasColumnType("character varying") + .HasColumnName("devices_url"); + + builder.Property(e => e.Discoverable).HasColumnName("discoverable"); + + builder.Property(e => e.DisplayName) + .HasColumnType("character varying") + .HasColumnName("display_name") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.Domain) + .HasColumnType("character varying") + .HasColumnName("domain"); + + builder.Property(e => e.FeaturedCollectionUrl) + .HasColumnType("character varying") + .HasColumnName("featured_collection_url"); + + builder.Property(e => e.Fields) + .HasColumnType("jsonb") + .HasColumnName("fields"); + + builder.Property(e => e.FollowersUrl) + .HasColumnType("character varying") + .HasColumnName("followers_url") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.HeaderContentType) + .HasColumnType("character varying") + .HasColumnName("header_content_type"); + + builder.Property(e => e.HeaderFileName) + .HasColumnType("character varying") + .HasColumnName("header_file_name"); + + builder.Property(e => e.HeaderFileSize).HasColumnName("header_file_size"); + + builder.Property(e => e.HeaderRemoteUrl) + .HasColumnType("character varying") + .HasColumnName("header_remote_url") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.HeaderStorageSchemaVersion).HasColumnName("header_storage_schema_version"); + + builder.Property(e => e.HeaderUpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("header_updated_at"); + + builder.Property(e => e.HideCollections).HasColumnName("hide_collections"); + + builder.Property(e => e.InboxUrl) + .HasColumnType("character varying") + .HasColumnName("inbox_url") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.LastWebfingeredAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("last_webfingered_at"); + + builder.Property(e => e.Locked).HasColumnName("locked"); + + builder.Property(e => e.Memorial).HasColumnName("memorial"); + + builder.Property(e => e.MovedToAccountId).HasColumnName("moved_to_account_id"); + + builder.Property(e => e.Note) + .HasColumnName("note") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.OutboxUrl) + .HasColumnType("character varying") + .HasColumnName("outbox_url") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.PrivateKey).HasColumnName("private_key"); + + builder.Property(e => e.Protocol).HasColumnName("protocol"); + + builder.Property(e => e.PublicKey) + .HasColumnName("public_key") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.RequestedReviewAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("requested_review_at"); + + builder.Property(e => e.ReviewedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("reviewed_at"); + + builder.Property(e => e.SensitizedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("sensitized_at"); + + builder.Property(e => e.SharedInboxUrl) + .HasColumnType("character varying") + .HasColumnName("shared_inbox_url") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.SilencedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("silenced_at"); + + builder.Property(e => e.SuspendedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("suspended_at"); + + builder.Property(e => e.SuspensionOrigin).HasColumnName("suspension_origin"); + + builder.Property(e => e.Trendable).HasColumnName("trendable"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.Uri) + .HasColumnType("character varying") + .HasColumnName("uri") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.Url) + .HasColumnType("character varying") + .HasColumnName("url"); + + builder.Property(e => e.Username) + .HasColumnType("character varying") + .HasColumnName("username") + .HasDefaultValueSql("''::character varying"); + + builder.HasOne(d => d.MovedToAccount) + .WithMany(p => p.InverseMovedToAccount) + .HasForeignKey(d => d.MovedToAccountId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_2320833084"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/AccountMigrationEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AccountMigrationEntityConfiguration.cs new file mode 100644 index 0000000..8436db0 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AccountMigrationEntityConfiguration.cs @@ -0,0 +1,54 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AccountMigrationEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("account_migrations"); + + builder.HasKey(e => e.Id).HasName("account_migrations_pkey"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_account_migrations_on_account_id"); + + builder.HasIndex(e => e.TargetAccountId) + .HasDatabaseName("index_account_migrations_on_target_account_id") + .HasFilter("(target_account_id IS NOT NULL)"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.Acct) + .HasColumnType("character varying") + .HasColumnName("acct") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.FollowersCount).HasColumnName("followers_count"); + + builder.Property(e => e.TargetAccountId).HasColumnName("target_account_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.AccountMigrationAccounts) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_c9f701caaf"); + + builder.HasOne(d => d.TargetAccount) + .WithMany(p => p.AccountMigrationTargetAccounts) + .HasForeignKey(d => d.TargetAccountId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_d9a8dad070"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/AccountModerationNoteEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AccountModerationNoteEntityConfiguration.cs new file mode 100644 index 0000000..195a0a5 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AccountModerationNoteEntityConfiguration.cs @@ -0,0 +1,47 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AccountModerationNoteEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("account_moderation_notes"); + + builder.HasKey(e => e.Id).HasName("account_moderation_notes_pkey"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_account_moderation_notes_on_account_id"); + + builder.HasIndex(e => e.TargetAccountId).HasDatabaseName("index_account_moderation_notes_on_target_account_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.Content).HasColumnName("content"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.TargetAccountId).HasColumnName("target_account_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.AccountModerationNoteAccounts) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("fk_rails_3f8b75089b"); + + builder.HasOne(d => d.TargetAccount) + .WithMany(p => p.AccountModerationNoteTargetAccounts) + .HasForeignKey(d => d.TargetAccountId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("fk_rails_dd62ed5ac3"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/AccountNoteEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AccountNoteEntityConfiguration.cs new file mode 100644 index 0000000..6f778aa --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AccountNoteEntityConfiguration.cs @@ -0,0 +1,49 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AccountNoteEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("account_notes"); + + builder.HasKey(e => e.Id).HasName("account_notes_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.TargetAccountId }) + .HasDatabaseName("index_account_notes_on_account_id_and_target_account_id") + .IsUnique(); + + builder.HasIndex(e => e.TargetAccountId).HasDatabaseName("index_account_notes_on_target_account_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.Comment).HasColumnName("comment"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.TargetAccountId).HasColumnName("target_account_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.AccountNoteAccounts) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_4ee4503c69"); + + builder.HasOne(d => d.TargetAccount) + .WithMany(p => p.AccountNoteTargetAccounts) + .HasForeignKey(d => d.TargetAccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_2801b48f1a"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/AccountPinEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AccountPinEntityConfiguration.cs new file mode 100644 index 0000000..578cc9b --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AccountPinEntityConfiguration.cs @@ -0,0 +1,47 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AccountPinEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("account_pins"); + + builder.HasKey(e => e.Id).HasName("account_pins_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.TargetAccountId }) + .HasDatabaseName("index_account_pins_on_account_id_and_target_account_id") + .IsUnique(); + + builder.HasIndex(e => e.TargetAccountId).HasDatabaseName("index_account_pins_on_target_account_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.TargetAccountId).HasColumnName("target_account_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.AccountPinAccounts) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_d44979e5dd"); + + builder.HasOne(d => d.TargetAccount) + .WithMany(p => p.AccountPinTargetAccounts) + .HasForeignKey(d => d.TargetAccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a176e26c37"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/AccountStatEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AccountStatEntityConfiguration.cs new file mode 100644 index 0000000..8cd9ff4 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AccountStatEntityConfiguration.cs @@ -0,0 +1,46 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AccountStatEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("account_stats"); + + builder.HasKey(e => e.Id).HasName("account_stats_pkey"); + + builder.HasIndex(e => e.AccountId) + .HasDatabaseName("index_account_stats_on_account_id") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.FollowersCount).HasColumnName("followers_count"); + + builder.Property(e => e.FollowingCount).HasColumnName("following_count"); + + builder.Property(e => e.LastStatusAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("last_status_at"); + + builder.Property(e => e.StatusesCount).HasColumnName("statuses_count"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithOne(p => p.AccountStat) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_rails_215bb31ff1"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/AccountStatusesCleanupPolicyEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AccountStatusesCleanupPolicyEntityConfiguration.cs new file mode 100644 index 0000000..b01b16e --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AccountStatusesCleanupPolicyEntityConfiguration.cs @@ -0,0 +1,71 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AccountStatusesCleanupPolicyEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("account_statuses_cleanup_policies"); + + builder.HasKey(e => e.Id).HasName("account_statuses_cleanup_policies_pkey"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_account_statuses_cleanup_policies_on_account_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Enabled) + .IsRequired() + .HasColumnName("enabled") + .HasDefaultValueSql("true"); + + builder.Property(e => e.KeepDirect) + .IsRequired() + .HasColumnName("keep_direct") + .HasDefaultValueSql("true"); + + builder.Property(e => e.KeepMedia).HasColumnName("keep_media"); + + builder.Property(e => e.KeepPinned) + .IsRequired() + .HasColumnName("keep_pinned") + .HasDefaultValueSql("true"); + + builder.Property(e => e.KeepPolls).HasColumnName("keep_polls"); + + builder.Property(e => e.KeepSelfBookmark) + .IsRequired() + .HasColumnName("keep_self_bookmark") + .HasDefaultValueSql("true"); + + builder.Property(e => e.KeepSelfFav) + .IsRequired() + .HasColumnName("keep_self_fav") + .HasDefaultValueSql("true"); + + builder.Property(e => e.MinFavs).HasColumnName("min_favs"); + + builder.Property(e => e.MinReblogs).HasColumnName("min_reblogs"); + + builder.Property(e => e.MinStatusAge) + .HasColumnName("min_status_age") + .HasDefaultValueSql("1209600"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.AccountStatusesCleanupPolicies) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_rails_23d5f73cfe"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/AccountSummaryEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AccountSummaryEntityConfiguration.cs new file mode 100644 index 0000000..f205efe --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AccountSummaryEntityConfiguration.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AccountSummaryEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.HasNoKey(); + + builder.ToView("account_summaries"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.Language) + .HasColumnType("character varying") + .HasColumnName("language"); + + builder.Property(e => e.Sensitive).HasColumnName("sensitive"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/AccountTagEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AccountTagEntityConfiguration.cs new file mode 100644 index 0000000..a359113 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AccountTagEntityConfiguration.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AccountTagEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.HasNoKey(); + + builder.ToTable("accounts_tags"); + + builder.HasIndex(e => new { e.AccountId, e.TagId }) + .HasDatabaseName("index_accounts_tags_on_account_id_and_tag_id"); + + builder.HasIndex(e => new { e.TagId, e.AccountId }) + .HasDatabaseName("index_accounts_tags_on_tag_id_and_account_id") + .IsUnique(); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.TagId).HasColumnName("tag_id"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/AccountWarningEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AccountWarningEntityConfiguration.cs new file mode 100644 index 0000000..01a9244 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AccountWarningEntityConfiguration.cs @@ -0,0 +1,67 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AccountWarningEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("account_warnings"); + + builder.HasKey(e => e.Id).HasName("account_warnings_pkey"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_account_warnings_on_account_id"); + + builder.HasIndex(e => e.TargetAccountId).HasDatabaseName("index_account_warnings_on_target_account_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.Action).HasColumnName("action"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.OverruledAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("overruled_at"); + + builder.Property(e => e.ReportId).HasColumnName("report_id"); + + builder.Property(e => e.StatusIds) + .HasColumnType("character varying[]") + .HasColumnName("status_ids"); + + builder.Property(e => e.TargetAccountId).HasColumnName("target_account_id"); + + builder.Property(e => e.Text) + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.AccountWarningAccounts) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_a65a1bf71b"); + + builder.HasOne(d => d.Report) + .WithMany(p => p.AccountWarnings) + .HasForeignKey(d => d.ReportId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_8f2bab4b16"); + + builder.HasOne(d => d.TargetAccount) + .WithMany(p => p.AccountWarningTargetAccounts) + .HasForeignKey(d => d.TargetAccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a7ebbb1e37"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/AccountWarningPresetEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AccountWarningPresetEntityConfiguration.cs new file mode 100644 index 0000000..7e8f7ff --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AccountWarningPresetEntityConfiguration.cs @@ -0,0 +1,34 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AccountWarningPresetEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("account_warning_presets"); + + builder.HasKey(e => e.Id).HasName("account_warning_presets_pkey"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Text) + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.Title) + .HasColumnType("character varying") + .HasColumnName("title") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/AdminActionLogEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AdminActionLogEntityConfiguration.cs new file mode 100644 index 0000000..f6b16c7 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AdminActionLogEntityConfiguration.cs @@ -0,0 +1,61 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AdminActionLogEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("admin_action_logs"); + + builder.HasKey(e => e.Id).HasName("admin_action_logs_pkey"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_admin_action_logs_on_account_id"); + + builder.HasIndex(e => new { e.TargetType, e.TargetId }) + .HasDatabaseName("index_admin_action_logs_on_target_type_and_target_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.Action) + .HasColumnType("character varying") + .HasColumnName("action") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.HumanIdentifier) + .HasColumnType("character varying") + .HasColumnName("human_identifier"); + + builder.Property(e => e.Permalink) + .HasColumnType("character varying") + .HasColumnName("permalink"); + + builder.Property(e => e.RouteParam) + .HasColumnType("character varying") + .HasColumnName("route_param"); + + builder.Property(e => e.TargetId).HasColumnName("target_id"); + + builder.Property(e => e.TargetType) + .HasColumnType("character varying") + .HasColumnName("target_type"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.AdminActionLogs) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a7667297fa"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/AnnouncementEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AnnouncementEntityConfiguration.cs new file mode 100644 index 0000000..dc5a1f7 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AnnouncementEntityConfiguration.cs @@ -0,0 +1,51 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AnnouncementEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("announcements"); + + builder.HasKey(e => e.Id).HasName("announcements_pkey"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AllDay).HasColumnName("all_day"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.EndsAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("ends_at"); + + builder.Property(e => e.Published).HasColumnName("published"); + + builder.Property(e => e.PublishedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("published_at"); + + builder.Property(e => e.ScheduledAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("scheduled_at"); + + builder.Property(e => e.StartsAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("starts_at"); + + builder.Property(e => e.StatusIds).HasColumnName("status_ids"); + + builder.Property(e => e.Text) + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/AnnouncementMuteEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AnnouncementMuteEntityConfiguration.cs new file mode 100644 index 0000000..66185c0 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AnnouncementMuteEntityConfiguration.cs @@ -0,0 +1,48 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AnnouncementMuteEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("announcement_mutes"); + + builder.HasKey(e => e.Id).HasName("announcement_mutes_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.AnnouncementId }) + .HasDatabaseName("index_announcement_mutes_on_account_id_and_announcement_id") + .IsUnique(); + + builder.HasIndex(e => e.AnnouncementId) + .HasDatabaseName("index_announcement_mutes_on_announcement_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.AnnouncementId).HasColumnName("announcement_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.AnnouncementMutes) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_9c99f8e835"); + + builder.HasOne(d => d.Announcement) + .WithMany(p => p.AnnouncementMutes) + .HasForeignKey(d => d.AnnouncementId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_e35401adf1"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/AnnouncementReactionEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AnnouncementReactionEntityConfiguration.cs new file mode 100644 index 0000000..35eb64c --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AnnouncementReactionEntityConfiguration.cs @@ -0,0 +1,64 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AnnouncementReactionEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("announcement_reactions"); + + builder.HasKey(e => e.Id).HasName("announcement_reactions_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.AnnouncementId, e.Name }) + .HasDatabaseName("index_announcement_reactions_on_account_id_and_announcement_id") + .IsUnique(); + + builder.HasIndex(e => e.AnnouncementId).HasDatabaseName("index_announcement_reactions_on_announcement_id"); + + builder.HasIndex(e => e.CustomEmojiId) + .HasDatabaseName("index_announcement_reactions_on_custom_emoji_id") + .HasFilter("(custom_emoji_id IS NOT NULL)"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.AnnouncementId).HasColumnName("announcement_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.CustomEmojiId).HasColumnName("custom_emoji_id"); + + builder.Property(e => e.Name) + .HasColumnType("character varying") + .HasColumnName("name") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.AnnouncementReactions) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_7444ad831f"); + + builder.HasOne(d => d.Announcement) + .WithMany(p => p.AnnouncementReactions) + .HasForeignKey(d => d.AnnouncementId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a1226eaa5c"); + + builder.HasOne(d => d.CustomEmoji) + .WithMany(p => p.AnnouncementReactions) + .HasForeignKey(d => d.CustomEmojiId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_b742c91c0e"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/AppealEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/AppealEntityConfiguration.cs new file mode 100644 index 0000000..d14f0c9 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/AppealEntityConfiguration.cs @@ -0,0 +1,81 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class AppealEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("appeals"); + + builder.HasKey(e => e.Id).HasName("appeals_pkey"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_appeals_on_account_id"); + + builder.HasIndex(e => e.AccountWarningId) + .HasDatabaseName("index_appeals_on_account_warning_id") + .IsUnique(); + + builder.HasIndex(e => e.ApprovedByAccountId) + .HasDatabaseName("index_appeals_on_approved_by_account_id") + .HasFilter("(approved_by_account_id IS NOT NULL)"); + + builder.HasIndex(e => e.RejectedByAccountId) + .HasDatabaseName("index_appeals_on_rejected_by_account_id") + .HasFilter("(rejected_by_account_id IS NOT NULL)"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.AccountWarningId).HasColumnName("account_warning_id"); + + builder.Property(e => e.ApprovedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("approved_at"); + + builder.Property(e => e.ApprovedByAccountId).HasColumnName("approved_by_account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.RejectedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("rejected_at"); + + builder.Property(e => e.RejectedByAccountId).HasColumnName("rejected_by_account_id"); + + builder.Property(e => e.Text) + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.AppealAccounts) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_rails_ea84881569"); + + builder.HasOne(d => d.AccountWarning) + .WithOne(p => p.Appeal) + .HasForeignKey(d => d.AccountWarningId) + .HasConstraintName("fk_rails_a99f14546e"); + + builder.HasOne(d => d.ApprovedByAccount) + .WithMany(p => p.AppealApprovedByAccounts) + .HasForeignKey(d => d.ApprovedByAccountId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_9deb2f63ad"); + + builder.HasOne(d => d.RejectedByAccount) + .WithMany(p => p.AppealRejectedByAccounts) + .HasForeignKey(d => d.RejectedByAccountId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_501c3a6e13"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/ArInternalMetadatumEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/ArInternalMetadatumEntityConfiguration.cs new file mode 100644 index 0000000..ed9bc9a --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/ArInternalMetadatumEntityConfiguration.cs @@ -0,0 +1,32 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class ArInternalMetadatumEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.HasKey(e => e.Key) + .HasName("ar_internal_metadata_pkey"); + + builder.ToTable("ar_internal_metadata"); + + builder.Property(e => e.Key) + .HasColumnType("character varying") + .HasColumnName("key"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.Value) + .HasColumnType("character varying") + .HasColumnName("value"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/BackupsEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/BackupsEntityConfiguration.cs new file mode 100644 index 0000000..c064435 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/BackupsEntityConfiguration.cs @@ -0,0 +1,49 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class BackupsEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("backups"); + + builder.HasKey(e => e.Id).HasName("backups_pkey"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.DumpContentType) + .HasColumnType("character varying") + .HasColumnName("dump_content_type"); + + builder.Property(e => e.DumpFileName) + .HasColumnType("character varying") + .HasColumnName("dump_file_name"); + + builder.Property(e => e.DumpFileSize).HasColumnName("dump_file_size"); + + builder.Property(e => e.DumpUpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("dump_updated_at"); + + builder.Property(e => e.Processed).HasColumnName("processed"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.UserId).HasColumnName("user_id"); + + builder.HasOne(d => d.User) + .WithMany(p => p.Backups) + .HasForeignKey(d => d.UserId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_096669d221"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/BlockEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/BlockEntityConfiguration.cs new file mode 100644 index 0000000..64b7aea --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/BlockEntityConfiguration.cs @@ -0,0 +1,49 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class BlockEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("blocks"); + + builder.HasKey(e => e.Id).HasName("blocks_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.TargetAccountId }) + .HasDatabaseName("index_blocks_on_account_id_and_target_account_id") + .IsUnique(); + + builder.HasIndex(e => e.TargetAccountId).HasDatabaseName("index_blocks_on_target_account_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.TargetAccountId).HasColumnName("target_account_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.Uri) + .HasColumnType("character varying") + .HasColumnName("uri"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.BlockAccounts) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_4269e03e65"); + + builder.HasOne(d => d.TargetAccount) + .WithMany(p => p.BlockTargetAccounts) + .HasForeignKey(d => d.TargetAccountId) + .HasConstraintName("fk_9571bfabc1"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/BookmarkEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/BookmarkEntityConfiguration.cs new file mode 100644 index 0000000..26260da --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/BookmarkEntityConfiguration.cs @@ -0,0 +1,45 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class BookmarkEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("bookmarks"); + + builder.HasKey(e => e.Id).HasName("bookmarks_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.StatusId }) + .HasDatabaseName("index_bookmarks_on_account_id_and_status_id") + .IsUnique(); + + builder.HasIndex(e => e.StatusId).HasDatabaseName("index_bookmarks_on_status_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.StatusId).HasColumnName("status_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.Bookmarks) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_rails_9f6ac182a6"); + + builder.HasOne(d => d.Status) + .WithMany(p => p.Bookmarks) + .HasForeignKey(d => d.StatusId) + .HasConstraintName("fk_rails_11207ffcfd"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/CanonicalEmailBlockEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/CanonicalEmailBlockEntityConfiguration.cs new file mode 100644 index 0000000..7efacee --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/CanonicalEmailBlockEntityConfiguration.cs @@ -0,0 +1,45 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class CanonicalEmailBlockEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("canonical_email_blocks"); + + builder.HasKey(e => e.Id).HasName("canonical_email_blocks_pkey"); + + builder.HasIndex(e => e.CanonicalEmailHash) + .HasDatabaseName("index_canonical_email_blocks_on_canonical_email_hash") + .IsUnique(); + + builder.HasIndex(e => e.ReferenceAccountId) + .HasDatabaseName("index_canonical_email_blocks_on_reference_account_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CanonicalEmailHash) + .HasColumnType("character varying") + .HasColumnName("canonical_email_hash") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.ReferenceAccountId).HasColumnName("reference_account_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.ReferenceAccount) + .WithMany(p => p.CanonicalEmailBlocks) + .HasForeignKey(d => d.ReferenceAccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_1ecb262096"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/ConversationEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/ConversationEntityConfiguration.cs new file mode 100644 index 0000000..ee9d3e5 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/ConversationEntityConfiguration.cs @@ -0,0 +1,35 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class ConversationEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("conversations"); + + builder.HasKey(e => e.Id).HasName("conversations_pkey"); + + builder.HasIndex(e => e.Uri) + .HasDatabaseName("index_conversations_on_uri") + .IsUnique() + .HasFilter("(uri IS NOT NULL)") + .HasOperators("text_pattern_ops"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.Uri) + .HasColumnType("character varying") + .HasColumnName("uri"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/ConversationMuteEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/ConversationMuteEntityConfiguration.cs new file mode 100644 index 0000000..bd3c4fe --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/ConversationMuteEntityConfiguration.cs @@ -0,0 +1,35 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class ConversationMuteEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("conversation_mutes"); + + builder.HasKey(e => e.Id).HasName("conversation_mutes_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.ConversationId }) + .HasDatabaseName("index_conversation_mutes_on_account_id_and_conversation_id") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.ConversationId).HasColumnName("conversation_id"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.ConversationMutes) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_225b4212bb"); + + builder.HasOne(d => d.Conversation) + .WithMany(p => p.ConversationMutes) + .HasForeignKey(d => d.ConversationId) + .HasConstraintName("fk_rails_5ab139311f"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/CustomEmojiCategoryEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/CustomEmojiCategoryEntityConfiguration.cs new file mode 100644 index 0000000..16444d6 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/CustomEmojiCategoryEntityConfiguration.cs @@ -0,0 +1,33 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class CustomEmojiCategoryEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("custom_emoji_categories"); + + builder.HasKey(e => e.Id).HasName("custom_emoji_categories_pkey"); + + builder.HasIndex(e => e.Name) + .HasDatabaseName("index_custom_emoji_categories_on_name") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Name) + .HasColumnType("character varying") + .HasColumnName("name"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/CustomEmojiEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/CustomEmojiEntityConfiguration.cs new file mode 100644 index 0000000..fb3b022 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/CustomEmojiEntityConfiguration.cs @@ -0,0 +1,71 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class CustomEmojiEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("custom_emojis"); + + builder.HasKey(e => e.Id).HasName("custom_emojis_pkey"); + + builder.HasIndex(e => new { e.Shortcode, e.Domain }) + .HasDatabaseName("index_custom_emojis_on_shortcode_and_domain") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CategoryId).HasColumnName("category_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Disabled).HasColumnName("disabled"); + + builder.Property(e => e.Domain) + .HasColumnType("character varying") + .HasColumnName("domain"); + + builder.Property(e => e.ImageContentType) + .HasColumnType("character varying") + .HasColumnName("image_content_type"); + + builder.Property(e => e.ImageFileName) + .HasColumnType("character varying") + .HasColumnName("image_file_name"); + + builder.Property(e => e.ImageFileSize).HasColumnName("image_file_size"); + + builder.Property(e => e.ImageRemoteUrl) + .HasColumnType("character varying") + .HasColumnName("image_remote_url"); + + builder.Property(e => e.ImageStorageSchemaVersion).HasColumnName("image_storage_schema_version"); + + builder.Property(e => e.ImageUpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("image_updated_at"); + + builder.Property(e => e.Shortcode) + .HasColumnType("character varying") + .HasColumnName("shortcode") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.Uri) + .HasColumnType("character varying") + .HasColumnName("uri"); + + builder.Property(e => e.VisibleInPicker) + .IsRequired() + .HasColumnName("visible_in_picker") + .HasDefaultValueSql("true"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/CustomFilterEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/CustomFilterEntityConfiguration.cs new file mode 100644 index 0000000..5fafc38 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/CustomFilterEntityConfiguration.cs @@ -0,0 +1,50 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class CustomFilterEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("custom_filters"); + + builder.HasKey(e => e.Id).HasName("custom_filters_pkey"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_custom_filters_on_account_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.Action).HasColumnName("action"); + + builder.Property(e => e.Context) + .HasColumnType("character varying[]") + .HasColumnName("context") + .HasDefaultValueSql("'{}'::character varying[]"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.ExpiresAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("expires_at"); + + builder.Property(e => e.Phrase) + .HasColumnName("phrase") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.CustomFilters) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_8b8d786993"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/CustomFilterKeywordEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/CustomFilterKeywordEntityConfiguration.cs new file mode 100644 index 0000000..81dc502 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/CustomFilterKeywordEntityConfiguration.cs @@ -0,0 +1,44 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class CustomFilterKeywordEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("custom_filter_keywords"); + + builder.HasKey(e => e.Id).HasName("custom_filter_keywords_pkey"); + + builder.HasIndex(e => e.CustomFilterId) + .HasDatabaseName("index_custom_filter_keywords_on_custom_filter_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.CustomFilterId).HasColumnName("custom_filter_id"); + + builder.Property(e => e.Keyword) + .HasColumnName("keyword") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.WholeWord) + .IsRequired() + .HasColumnName("whole_word") + .HasDefaultValueSql("true"); + + builder.HasOne(d => d.CustomFilter) + .WithMany(p => p.CustomFilterKeywords) + .HasForeignKey(d => d.CustomFilterId) + .HasConstraintName("fk_rails_5a49a74012"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/CustomFilterStatusEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/CustomFilterStatusEntityConfiguration.cs new file mode 100644 index 0000000..b54a1be --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/CustomFilterStatusEntityConfiguration.cs @@ -0,0 +1,45 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class CustomFilterStatusEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("custom_filter_statuses"); + + builder.HasKey(e => e.Id).HasName("custom_filter_statuses_pkey"); + + builder.HasIndex(e => e.CustomFilterId) + .HasDatabaseName("index_custom_filter_statuses_on_custom_filter_id"); + + builder.HasIndex(e => e.StatusId) + .HasDatabaseName("index_custom_filter_statuses_on_status_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.CustomFilterId).HasColumnName("custom_filter_id"); + + builder.Property(e => e.StatusId).HasColumnName("status_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.CustomFilter) + .WithMany(p => p.CustomFilterStatuses) + .HasForeignKey(d => d.CustomFilterId) + .HasConstraintName("fk_rails_e2ddaf5b14"); + + builder.HasOne(d => d.Status) + .WithMany(p => p.CustomFilterStatuses) + .HasForeignKey(d => d.StatusId) + .HasConstraintName("fk_rails_2f6d20c0cf"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/DeviceEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/DeviceEntityConfiguration.cs new file mode 100644 index 0000000..45bf440 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/DeviceEntityConfiguration.cs @@ -0,0 +1,63 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class DeviceEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("devices"); + + builder.HasKey(e => e.Id).HasName("devices_pkey"); + + builder.HasIndex(e => e.AccessTokenId).HasDatabaseName("index_devices_on_access_token_id"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_devices_on_account_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccessTokenId).HasColumnName("access_token_id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.DeviceId) + .HasColumnType("character varying") + .HasColumnName("device_id") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.FingerprintKey) + .HasColumnName("fingerprint_key") + .HasDefaultValueSql("''::text"); + + // builder.Property(e => e.IdbuilderKey) + // .HasColumnName("idbuilder_key") + // .HasDefaultValueSql("''::text"); + + builder.Property(e => e.Name) + .HasColumnType("character varying") + .HasColumnName("name") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.AccessToken) + .WithMany(p => p.Devices) + .HasForeignKey(d => d.AccessTokenId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_393f74df68"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.Devices) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a796b75798"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/DomainAllowEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/DomainAllowEntityConfiguration.cs new file mode 100644 index 0000000..ccd554d --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/DomainAllowEntityConfiguration.cs @@ -0,0 +1,34 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class DomainAllowEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("domain_allows"); + + builder.HasKey(e => e.Id).HasName("domain_allows_pkey"); + + builder.HasIndex(e => e.Domain) + .HasDatabaseName("index_domain_allows_on_domain") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Domain) + .HasColumnType("character varying") + .HasColumnName("domain") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/DomainBlockEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/DomainBlockEntityConfiguration.cs new file mode 100644 index 0000000..56e4326 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/DomainBlockEntityConfiguration.cs @@ -0,0 +1,48 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class DomainBlockEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("domain_blocks"); + + builder.HasKey(e => e.Id).HasName("domain_blocks_pkey"); + + builder.HasIndex(e => e.Domain) + .HasDatabaseName("index_domain_blocks_on_domain") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Domain) + .HasColumnType("character varying") + .HasColumnName("domain") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.Obfuscate).HasColumnName("obfuscate"); + + builder.Property(e => e.PrivateComment).HasColumnName("private_comment"); + + builder.Property(e => e.PublicComment).HasColumnName("public_comment"); + + builder.Property(e => e.RejectMedia).HasColumnName("reject_media"); + + builder.Property(e => e.RejectReports).HasColumnName("reject_reports"); + + builder.Property(e => e.Severity) + .HasColumnName("severity") + .HasDefaultValueSql("0"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/EmailDomainBlockEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/EmailDomainBlockEntityConfiguration.cs new file mode 100644 index 0000000..a05aed3 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/EmailDomainBlockEntityConfiguration.cs @@ -0,0 +1,42 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class EmailDomainBlockEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("email_domain_blocks"); + + builder.HasKey(e => e.Id).HasName("email_domain_blocks_pkey"); + + builder.HasIndex(e => e.Domain) + .HasDatabaseName("index_email_domain_blocks_on_domain") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Domain) + .HasColumnType("character varying") + .HasColumnName("domain") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.ParentId).HasColumnName("parent_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Parent) + .WithMany(p => p.InverseParent) + .HasForeignKey(d => d.ParentId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_408efe0a15"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/EncryptedMessageEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/EncryptedMessageEntityConfiguration.cs new file mode 100644 index 0000000..52dea5c --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/EncryptedMessageEntityConfiguration.cs @@ -0,0 +1,66 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class EncryptedMessageEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("encrypted_messages"); + + builder.HasKey(e => e.Id).HasName("encrypted_messages_pkey"); + + builder.HasIndex(e => e.DeviceId).HasDatabaseName("index_encrypted_messages_on_device_id"); + + builder.HasIndex(e => e.FromAccountId).HasDatabaseName("index_encrypted_messages_on_from_account_id"); + + builder.Property(e => e.Id) + .HasColumnName("id") + .HasDefaultValueSql("timestamp_id('encrypted_messages'::text)"); + + builder.Property(e => e.Body) + .HasColumnName("body") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.DeviceId).HasColumnName("device_id"); + + builder.Property(e => e.Digest) + .HasColumnName("digest") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.FromAccountId).HasColumnName("from_account_id"); + + builder.Property(e => e.FromDeviceId) + .HasColumnType("character varying") + .HasColumnName("from_device_id") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.MessageFranking) + .HasColumnName("message_franking") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.Type).HasColumnName("type"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Device) + .WithMany(p => p.EncryptedMessages) + .HasForeignKey(d => d.DeviceId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a83e4df7ae"); + + builder.HasOne(d => d.FromAccount) + .WithMany(p => p.EncryptedMessages) + .HasForeignKey(d => d.FromAccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a42ad0f8d5"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/FavouriteEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/FavouriteEntityConfiguration.cs new file mode 100644 index 0000000..c947f8a --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/FavouriteEntityConfiguration.cs @@ -0,0 +1,48 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class FavouriteEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("favourites"); + + builder.HasKey(e => e.Id).HasName("favourites_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.Id }) + .HasDatabaseName("index_favourites_on_account_id_and_id"); + + builder.HasIndex(e => new { e.AccountId, e.StatusId }) + .HasDatabaseName("index_favourites_on_account_id_and_status_id") + .IsUnique(); + + builder.HasIndex(e => e.StatusId).HasDatabaseName("index_favourites_on_status_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.StatusId).HasColumnName("status_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.Favourites) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_5eb6c2b873"); + + builder.HasOne(d => d.Status) + .WithMany(p => p.Favourites) + .HasForeignKey(d => d.StatusId) + .HasConstraintName("fk_b0e856845e"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/FeaturedTagEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/FeaturedTagEntityConfiguration.cs new file mode 100644 index 0000000..4fbed39 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/FeaturedTagEntityConfiguration.cs @@ -0,0 +1,55 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class FeaturedTagEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("featured_tags"); + + builder.HasKey(e => e.Id).HasName("featured_tags_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.TagId }) + .HasDatabaseName("index_featured_tags_on_account_id_and_tag_id") + .IsUnique(); + + builder.HasIndex(e => e.TagId).HasDatabaseName("index_featured_tags_on_tag_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.LastStatusAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("last_status_at"); + + builder.Property(e => e.Name) + .HasColumnType("character varying") + .HasColumnName("name"); + + builder.Property(e => e.StatusesCount).HasColumnName("statuses_count"); + + builder.Property(e => e.TagId).HasColumnName("tag_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.FeaturedTags) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_rails_174efcf15f"); + + builder.HasOne(d => d.Tag) + .WithMany(p => p.FeaturedTags) + .HasForeignKey(d => d.TagId) + .HasConstraintName("fk_rails_23a9055c7c"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/FollowEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/FollowEntityConfiguration.cs new file mode 100644 index 0000000..064f11f --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/FollowEntityConfiguration.cs @@ -0,0 +1,60 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class FollowEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("follows"); + + builder.HasKey(e => e.Id).HasName("follows_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.TargetAccountId }) + .HasDatabaseName("index_follows_on_account_id_and_target_account_id") + .IsUnique(); + + builder.HasIndex(e => e.TargetAccountId, "index_follows_on_target_account_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Languages) + .HasColumnType("character varying[]") + .HasColumnName("languages"); + + builder.Property(e => e.Notify).HasColumnName("notify"); + + builder.Property(e => e.ShowReblogs) + .IsRequired() + .HasColumnName("show_reblogs") + .HasDefaultValueSql("true"); + + builder.Property(e => e.TargetAccountId).HasColumnName("target_account_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.Uri) + .HasColumnType("character varying") + .HasColumnName("uri"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.FollowAccounts) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_32ed1b5560"); + + builder.HasOne(d => d.TargetAccount) + .WithMany(p => p.FollowTargetAccounts) + .HasForeignKey(d => d.TargetAccountId) + .HasConstraintName("fk_745ca29eac"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/FollowRecommendationEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/FollowRecommendationEntityConfiguration.cs new file mode 100644 index 0000000..9b6bad6 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/FollowRecommendationEntityConfiguration.cs @@ -0,0 +1,21 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class FollowRecommendationEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.HasNoKey(); + + builder.ToView("follow_recommendations"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.Rank).HasColumnName("rank"); + + builder.Property(e => e.Reason).HasColumnName("reason"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/FollowRecommendationSuppressionEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/FollowRecommendationSuppressionEntityConfiguration.cs new file mode 100644 index 0000000..389ac1a --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/FollowRecommendationSuppressionEntityConfiguration.cs @@ -0,0 +1,37 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class + FollowRecommendationSuppressionEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("follow_recommendation_suppressions"); + + builder.HasKey(e => e.Id).HasName("follow_recommendation_suppressions_pkey"); + + builder.HasIndex(e => e.AccountId) + .HasDatabaseName("index_follow_recommendation_suppressions_on_account_id") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithOne(p => p.FollowRecommendationSuppression) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_rails_dfb9a1dbe2"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/FollowRequestEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/FollowRequestEntityConfiguration.cs new file mode 100644 index 0000000..b3e60c4 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/FollowRequestEntityConfiguration.cs @@ -0,0 +1,58 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class FollowRequestEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("follow_requests"); + + builder.HasKey(e => e.Id).HasName("follow_requests_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.TargetAccountId }) + .HasDatabaseName("index_follow_requests_on_account_id_and_target_account_id") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Languages) + .HasColumnType("character varying[]") + .HasColumnName("languages"); + + builder.Property(e => e.Notify).HasColumnName("notify"); + + builder.Property(e => e.ShowReblogs) + .IsRequired() + .HasColumnName("show_reblogs") + .HasDefaultValueSql("true"); + + builder.Property(e => e.TargetAccountId).HasColumnName("target_account_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.Uri) + .HasColumnType("character varying") + .HasColumnName("uri"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.FollowRequestAccounts) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_76d644b0e7"); + + builder.HasOne(d => d.TargetAccount) + .WithMany(p => p.FollowRequestTargetAccounts) + .HasForeignKey(d => d.TargetAccountId) + .HasConstraintName("fk_9291ec025d"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/IdentityEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/IdentityEntityConfiguration.cs new file mode 100644 index 0000000..0c80961 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/IdentityEntityConfiguration.cs @@ -0,0 +1,45 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class IdbuilderEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("identities"); + + builder.HasKey(e => e.Id).HasName("identities_pkey"); + + builder.HasIndex(e => e.UserId).HasDatabaseName("index_identities_on_user_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Provider) + .HasColumnType("character varying") + .HasColumnName("provider") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.Uid) + .HasColumnType("character varying") + .HasColumnName("uid") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.UserId).HasColumnName("user_id"); + + builder.HasOne(d => d.User) + .WithMany(p => p.Identities) + .HasForeignKey(d => d.UserId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_bea040f377"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/ImportEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/ImportEntityConfiguration.cs new file mode 100644 index 0000000..3eb7953 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/ImportEntityConfiguration.cs @@ -0,0 +1,52 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class ImportEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("imports"); + + builder.HasKey(e => e.Id).HasName("imports_pkey"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.Approved).HasColumnName("approved"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.DataContentType) + .HasColumnType("character varying") + .HasColumnName("data_content_type"); + + builder.Property(e => e.DataFileName) + .HasColumnType("character varying") + .HasColumnName("data_file_name"); + + builder.Property(e => e.DataFileSize).HasColumnName("data_file_size"); + + builder.Property(e => e.DataUpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("data_updated_at"); + + builder.Property(e => e.Overwrite).HasColumnName("overwrite"); + + builder.Property(e => e.Type).HasColumnName("type"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.Imports) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_6db1b6e408"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/InstanceEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/InstanceEntityConfiguration.cs new file mode 100644 index 0000000..c8dbf4b --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/InstanceEntityConfiguration.cs @@ -0,0 +1,21 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class InstanceEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.HasNoKey(); + + builder.ToView("instances"); + + builder.Property(e => e.AccountsCount).HasColumnName("accounts_count"); + + builder.Property(e => e.Domain) + .HasColumnType("character varying") + .HasColumnName("domain"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/InviteEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/InviteEntityConfiguration.cs new file mode 100644 index 0000000..716bd08 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/InviteEntityConfiguration.cs @@ -0,0 +1,55 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class InviteEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("invites"); + + builder.HasKey(e => e.Id).HasName("invites_pkey"); + + builder.HasIndex(e => e.Code) + .HasDatabaseName("index_invites_on_code") + .IsUnique(); + + builder.HasIndex(e => e.UserId).HasDatabaseName("index_invites_on_user_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.Autofollow).HasColumnName("autofollow"); + + builder.Property(e => e.Code) + .HasColumnType("character varying") + .HasColumnName("code") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.Comment).HasColumnName("comment"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.ExpiresAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("expires_at"); + + builder.Property(e => e.MaxUses).HasColumnName("max_uses"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.UserId).HasColumnName("user_id"); + + builder.Property(e => e.Uses).HasColumnName("uses"); + + builder.HasOne(d => d.User) + .WithMany(p => p.Invites) + .HasForeignKey(d => d.UserId) + .HasConstraintName("fk_rails_ff69dbb2ac"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/IpBlockEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/IpBlockEntityConfiguration.cs new file mode 100644 index 0000000..ffa2a05 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/IpBlockEntityConfiguration.cs @@ -0,0 +1,43 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class IpBlockEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("ip_blocks"); + + builder.HasKey(e => e.Id).HasName("ip_blocks_pkey"); + + // IPAddress does not implement IComparable, so we must do this manually in the migration + // builder.HasIndex(e => e.Ip, "index_ip_blocks_on_ip") + // .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.Comment) + .HasColumnName("comment") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.ExpiresAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("expires_at"); + + builder.Property(e => e.Ip) + .HasColumnName("ip") + .HasDefaultValueSql("'0.0.0.0'::inet"); + + builder.Property(e => e.Severity).HasColumnName("severity"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/ListAccountEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/ListAccountEntityConfiguration.cs new file mode 100644 index 0000000..adc4d4b --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/ListAccountEntityConfiguration.cs @@ -0,0 +1,50 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class ListAccountEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("list_accounts"); + + builder.HasKey(e => e.Id).HasName("list_accounts_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.ListId }) + .HasDatabaseName("index_list_accounts_on_account_id_and_list_id") + .IsUnique(); + + builder.HasIndex(e => e.FollowId) + .HasDatabaseName("index_list_accounts_on_follow_id") + .HasFilter("(follow_id IS NOT NULL)"); + + builder.HasIndex(e => new { e.ListId, e.AccountId }) + .HasDatabaseName("index_list_accounts_on_list_id_and_account_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.FollowId).HasColumnName("follow_id"); + + builder.Property(e => e.ListId).HasColumnName("list_id"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.ListAccounts) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_rails_85fee9d6ab"); + + builder.HasOne(d => d.Follow) + .WithMany(p => p.ListAccounts) + .HasForeignKey(d => d.FollowId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_40f9cc29f1"); + + builder.HasOne(d => d.List) + .WithMany(p => p.ListAccounts) + .HasForeignKey(d => d.ListId) + .HasConstraintName("fk_rails_e54e356c88"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/ListEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/ListEntityConfiguration.cs new file mode 100644 index 0000000..303dc60 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/ListEntityConfiguration.cs @@ -0,0 +1,41 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class ListEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("lists"); + + builder.HasKey(e => e.Id).HasName("lists_pkey"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_lists_on_account_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.RepliesPolicy).HasColumnName("replies_policy"); + + builder.Property(e => e.Title) + .HasColumnType("character varying") + .HasColumnName("title") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.Lists) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_rails_3853b78dac"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/LoginActivityEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/LoginActivityEntityConfiguration.cs new file mode 100644 index 0000000..a54a4a4 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/LoginActivityEntityConfiguration.cs @@ -0,0 +1,50 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class LoginActivityEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("login_activities"); + + builder.HasKey(e => e.Id).HasName("login_activities_pkey"); + + builder.HasIndex(e => e.UserId).HasDatabaseName("index_login_activities_on_user_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AuthenticationMethod) + .HasColumnType("character varying") + .HasColumnName("authentication_method"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.FailureReason) + .HasColumnType("character varying") + .HasColumnName("failure_reason"); + + builder.Property(e => e.Ip).HasColumnName("ip"); + + builder.Property(e => e.Provider) + .HasColumnType("character varying") + .HasColumnName("provider"); + + builder.Property(e => e.Success).HasColumnName("success"); + + builder.Property(e => e.UserAgent) + .HasColumnType("character varying") + .HasColumnName("user_agent"); + + builder.Property(e => e.UserId).HasColumnName("user_id"); + + builder.HasOne(d => d.User) + .WithMany(p => p.LoginActivities) + .HasForeignKey(d => d.UserId) + .HasConstraintName("fk_rails_e4b6396b41"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/MarkerEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/MarkerEntityConfiguration.cs new file mode 100644 index 0000000..2b8de81 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/MarkerEntityConfiguration.cs @@ -0,0 +1,46 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class MarkerEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("markers"); + + builder.HasKey(e => e.Id).HasName("markers_pkey"); + + builder.HasIndex(e => new { e.UserId, e.Timeline }) + .HasDatabaseName("index_markers_on_user_id_and_timeline") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.LastReadId).HasColumnName("last_read_id"); + + builder.Property(e => e.LockVersion).HasColumnName("lock_version"); + + builder.Property(e => e.Timeline) + .HasColumnType("character varying") + .HasColumnName("timeline") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.UserId).HasColumnName("user_id"); + + builder.HasOne(d => d.User) + .WithMany(p => p.Markers) + .HasForeignKey(d => d.UserId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a7009bc2b6"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/MediaAttachmentEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/MediaAttachmentEntityConfiguration.cs new file mode 100644 index 0000000..137e53b --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/MediaAttachmentEntityConfiguration.cs @@ -0,0 +1,124 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class MediaAttachmentEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("media_attachments"); + + builder.HasKey(e => e.Id).HasName("media_attachments_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.StatusId }) + .HasDatabaseName("index_media_attachments_on_account_id_and_status_id") + .IsDescending(false, true); + + builder.HasIndex(e => e.ScheduledStatusId) + .HasDatabaseName("index_media_attachments_on_scheduled_status_id") + .HasFilter("(scheduled_status_id IS NOT NULL)"); + + builder.HasIndex(e => e.Shortcode) + .HasDatabaseName("index_media_attachments_on_shortcode") + .IsUnique() + .HasFilter("(shortcode IS NOT NULL)") + .HasOperators("text_pattern_ops"); + + builder.HasIndex(e => e.StatusId).HasDatabaseName("index_media_attachments_on_status_id"); + + builder.Property(e => e.Id) + .HasColumnName("id") + .HasDefaultValueSql("timestamp_id('media_attachments'::text)"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.Blurhash) + .HasColumnType("character varying") + .HasColumnName("blurhash"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Description).HasColumnName("description"); + + builder.Property(e => e.FileContentType) + .HasColumnType("character varying") + .HasColumnName("file_content_type"); + + builder.Property(e => e.FileFileName) + .HasColumnType("character varying") + .HasColumnName("file_file_name"); + + builder.Property(e => e.FileFileSize).HasColumnName("file_file_size"); + + builder.Property(e => e.FileMeta) + .HasColumnType("json") + .HasColumnName("file_meta"); + + builder.Property(e => e.FileStorageSchemaVersion).HasColumnName("file_storage_schema_version"); + + builder.Property(e => e.FileUpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("file_updated_at"); + + builder.Property(e => e.Processing).HasColumnName("processing"); + + builder.Property(e => e.RemoteUrl) + .HasColumnType("character varying") + .HasColumnName("remote_url") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.ScheduledStatusId).HasColumnName("scheduled_status_id"); + + builder.Property(e => e.Shortcode) + .HasColumnType("character varying") + .HasColumnName("shortcode"); + + builder.Property(e => e.StatusId).HasColumnName("status_id"); + + builder.Property(e => e.ThumbnailContentType) + .HasColumnType("character varying") + .HasColumnName("thumbnail_content_type"); + + builder.Property(e => e.ThumbnailFileName) + .HasColumnType("character varying") + .HasColumnName("thumbnail_file_name"); + + builder.Property(e => e.ThumbnailFileSize).HasColumnName("thumbnail_file_size"); + + builder.Property(e => e.ThumbnailRemoteUrl) + .HasColumnType("character varying") + .HasColumnName("thumbnail_remote_url"); + + builder.Property(e => e.ThumbnailUpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("thumbnail_updated_at"); + + builder.Property(e => e.Type).HasColumnName("type"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.MediaAttachments) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_96dd81e81b"); + + builder.HasOne(d => d.ScheduledStatus) + .WithMany(p => p.MediaAttachments) + .HasForeignKey(d => d.ScheduledStatusId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_31fc5aeef1"); + + builder.HasOne(d => d.Status) + .WithMany(p => p.MediaAttachments) + .HasForeignKey(d => d.StatusId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_3ec0cfdd70"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/MentionEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/MentionEntityConfiguration.cs new file mode 100644 index 0000000..f6b1624 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/MentionEntityConfiguration.cs @@ -0,0 +1,49 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class MentionEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("mentions"); + + builder.HasKey(e => e.Id).HasName("mentions_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.StatusId }) + .HasDatabaseName("index_mentions_on_account_id_and_status_id") + .IsUnique(); + + builder.HasIndex(e => e.StatusId).HasDatabaseName("index_mentions_on_status_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Silent).HasColumnName("silent"); + + builder.Property(e => e.StatusId).HasColumnName("status_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.Mentions) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_970d43f9d1"); + + builder.HasOne(d => d.Status) + .WithMany(p => p.Mentions) + .HasForeignKey(d => d.StatusId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_59edbe2887"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/MuteEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/MuteEntityConfiguration.cs new file mode 100644 index 0000000..6b37fb6 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/MuteEntityConfiguration.cs @@ -0,0 +1,54 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class MuteEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("mutes"); + + builder.HasKey(e => e.Id).HasName("mutes_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.TargetAccountId }) + .HasDatabaseName("index_mutes_on_account_id_and_target_account_id") + .IsUnique(); + + builder.HasIndex(e => e.TargetAccountId).HasDatabaseName("index_mutes_on_target_account_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.ExpiresAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("expires_at"); + + builder.Property(e => e.HideNotifications) + .IsRequired() + .HasColumnName("hide_notifications") + .HasDefaultValueSql("true"); + + builder.Property(e => e.TargetAccountId).HasColumnName("target_account_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.MuteAccounts) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_b8d8daf315"); + + builder.HasOne(d => d.TargetAccount) + .WithMany(p => p.MuteTargetAccounts) + .HasForeignKey(d => d.TargetAccountId) + .HasConstraintName("fk_eecff219ea"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/NotificationEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/NotificationEntityConfiguration.cs new file mode 100644 index 0000000..fcc5f83 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/NotificationEntityConfiguration.cs @@ -0,0 +1,58 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class NotificationEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("notifications"); + + builder.HasKey(e => e.Id).HasName("notifications_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.Id, e.Type }) + .HasDatabaseName("index_notifications_on_account_id_and_id_and_type") + .IsDescending(false, true, false); + + builder.HasIndex(e => new { e.ActivityId, e.ActivityType }) + .HasDatabaseName("index_notifications_on_activity_id_and_activity_type"); + + builder.HasIndex(e => e.FromAccountId).HasDatabaseName("index_notifications_on_from_account_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.ActivityId).HasColumnName("activity_id"); + + builder.Property(e => e.ActivityType) + .HasColumnType("character varying") + .HasColumnName("activity_type"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.FromAccountId).HasColumnName("from_account_id"); + + builder.Property(e => e.Type) + .HasColumnType("character varying") + .HasColumnName("type"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.NotificationAccounts) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_c141c8ee55"); + + builder.HasOne(d => d.FromAccount) + .WithMany(p => p.NotificationFromAccounts) + .HasForeignKey(d => d.FromAccountId) + .HasConstraintName("fk_fbd6b0bf9e"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/OAuthAccessGrantEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/OAuthAccessGrantEntityConfiguration.cs new file mode 100644 index 0000000..0a40772 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/OAuthAccessGrantEntityConfiguration.cs @@ -0,0 +1,57 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class OAuthAccessGrantEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("oauth_access_grants"); + + builder.HasKey(e => e.Id).HasName("oauth_access_grants_pkey"); + + builder.HasIndex(e => e.ResourceOwnerId).HasDatabaseName("index_oauth_access_grants_on_resource_owner_id"); + + builder.HasIndex(e => e.Token) + .HasDatabaseName("index_oauth_access_grants_on_token") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.ApplicationId).HasColumnName("application_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.ExpiresIn).HasColumnName("expires_in"); + + builder.Property(e => e.RedirectUri).HasColumnName("redirect_uri"); + + builder.Property(e => e.ResourceOwnerId).HasColumnName("resource_owner_id"); + + builder.Property(e => e.RevokedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("revoked_at"); + + builder.Property(e => e.Scopes) + .HasColumnType("character varying") + .HasColumnName("scopes"); + + builder.Property(e => e.Token) + .HasColumnType("character varying") + .HasColumnName("token"); + + builder.HasOne(d => d.Application) + .WithMany(p => p.OAuthAccessGrants) + .HasForeignKey(d => d.ApplicationId) + .HasConstraintName("fk_34d54b0a33"); + + builder.HasOne(d => d.ResourceOwner) + .WithMany(p => p.OAuthAccessGrants) + .HasForeignKey(d => d.ResourceOwnerId) + .HasConstraintName("fk_63b044929b"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/OAuthAccessTokenEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/OAuthAccessTokenEntityConfiguration.cs new file mode 100644 index 0000000..4175749 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/OAuthAccessTokenEntityConfiguration.cs @@ -0,0 +1,75 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class OAuthAccessTokenEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("oauth_access_tokens"); + + builder.HasKey(e => e.Id).HasName("oauth_access_tokens_pkey"); + + builder.HasIndex(e => e.RefreshToken) + .HasDatabaseName("index_oauth_access_tokens_on_refresh_token") + .IsUnique() + .HasFilter("(refresh_token IS NOT NULL)") + .HasOperators(new[] { "text_pattern_ops" }); + + builder.HasIndex(e => e.ResourceOwnerId) + .HasDatabaseName("index_oauth_access_tokens_on_resource_owner_id") + .HasFilter("(resource_owner_id IS NOT NULL)"); + + builder.HasIndex(e => e.Token) + .HasDatabaseName("index_oauth_access_tokens_on_token") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.ApplicationId).HasColumnName("application_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.ExpiresIn).HasColumnName("expires_in"); + + builder.Property(e => e.LastUsedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("last_used_at"); + + builder.Property(e => e.LastUsedIp).HasColumnName("last_used_ip"); + + builder.Property(e => e.RefreshToken) + .HasColumnType("character varying") + .HasColumnName("refresh_token"); + + builder.Property(e => e.ResourceOwnerId).HasColumnName("resource_owner_id"); + + builder.Property(e => e.RevokedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("revoked_at"); + + builder.Property(e => e.Scopes) + .HasColumnType("character varying") + .HasColumnName("scopes"); + + builder.Property(e => e.Token) + .HasColumnType("character varying") + .HasColumnName("token"); + + builder.HasOne(d => d.Application) + .WithMany(p => p.OAuthAccessTokens) + .HasForeignKey(d => d.ApplicationId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_f5fc4c1ee3"); + + builder.HasOne(d => d.ResourceOwner) + .WithMany(p => p.OAuthAccessTokens) + .HasForeignKey(d => d.ResourceOwnerId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_e84df68546"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/OAuthApplicationEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/OAuthApplicationEntityConfiguration.cs new file mode 100644 index 0000000..ce6ce1d --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/OAuthApplicationEntityConfiguration.cs @@ -0,0 +1,74 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class OAuthApplicationEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("oauth_applications"); + + builder.HasKey(e => e.Id).HasName("oauth_applications_pkey"); + + builder.HasIndex(e => new { e.OwnerId, e.OwnerType }) + .HasDatabaseName("index_oauth_applications_on_owner_id_and_owner_type"); + + builder.HasIndex(e => e.Uid) + .HasDatabaseName("index_oauth_applications_on_uid") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.Confidential) + .IsRequired() + .HasColumnName("confidential") + .HasDefaultValueSql("true"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Name) + .HasColumnType("character varying") + .HasColumnName("name"); + + builder.Property(e => e.OwnerId).HasColumnName("owner_id"); + + builder.Property(e => e.OwnerType) + .HasColumnType("character varying") + .HasColumnName("owner_type"); + + builder.Property(e => e.RedirectUri).HasColumnName("redirect_uri"); + + builder.Property(e => e.Scopes) + .HasColumnType("character varying") + .HasColumnName("scopes") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.Secret) + .HasColumnType("character varying") + .HasColumnName("secret"); + + builder.Property(e => e.Superapp).HasColumnName("superapp"); + + builder.Property(e => e.Uid) + .HasColumnType("character varying") + .HasColumnName("uid"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.Website) + .HasColumnType("character varying") + .HasColumnName("website"); + + builder.HasOne(d => d.Owner) + .WithMany(p => p.OAuthApplications) + .HasForeignKey(d => d.OwnerId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_b0988c7c0a"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/OneTimeKeyEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/OneTimeKeyEntityConfiguration.cs new file mode 100644 index 0000000..c5dfa9b --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/OneTimeKeyEntityConfiguration.cs @@ -0,0 +1,50 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class OneTimeKeyEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("one_time_keys"); + + builder.HasKey(e => e.Id).HasName("one_time_keys_pkey"); + + builder.HasIndex(e => e.DeviceId).HasDatabaseName("index_one_time_keys_on_device_id"); + + builder.HasIndex(e => e.KeyId).HasDatabaseName("index_one_time_keys_on_key_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.DeviceId).HasColumnName("device_id"); + + builder.Property(e => e.Key) + .HasColumnName("key") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.KeyId) + .HasColumnType("character varying") + .HasColumnName("key_id") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.Signature) + .HasColumnName("signature") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Device) + .WithMany(p => p.OneTimeKeys) + .HasForeignKey(d => d.DeviceId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_d3edd8c878"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/PgheroSpaceStatEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/PgheroSpaceStatEntityConfiguration.cs new file mode 100644 index 0000000..66af6f0 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/PgheroSpaceStatEntityConfiguration.cs @@ -0,0 +1,32 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class PgheroSpaceStatEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("pghero_space_stats"); + + builder.HasKey(e => e.Id).HasName("pghero_space_stats_pkey"); + + builder.HasIndex(e => new { e.Database, e.CapturedAt }) + .HasDatabaseName("index_pghero_space_stats_on_database_and_captured_at"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CapturedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("captured_at"); + + builder.Property(e => e.Database).HasColumnName("database"); + + builder.Property(e => e.Relation).HasColumnName("relation"); + + builder.Property(e => e.Schema).HasColumnName("schema"); + + builder.Property(e => e.Size).HasColumnName("size"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/PollEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/PollEntityConfiguration.cs new file mode 100644 index 0000000..525be72 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/PollEntityConfiguration.cs @@ -0,0 +1,72 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class PollEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("polls"); + + builder.HasKey(e => e.Id).HasName("polls_pkey"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_polls_on_account_id"); + + builder.HasIndex(e => e.StatusId).HasDatabaseName("index_polls_on_status_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CachedTallies) + .HasColumnName("cached_tallies") + .HasDefaultValueSql("'{}'::bigint[]"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.ExpiresAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("expires_at"); + + builder.Property(e => e.HideTotals).HasColumnName("hide_totals"); + + builder.Property(e => e.LastFetchedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("last_fetched_at"); + + builder.Property(e => e.LockVersion).HasColumnName("lock_version"); + + builder.Property(e => e.Multiple).HasColumnName("multiple"); + + builder.Property(e => e.Options) + .HasColumnType("character varying[]") + .HasColumnName("options") + .HasDefaultValueSql("'{}'::character varying[]"); + + builder.Property(e => e.StatusId).HasColumnName("status_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.VotersCount).HasColumnName("voters_count"); + + builder.Property(e => e.VotesCount).HasColumnName("votes_count"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.Polls) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_5b19a0c011"); + + builder.HasOne(d => d.Status) + .WithMany(p => p.Polls) + .HasForeignKey(d => d.StatusId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_3e0d9f1115"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/PollVoteEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/PollVoteEntityConfiguration.cs new file mode 100644 index 0000000..799b225 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/PollVoteEntityConfiguration.cs @@ -0,0 +1,51 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class PollVoteEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("poll_votes"); + + builder.HasKey(e => e.Id).HasName("poll_votes_pkey"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_poll_votes_on_account_id"); + + builder.HasIndex(e => e.PollId).HasDatabaseName("index_poll_votes_on_poll_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.Choice).HasColumnName("choice"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.PollId).HasColumnName("poll_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.Uri) + .HasColumnType("character varying") + .HasColumnName("uri"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.PollVotes) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_b6c18cf44a"); + + builder.HasOne(d => d.Poll) + .WithMany(p => p.PollVotes) + .HasForeignKey(d => d.PollId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a6e6974b7e"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/PreviewCardEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/PreviewCardEntityConfiguration.cs new file mode 100644 index 0000000..23beb0d --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/PreviewCardEntityConfiguration.cs @@ -0,0 +1,113 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class PreviewCardEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("preview_cards"); + + builder.HasKey(e => e.Id).HasName("preview_cards_pkey"); + + builder.HasIndex(e => e.Url) + .HasDatabaseName("index_preview_cards_on_url") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AuthorName) + .HasColumnType("character varying") + .HasColumnName("author_name") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.AuthorUrl) + .HasColumnType("character varying") + .HasColumnName("author_url") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.Blurhash) + .HasColumnType("character varying") + .HasColumnName("blurhash"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Description) + .HasColumnType("character varying") + .HasColumnName("description") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.EmbedUrl) + .HasColumnType("character varying") + .HasColumnName("embed_url") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.Height).HasColumnName("height"); + + builder.Property(e => e.Html) + .HasColumnName("html") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.ImageContentType) + .HasColumnType("character varying") + .HasColumnName("image_content_type"); + + builder.Property(e => e.ImageFileName) + .HasColumnType("character varying") + .HasColumnName("image_file_name"); + + builder.Property(e => e.ImageFileSize).HasColumnName("image_file_size"); + + builder.Property(e => e.ImageStorageSchemaVersion).HasColumnName("image_storage_schema_version"); + + builder.Property(e => e.ImageUpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("image_updated_at"); + + builder.Property(e => e.Language) + .HasColumnType("character varying") + .HasColumnName("language"); + + builder.Property(e => e.LinkType).HasColumnName("link_type"); + + builder.Property(e => e.MaxScore).HasColumnName("max_score"); + + builder.Property(e => e.MaxScoreAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("max_score_at"); + + builder.Property(e => e.ProviderName) + .HasColumnType("character varying") + .HasColumnName("provider_name") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.ProviderUrl) + .HasColumnType("character varying") + .HasColumnName("provider_url") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.Title) + .HasColumnType("character varying") + .HasColumnName("title") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.Trendable).HasColumnName("trendable"); + + builder.Property(e => e.Type).HasColumnName("type"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.Url) + .HasColumnType("character varying") + .HasColumnName("url") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.Width).HasColumnName("width"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/PreviewCardProviderEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/PreviewCardProviderEntityConfiguration.cs new file mode 100644 index 0000000..1f68045 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/PreviewCardProviderEntityConfiguration.cs @@ -0,0 +1,58 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class PreviewCardProviderEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("preview_card_providers"); + + builder.HasKey(e => e.Id).HasName("preview_card_providers_pkey"); + + builder.HasIndex(e => e.Domain) + .HasDatabaseName("index_preview_card_providers_on_domain") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Domain) + .HasColumnType("character varying") + .HasColumnName("domain") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.IconContentType) + .HasColumnType("character varying") + .HasColumnName("icon_content_type"); + + builder.Property(e => e.IconFileName) + .HasColumnType("character varying") + .HasColumnName("icon_file_name"); + + builder.Property(e => e.IconFileSize).HasColumnName("icon_file_size"); + + builder.Property(e => e.IconUpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("icon_updated_at"); + + builder.Property(e => e.RequestedReviewAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("requested_review_at"); + + builder.Property(e => e.ReviewedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("reviewed_at"); + + builder.Property(e => e.Trendable).HasColumnName("trendable"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/PreviewCardStatusEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/PreviewCardStatusEntityConfiguration.cs new file mode 100644 index 0000000..770009c --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/PreviewCardStatusEntityConfiguration.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class PreviewCardStatusEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.HasNoKey(); + + builder.ToTable("preview_cards_statuses"); + + builder.HasIndex(e => new { e.StatusId, e.PreviewCardId }) + .HasDatabaseName("index_preview_cards_statuses_on_status_id_and_preview_card_id"); + + builder.Property(e => e.PreviewCardId).HasColumnName("preview_card_id"); + + builder.Property(e => e.StatusId).HasColumnName("status_id"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/PreviewCardTrendEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/PreviewCardTrendEntityConfiguration.cs new file mode 100644 index 0000000..cf25812 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/PreviewCardTrendEntityConfiguration.cs @@ -0,0 +1,38 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class PreviewCardTrendEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("preview_card_trends"); + + builder.HasKey(e => e.Id).HasName("preview_card_trends_pkey"); + + builder.HasIndex(e => e.PreviewCardId) + .HasDatabaseName("index_preview_card_trends_on_preview_card_id") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.Allowed).HasColumnName("allowed"); + + builder.Property(e => e.Language) + .HasColumnType("character varying") + .HasColumnName("language"); + + builder.Property(e => e.PreviewCardId).HasColumnName("preview_card_id"); + + builder.Property(e => e.Rank).HasColumnName("rank"); + + builder.Property(e => e.Score).HasColumnName("score"); + + builder.HasOne(d => d.PreviewCard) + .WithOne(p => p.PreviewCardTrend) + .HasForeignKey(d => d.PreviewCardId) + .HasConstraintName("fk_rails_371593db34"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/RelayEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/RelayEntityConfiguration.cs new file mode 100644 index 0000000..060d8e0 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/RelayEntityConfiguration.cs @@ -0,0 +1,36 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class RelayEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("relays"); + + builder.HasKey(e => e.Id).HasName("relays_pkey"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.FollowActivityId) + .HasColumnType("character varying") + .HasColumnName("follow_activity_id"); + + builder.Property(e => e.InboxUrl) + .HasColumnType("character varying") + .HasColumnName("inbox_url") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.State).HasColumnName("state"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/ReportEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/ReportEntityConfiguration.cs new file mode 100644 index 0000000..8d5e416 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/ReportEntityConfiguration.cs @@ -0,0 +1,89 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class ReportEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("reports"); + + builder.HasKey(e => e.Id).HasName("reports_pkey"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_reports_on_account_id"); + + builder.HasIndex(e => e.ActionTakenByAccountId) + .HasDatabaseName("index_reports_on_action_taken_by_account_id") + .HasFilter("(action_taken_by_account_id IS NOT NULL)"); + + builder.HasIndex(e => e.AssignedAccountId) + .HasDatabaseName("index_reports_on_assigned_account_id") + .HasFilter("(assigned_account_id IS NOT NULL)"); + + builder.HasIndex(e => e.TargetAccountId).HasDatabaseName("index_reports_on_target_account_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.ActionTakenAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("action_taken_at"); + + builder.Property(e => e.ActionTakenByAccountId).HasColumnName("action_taken_by_account_id"); + + builder.Property(e => e.AssignedAccountId).HasColumnName("assigned_account_id"); + + builder.Property(e => e.Category).HasColumnName("category"); + + builder.Property(e => e.Comment) + .HasColumnName("comment") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Forwarded).HasColumnName("forwarded"); + + builder.Property(e => e.RuleIds).HasColumnName("rule_ids"); + + builder.Property(e => e.StatusIds) + .HasColumnName("status_ids") + .HasDefaultValueSql("'{}'::bigint[]"); + + builder.Property(e => e.TargetAccountId).HasColumnName("target_account_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.Uri) + .HasColumnType("character varying") + .HasColumnName("uri"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.ReportAccounts) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_4b81f7522c"); + + builder.HasOne(d => d.ActionTakenByAccount) + .WithMany(p => p.ReportActionTakenByAccounts) + .HasForeignKey(d => d.ActionTakenByAccountId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_bca45b75fd"); + + builder.HasOne(d => d.AssignedAccount) + .WithMany(p => p.ReportAssignedAccounts) + .HasForeignKey(d => d.AssignedAccountId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_4e7a498fb4"); + + builder.HasOne(d => d.TargetAccount) + .WithMany(p => p.ReportTargetAccounts) + .HasForeignKey(d => d.TargetAccountId) + .HasConstraintName("fk_eb37af34f0"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/ReportNoteEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/ReportNoteEntityConfiguration.cs new file mode 100644 index 0000000..88aa29f --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/ReportNoteEntityConfiguration.cs @@ -0,0 +1,45 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class ReportNoteEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("report_notes"); + + builder.HasKey(e => e.Id).HasName("report_notes_pkey"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_report_notes_on_account_id"); + + builder.HasIndex(e => e.ReportId).HasDatabaseName("index_report_notes_on_report_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.Content).HasColumnName("content"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.ReportId).HasColumnName("report_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.ReportNotes) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_rails_cae66353f3"); + + builder.HasOne(d => d.Report) + .WithMany(p => p.ReportNotes) + .HasForeignKey(d => d.ReportId) + .HasConstraintName("fk_rails_7fa83a61eb"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/RuleEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/RuleEntityConfiguration.cs new file mode 100644 index 0000000..493fc8f --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/RuleEntityConfiguration.cs @@ -0,0 +1,35 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class RuleEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("rules"); + + builder.HasKey(e => e.Id).HasName("rules_pkey"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.DeletedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("deleted_at"); + + builder.Property(e => e.Priority).HasColumnName("priority"); + + builder.Property(e => e.Text) + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/ScheduledStatusEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/ScheduledStatusEntityConfiguration.cs new file mode 100644 index 0000000..d37907c --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/ScheduledStatusEntityConfiguration.cs @@ -0,0 +1,37 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class ScheduledStatusEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("scheduled_statuses"); + + builder.HasKey(e => e.Id).HasName("scheduled_statuses_pkey"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_scheduled_statuses_on_account_id"); + + builder.HasIndex(e => e.ScheduledAt).HasDatabaseName("index_scheduled_statuses_on_scheduled_at"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.Params) + .HasColumnType("jsonb") + .HasColumnName("params"); + + builder.Property(e => e.ScheduledAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("scheduled_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.ScheduledStatuses) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_23bd9018f9"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/SessionActivationEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/SessionActivationEntityConfiguration.cs new file mode 100644 index 0000000..d6b899f --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/SessionActivationEntityConfiguration.cs @@ -0,0 +1,61 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class SessionActivationEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("session_activations"); + + builder.HasKey(e => e.Id).HasName("session_activations_pkey"); + + builder.HasIndex(e => e.AccessTokenId).HasDatabaseName("index_session_activations_on_access_token_id"); + + builder.HasIndex(e => e.SessionId) + .HasDatabaseName("index_session_activations_on_session_id") + .IsUnique(); + + builder.HasIndex(e => e.UserId).HasDatabaseName("index_session_activations_on_user_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccessTokenId).HasColumnName("access_token_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Ip).HasColumnName("ip"); + + builder.Property(e => e.SessionId) + .HasColumnType("character varying") + .HasColumnName("session_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.UserAgent) + .HasColumnType("character varying") + .HasColumnName("user_agent") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.UserId).HasColumnName("user_id"); + + builder.Property(e => e.WebPushSubscriptionId).HasColumnName("web_push_subscription_id"); + + builder.HasOne(d => d.AccessToken) + .WithMany(p => p.SessionActivations) + .HasForeignKey(d => d.AccessTokenId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_957e5bda89"); + + builder.HasOne(d => d.User) + .WithMany(p => p.SessionActivations) + .HasForeignKey(d => d.UserId) + .HasConstraintName("fk_e5fda67334"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/SettingEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/SettingEntityConfiguration.cs new file mode 100644 index 0000000..76d560c --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/SettingEntityConfiguration.cs @@ -0,0 +1,41 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class SettingEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("settings"); + + builder.HasKey(e => e.Id).HasName("settings_pkey"); + + builder.HasIndex(e => new { e.ThingType, e.ThingId, e.Var }) + .HasDatabaseName("index_settings_on_thing_type_and_thing_id_and_var") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.ThingId).HasColumnName("thing_id"); + + builder.Property(e => e.ThingType) + .HasColumnType("character varying") + .HasColumnName("thing_type"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.Value).HasColumnName("value"); + + builder.Property(e => e.Var) + .HasColumnType("character varying") + .HasColumnName("var"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/SiteUploadEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/SiteUploadEntityConfiguration.cs new file mode 100644 index 0000000..7aaa9f1 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/SiteUploadEntityConfiguration.cs @@ -0,0 +1,56 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class SiteUploadEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("site_uploads"); + + builder.HasKey(e => e.Id).HasName("site_uploads_pkey"); + + builder.HasIndex(e => e.Var) + .HasDatabaseName("index_site_uploads_on_var") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.Blurhash) + .HasColumnType("character varying") + .HasColumnName("blurhash"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.FileContentType) + .HasColumnType("character varying") + .HasColumnName("file_content_type"); + + builder.Property(e => e.FileFileName) + .HasColumnType("character varying") + .HasColumnName("file_file_name"); + + builder.Property(e => e.FileFileSize).HasColumnName("file_file_size"); + + builder.Property(e => e.FileUpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("file_updated_at"); + + builder.Property(e => e.Meta) + .HasColumnType("json") + .HasColumnName("meta"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.Var) + .HasColumnType("character varying") + .HasColumnName("var") + .HasDefaultValueSql("''::character varying"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/StatusEditEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/StatusEditEntityConfiguration.cs new file mode 100644 index 0000000..984505d --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/StatusEditEntityConfiguration.cs @@ -0,0 +1,62 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class StatusEditEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("status_edits"); + + builder.HasKey(e => e.Id).HasName("status_edits_pkey"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_status_edits_on_account_id"); + + builder.HasIndex(e => e.StatusId).HasDatabaseName("index_status_edits_on_status_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.MediaDescriptions).HasColumnName("media_descriptions"); + + builder.Property(e => e.OrderedMediaAttachmentIds).HasColumnName("ordered_media_attachment_ids"); + + builder.Property(e => e.PollOptions) + .HasColumnType("character varying[]") + .HasColumnName("poll_options"); + + builder.Property(e => e.Sensitive).HasColumnName("sensitive"); + + builder.Property(e => e.SpoilerText) + .HasColumnName("spoiler_text") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.StatusId).HasColumnName("status_id"); + + builder.Property(e => e.Text) + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.StatusEdits) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_dc8988c545"); + + builder.HasOne(d => d.Status) + .WithMany(p => p.StatusEdits) + .HasForeignKey(d => d.StatusId) + .HasConstraintName("fk_rails_a960f234a0"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/StatusEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/StatusEntityConfiguration.cs new file mode 100644 index 0000000..21d1e14 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/StatusEntityConfiguration.cs @@ -0,0 +1,144 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class StatusEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("statuses"); + + builder.HasKey(e => e.Id).HasName("statuses_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.Id, e.Visibility, e.UpdatedAt }) + .HasDatabaseName("index_statuses_20190820") + .HasFilter("(deleted_at IS NULL)") + .IsDescending(false, true, false, false); + + builder.HasIndex(e => new { e.Id, e.AccountId }) + .HasDatabaseName("index_statuses_local_20190824") + .HasFilter( + "((local OR (uri IS NULL)) AND (deleted_at IS NULL) AND (visibility = 0) AND (reblog_of_id IS NULL) AND ((NOT reply) OR (in_reply_to_account_id = account_id)))") + .IsDescending(true, false); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_statuses_on_account_id"); + + builder.HasIndex(e => e.DeletedAt) + .HasDatabaseName("index_statuses_on_deleted_at") + .HasFilter("(deleted_at IS NOT NULL)"); + + builder.HasIndex(e => e.InReplyToAccountId) + .HasDatabaseName("index_statuses_on_in_reply_to_account_id") + .HasFilter("(in_reply_to_account_id IS NOT NULL)"); + + builder.HasIndex(e => e.InReplyToId) + .HasDatabaseName("index_statuses_on_in_reply_to_id") + .HasFilter("(in_reply_to_id IS NOT NULL)"); + + builder.HasIndex(e => new { e.ReblogOfId, e.AccountId }) + .HasDatabaseName("index_statuses_on_reblog_of_id_and_account_id"); + + builder.HasIndex(e => e.Uri) + .HasDatabaseName("index_statuses_on_uri") + .IsUnique() + .HasFilter("(uri IS NOT NULL)") + .HasOperators(new[] { "text_pattern_ops" }); + + builder.HasIndex(e => new { e.Id, e.AccountId }) + .HasDatabaseName("index_statuses_public_20200119") + .HasFilter( + "((deleted_at IS NULL) AND (visibility = 0) AND (reblog_of_id IS NULL) AND ((NOT reply) OR (in_reply_to_account_id = account_id)))") + .IsDescending(true, false); + + builder.Property(e => e.Id) + .HasColumnName("id") + .HasDefaultValueSql("timestamp_id('statuses'::text)"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.ApplicationId).HasColumnName("application_id"); + + builder.Property(e => e.ConversationId).HasColumnName("conversation_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.DeletedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("deleted_at"); + + builder.Property(e => e.EditedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("edited_at"); + + builder.Property(e => e.InReplyToAccountId).HasColumnName("in_reply_to_account_id"); + + builder.Property(e => e.InReplyToId).HasColumnName("in_reply_to_id"); + + builder.Property(e => e.Language) + .HasColumnType("character varying") + .HasColumnName("language"); + + builder.Property(e => e.Local).HasColumnName("local"); + + builder.Property(e => e.OrderedMediaAttachmentIds).HasColumnName("ordered_media_attachment_ids"); + + builder.Property(e => e.PollId).HasColumnName("poll_id"); + + builder.Property(e => e.ReblogOfId).HasColumnName("reblog_of_id"); + + builder.Property(e => e.Reply).HasColumnName("reply"); + + builder.Property(e => e.Sensitive).HasColumnName("sensitive"); + + builder.Property(e => e.SpoilerText) + .HasColumnName("spoiler_text") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.Text) + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + builder.Property(e => e.Trendable).HasColumnName("trendable"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.Uri) + .HasColumnType("character varying") + .HasColumnName("uri"); + + builder.Property(e => e.Url) + .HasColumnType("character varying") + .HasColumnName("url"); + + builder.Property(e => e.Visibility).HasColumnName("visibility"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.StatusAccounts) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_9bda1543f7"); + + builder.HasOne(d => d.InReplyToAccount) + .WithMany(p => p.StatusInReplyToAccounts) + .HasForeignKey(d => d.InReplyToAccountId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_c7fa917661"); + + builder.HasOne(d => d.InReplyTo) + .WithMany(p => p.InverseInReplyTo) + .HasForeignKey(d => d.InReplyToId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_94a6f70399"); + + builder.HasOne(d => d.ReblogOf) + .WithMany(p => p.InverseReblogOf) + .HasForeignKey(d => d.ReblogOfId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_256483a9ab"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/StatusPinEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/StatusPinEntityConfiguration.cs new file mode 100644 index 0000000..18470dc --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/StatusPinEntityConfiguration.cs @@ -0,0 +1,47 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class StatusPinEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("status_pins"); + + builder.HasKey(e => e.Id).HasName("status_pins_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.StatusId }) + .HasDatabaseName("index_status_pins_on_account_id_and_status_id") + .IsUnique(); + + builder.HasIndex(e => e.StatusId).HasDatabaseName("index_status_pins_on_status_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at") + .HasDefaultValueSql("now()"); + + builder.Property(e => e.StatusId).HasColumnName("status_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at") + .HasDefaultValueSql("now()"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.StatusPins) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_d4cb435b62"); + + builder.HasOne(d => d.Status) + .WithMany(p => p.StatusPins) + .HasForeignKey(d => d.StatusId) + .HasConstraintName("fk_rails_65c05552f1"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/StatusStatEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/StatusStatEntityConfiguration.cs new file mode 100644 index 0000000..58c0fdd --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/StatusStatEntityConfiguration.cs @@ -0,0 +1,42 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class StatusStatEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("status_stats"); + + builder.HasKey(e => e.Id).HasName("status_stats_pkey"); + + builder.HasIndex(e => e.StatusId) + .HasDatabaseName("index_status_stats_on_status_id") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.FavouritesCount).HasColumnName("favourites_count"); + + builder.Property(e => e.ReblogsCount).HasColumnName("reblogs_count"); + + builder.Property(e => e.RepliesCount).HasColumnName("replies_count"); + + builder.Property(e => e.StatusId).HasColumnName("status_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Status) + .WithOne(p => p.StatusStat) + .HasForeignKey(d => d.StatusId) + .HasConstraintName("fk_rails_4a247aac42"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/StatusTagEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/StatusTagEntityConfiguration.cs new file mode 100644 index 0000000..223b5e8 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/StatusTagEntityConfiguration.cs @@ -0,0 +1,35 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class StatusTagEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.HasNoKey(); + + builder.ToTable("statuses_tags"); + + builder.HasIndex(e => e.StatusId).HasDatabaseName("index_statuses_tags_on_status_id"); + + builder.HasIndex(e => new { e.TagId, e.StatusId }) + .HasDatabaseName("index_statuses_tags_on_tag_id_and_status_id") + .IsUnique(); + + builder.Property(e => e.StatusId).HasColumnName("status_id"); + + builder.Property(e => e.TagId).HasColumnName("tag_id"); + + builder.HasOne(d => d.Status) + .WithMany() + .HasForeignKey(d => d.StatusId) + .HasConstraintName("fk_rails_df0fe11427"); + + builder.HasOne(d => d.Tag) + .WithMany() + .HasForeignKey(d => d.TagId) + .HasConstraintName("fk_3081861e21"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/StatusTrendEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/StatusTrendEntityConfiguration.cs new file mode 100644 index 0000000..5f3e688 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/StatusTrendEntityConfiguration.cs @@ -0,0 +1,47 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class StatusTrendEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("status_trends"); + + builder.HasKey(e => e.Id).HasName("status_trends_pkey"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_status_trends_on_account_id"); + + builder.HasIndex(e => e.StatusId) + .HasDatabaseName("index_status_trends_on_status_id") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.Allowed).HasColumnName("allowed"); + + builder.Property(e => e.Language) + .HasColumnType("character varying") + .HasColumnName("language"); + + builder.Property(e => e.Rank).HasColumnName("rank"); + + builder.Property(e => e.Score).HasColumnName("score"); + + builder.Property(e => e.StatusId).HasColumnName("status_id"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.StatusTrends) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_rails_a6b527ea49"); + + builder.HasOne(d => d.Status) + .WithOne(p => p.StatusTrend) + .HasForeignKey(d => d.StatusId) + .HasConstraintName("fk_rails_68c610dc1a"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/SystemKeyEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/SystemKeyEntityConfiguration.cs new file mode 100644 index 0000000..73cee0b --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/SystemKeyEntityConfiguration.cs @@ -0,0 +1,27 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class SystemKeyEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("system_keys"); + + builder.HasKey(e => e.Id).HasName("system_keys_pkey"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Key).HasColumnName("key"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/TagEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/TagEntityConfiguration.cs new file mode 100644 index 0000000..22758cb --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/TagEntityConfiguration.cs @@ -0,0 +1,58 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class TagEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("tags"); + + builder.HasKey(e => e.Id).HasName("tags_pkey"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.DisplayName) + .HasColumnType("character varying") + .HasColumnName("display_name"); + + builder.Property(e => e.LastStatusAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("last_status_at"); + + builder.Property(e => e.Listable).HasColumnName("listable"); + + builder.Property(e => e.MaxScore).HasColumnName("max_score"); + + builder.Property(e => e.MaxScoreAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("max_score_at"); + + builder.Property(e => e.Name) + .HasColumnType("character varying") + .HasColumnName("name") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.RequestedReviewAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("requested_review_at"); + + builder.Property(e => e.ReviewedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("reviewed_at"); + + builder.Property(e => e.Trendable).HasColumnName("trendable"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.Usable).HasColumnName("usable"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/TagFollowEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/TagFollowEntityConfiguration.cs new file mode 100644 index 0000000..a8037e0 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/TagFollowEntityConfiguration.cs @@ -0,0 +1,45 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class TagFollowEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("tag_follows"); + + builder.HasKey(e => e.Id).HasName("tag_follows_pkey"); + + builder.HasIndex(e => new { e.AccountId, e.TagId }) + .HasDatabaseName("index_tag_follows_on_account_id_and_tag_id") + .IsUnique(); + + builder.HasIndex(e => e.TagId).HasDatabaseName("index_tag_follows_on_tag_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.TagId).HasColumnName("tag_id"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.TagFollows) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_rails_091e831473"); + + builder.HasOne(d => d.Tag) + .WithMany(p => p.TagFollows) + .HasForeignKey(d => d.TagId) + .HasConstraintName("fk_rails_0deefe597f"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/TombstoneEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/TombstoneEntityConfiguration.cs new file mode 100644 index 0000000..172bad0 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/TombstoneEntityConfiguration.cs @@ -0,0 +1,43 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class TombstoneEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("tombstones"); + + builder.HasKey(e => e.Id).HasName("tombstones_pkey"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_tombstones_on_account_id"); + + builder.HasIndex(e => e.Uri).HasDatabaseName("index_tombstones_on_uri"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.ByModerator).HasColumnName("by_moderator"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.Uri) + .HasColumnType("character varying") + .HasColumnName("uri"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.Tombstones) + .HasForeignKey(d => d.AccountId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_f95b861449"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/UnavailableDomainEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/UnavailableDomainEntityConfiguration.cs new file mode 100644 index 0000000..8fa1e42 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/UnavailableDomainEntityConfiguration.cs @@ -0,0 +1,34 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class UnavailableDomainEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("unavailable_domains"); + + builder.HasKey(e => e.Id).HasName("unavailable_domains_pkey"); + + builder.HasIndex(e => e.Domain) + .HasDatabaseName("index_unavailable_domains_on_domain") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Domain) + .HasColumnType("character varying") + .HasColumnName("domain") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/UserEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/UserEntityConfiguration.cs new file mode 100644 index 0000000..13acd4e --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/UserEntityConfiguration.cs @@ -0,0 +1,183 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class UserEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("users"); + + builder.HasKey(e => e.Id).HasName("users_pkey"); + + builder.HasIndex(e => e.AccountId).HasDatabaseName("index_users_on_account_id"); + + builder.HasIndex(e => e.ConfirmationToken) + .HasDatabaseName("index_users_on_confirmation_token") + .IsUnique(); + + builder.HasIndex(e => e.CreatedByApplicationId) + .HasDatabaseName("index_users_on_created_by_application_id") + .HasFilter("(created_by_application_id IS NOT NULL)"); + + builder.HasIndex(e => e.Email) + .HasDatabaseName("index_users_on_email") + .IsUnique(); + + builder.HasIndex(e => e.ResetPasswordToken) + .HasDatabaseName("index_users_on_reset_password_token") + .IsUnique() + .HasFilter("(reset_password_token IS NOT NULL)") + .HasOperators(new[] { "text_pattern_ops" }); + + builder.HasIndex(e => e.RoleId) + .HasDatabaseName("index_users_on_role_id") + .HasFilter("(role_id IS NOT NULL)"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccountId).HasColumnName("account_id"); + + builder.Property(e => e.Admin).HasColumnName("admin"); + + builder.Property(e => e.Approved) + .IsRequired() + .HasColumnName("approved") + .HasDefaultValueSql("true"); + + builder.Property(e => e.ChosenLanguages) + .HasColumnType("character varying[]") + .HasColumnName("chosen_languages"); + + builder.Property(e => e.ConfirmationSentAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("confirmation_sent_at"); + + builder.Property(e => e.ConfirmationToken) + .HasColumnType("character varying") + .HasColumnName("confirmation_token"); + + builder.Property(e => e.ConfirmedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("confirmed_at"); + + builder.Property(e => e.ConsumedTimestep).HasColumnName("consumed_timestep"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.CreatedByApplicationId).HasColumnName("created_by_application_id"); + + builder.Property(e => e.CurrentSignInAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("current_sign_in_at"); + + builder.Property(e => e.Disabled).HasColumnName("disabled"); + + builder.Property(e => e.Email) + .HasColumnType("character varying") + .HasColumnName("email") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.EncryptedOtpSecret) + .HasColumnType("character varying") + .HasColumnName("encrypted_otp_secret"); + + builder.Property(e => e.EncryptedOtpSecretIv) + .HasColumnType("character varying") + .HasColumnName("encrypted_otp_secret_iv"); + + builder.Property(e => e.EncryptedOtpSecretSalt) + .HasColumnType("character varying") + .HasColumnName("encrypted_otp_secret_salt"); + + builder.Property(e => e.EncryptedPassword) + .HasColumnType("character varying") + .HasColumnName("encrypted_password") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.InviteId).HasColumnName("invite_id"); + + builder.Property(e => e.LastEmailedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("last_emailed_at"); + + builder.Property(e => e.LastSignInAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("last_sign_in_at"); + + builder.Property(e => e.Locale) + .HasColumnType("character varying") + .HasColumnName("locale"); + + builder.Property(e => e.Moderator).HasColumnName("moderator"); + + builder.Property(e => e.OtpBackupCodes) + .HasColumnType("character varying[]") + .HasColumnName("otp_backup_codes"); + + builder.Property(e => e.OtpRequiredForLogin).HasColumnName("otp_required_for_login"); + + builder.Property(e => e.ResetPasswordSentAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("reset_password_sent_at"); + + builder.Property(e => e.ResetPasswordToken) + .HasColumnType("character varying") + .HasColumnName("reset_password_token"); + + builder.Property(e => e.RoleId).HasColumnName("role_id"); + + builder.Property(e => e.SignInCount).HasColumnName("sign_in_count"); + + builder.Property(e => e.SignInToken) + .HasColumnType("character varying") + .HasColumnName("sign_in_token"); + + builder.Property(e => e.SignInTokenSentAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("sign_in_token_sent_at"); + + builder.Property(e => e.SignUpIp).HasColumnName("sign_up_ip"); + + builder.Property(e => e.SkipSignInToken).HasColumnName("skip_sign_in_token"); + + builder.Property(e => e.UnconfirmedEmail) + .HasColumnType("character varying") + .HasColumnName("unconfirmed_email"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.WebAuthnId) + .HasColumnType("character varying") + .HasColumnName("webauthn_id"); + + builder.HasOne(d => d.Account) + .WithMany(p => p.Users) + .HasForeignKey(d => d.AccountId) + .HasConstraintName("fk_50500f500d"); + + builder.HasOne(d => d.CreatedByApplication) + .WithMany(p => p.Users) + .HasForeignKey(d => d.CreatedByApplicationId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_ecc9536e7c"); + + builder.HasOne(d => d.Invite) + .WithMany(p => p.Users) + .HasForeignKey(d => d.InviteId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_8fb2a43e88"); + + builder.HasOne(d => d.Role) + .WithMany(p => p.Users) + .HasForeignKey(d => d.RoleId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_642f17018b"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/UserInviteRequestEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/UserInviteRequestEntityConfiguration.cs new file mode 100644 index 0000000..88fc8f4 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/UserInviteRequestEntityConfiguration.cs @@ -0,0 +1,37 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class UserInviteRequestEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("user_invite_requests"); + + builder.HasKey(e => e.Id).HasName("user_invite_requests_pkey"); + + builder.HasIndex(e => e.UserId).HasDatabaseName("index_user_invite_requests_on_user_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Text).HasColumnName("text"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.UserId).HasColumnName("user_id"); + + builder.HasOne(d => d.User) + .WithMany(p => p.UserInviteRequests) + .HasForeignKey(d => d.UserId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_3773f15361"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/UserIpEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/UserIpEntityConfiguration.cs new file mode 100644 index 0000000..0079200 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/UserIpEntityConfiguration.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class UserIpEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.HasNoKey(); + + builder.ToView("user_ips"); + + builder.Property(e => e.Ip).HasColumnName("ip"); + + builder.Property(e => e.UsedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("used_at"); + + builder.Property(e => e.UserId).HasColumnName("user_id"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/UserRoleEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/UserRoleEntityConfiguration.cs new file mode 100644 index 0000000..96a143c --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/UserRoleEntityConfiguration.cs @@ -0,0 +1,41 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class UserRoleEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("user_roles"); + + builder.HasKey(e => e.Id).HasName("user_roles_pkey"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.Color) + .HasColumnType("character varying") + .HasColumnName("color") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Highlighted).HasColumnName("highlighted"); + + builder.Property(e => e.Name) + .HasColumnType("character varying") + .HasColumnName("name") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.Permissions).HasColumnName("permissions"); + + builder.Property(e => e.Position).HasColumnName("position"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/WebAuthnCredentialEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/WebAuthnCredentialEntityConfiguration.cs new file mode 100644 index 0000000..6d84959 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/WebAuthnCredentialEntityConfiguration.cs @@ -0,0 +1,52 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class WebAuthnCredentialEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("webauthn_credentials"); + + builder.HasKey(e => e.Id).HasName("webauthn_credentials_pkey"); + + builder.HasIndex(e => e.ExternalId) + .HasDatabaseName("index_webauthn_credentials_on_external_id") + .IsUnique(); + + builder.HasIndex(e => e.UserId).HasDatabaseName("index_webauthn_credentials_on_user_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.ExternalId) + .HasColumnType("character varying") + .HasColumnName("external_id"); + + builder.Property(e => e.Nickname) + .HasColumnType("character varying") + .HasColumnName("nickname"); + + builder.Property(e => e.PublicKey) + .HasColumnType("character varying") + .HasColumnName("public_key"); + + builder.Property(e => e.SignCount).HasColumnName("sign_count"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.UserId).HasColumnName("user_id"); + + builder.HasOne(d => d.User) + .WithMany(p => p.WebAuthnCredentials) + .HasForeignKey(d => d.UserId) + .HasConstraintName("fk_rails_a4355aef77"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/WebPushSubscriptionEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/WebPushSubscriptionEntityConfiguration.cs new file mode 100644 index 0000000..4a428d1 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/WebPushSubscriptionEntityConfiguration.cs @@ -0,0 +1,63 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class WebPushSubscriptionEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("web_push_subscriptions"); + + builder.HasKey(e => e.Id).HasName("web_push_subscriptions_pkey"); + + builder.HasIndex(e => e.AccessTokenId) + .HasDatabaseName("index_web_push_subscriptions_on_access_token_id") + .HasFilter("(access_token_id IS NOT NULL)"); + + builder.HasIndex(e => e.UserId).HasDatabaseName("index_web_push_subscriptions_on_user_id"); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.AccessTokenId).HasColumnName("access_token_id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Data) + .HasColumnType("json") + .HasColumnName("data"); + + builder.Property(e => e.Endpoint) + .HasColumnType("character varying") + .HasColumnName("endpoint"); + + builder.Property(e => e.KeyAuth) + .HasColumnType("character varying") + .HasColumnName("key_auth"); + + builder.Property(e => e.KeyP256dh) + .HasColumnType("character varying") + .HasColumnName("key_p256dh"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.UserId).HasColumnName("user_id"); + + builder.HasOne(d => d.AccessToken) + .WithMany(p => p.WebPushSubscriptions) + .HasForeignKey(d => d.AccessTokenId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_751a9f390b"); + + builder.HasOne(d => d.User) + .WithMany(p => p.WebPushSubscriptions) + .HasForeignKey(d => d.UserId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_b006f28dac"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/WebSettingEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/WebSettingEntityConfiguration.cs new file mode 100644 index 0000000..7e2c130 --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/WebSettingEntityConfiguration.cs @@ -0,0 +1,40 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class WebSettingEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("web_settings"); + + builder.HasKey(e => e.Id).HasName("web_settings_pkey"); + + builder.HasIndex(e => e.UserId) + .HasDatabaseName("index_web_settings_on_user_id") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Data) + .HasColumnType("json") + .HasColumnName("data"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.UserId).HasColumnName("user_id"); + + builder.HasOne(d => d.User) + .WithOne(p => p.WebSetting) + .HasForeignKey(d => d.UserId) + .HasConstraintName("fk_11910667b2"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configuration/WebhookEntityConfiguration.cs b/src/Infrastructure/Persistence/Configuration/WebhookEntityConfiguration.cs new file mode 100644 index 0000000..5e9cb7b --- /dev/null +++ b/src/Infrastructure/Persistence/Configuration/WebhookEntityConfiguration.cs @@ -0,0 +1,48 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence.Configuration; + +public class WebhookEntityConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("webhooks"); + + builder.HasKey(e => e.Id).HasName("webhooks_pkey"); + + builder.HasIndex(e => e.Url) + .HasDatabaseName("index_webhooks_on_url") + .IsUnique(); + + builder.Property(e => e.Id).HasColumnName("id"); + + builder.Property(e => e.CreatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + builder.Property(e => e.Enabled) + .IsRequired() + .HasColumnName("enabled") + .HasDefaultValueSql("true"); + + builder.Property(e => e.Events) + .HasColumnType("character varying[]") + .HasColumnName("events") + .HasDefaultValueSql("'{}'::character varying[]"); + + builder.Property(e => e.Secret) + .HasColumnType("character varying") + .HasColumnName("secret") + .HasDefaultValueSql("''::character varying"); + + builder.Property(e => e.UpdatedAt) + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + builder.Property(e => e.Url) + .HasColumnType("character varying") + .HasColumnName("url"); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Migrations/20221125033633_InitialCreate.Designer.cs b/src/Infrastructure/Persistence/Migrations/20221125033633_InitialCreate.Designer.cs new file mode 100644 index 0000000..2ac5631 --- /dev/null +++ b/src/Infrastructure/Persistence/Migrations/20221125033633_InitialCreate.Designer.cs @@ -0,0 +1,6496 @@ +// +using System; +using System.Net; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using Smilodon.Infrastructure.Persistence; + +#nullable disable + +namespace Smilodon.Infrastructure.Persistence.Migrations +{ + [DbContext(typeof(SmilodonDbContext))] + [Migration("20221125033633_InitialCreate")] + partial class InitialCreate + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "plpgsql"); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.HasSequence("accounts_id_seq"); + + modelBuilder.HasSequence("encrypted_messages_id_seq"); + + modelBuilder.HasSequence("media_attachments_id_seq"); + + modelBuilder.HasSequence("statuses_id_seq"); + + modelBuilder.Entity("Smilodon.Domain.Models.Account", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id") + .HasDefaultValueSql("timestamp_id('accounts'::text)"); + + b.Property("ActorType") + .HasColumnType("character varying") + .HasColumnName("actor_type"); + + b.Property("AlsoKnownAs") + .HasColumnType("character varying[]") + .HasColumnName("also_known_as"); + + b.Property("AvatarContentType") + .HasColumnType("character varying") + .HasColumnName("avatar_content_type"); + + b.Property("AvatarFileName") + .HasColumnType("character varying") + .HasColumnName("avatar_file_name"); + + b.Property("AvatarFileSize") + .HasColumnType("integer") + .HasColumnName("avatar_file_size"); + + b.Property("AvatarRemoteUrl") + .HasColumnType("character varying") + .HasColumnName("avatar_remote_url"); + + b.Property("AvatarStorageSchemaVersion") + .HasColumnType("integer") + .HasColumnName("avatar_storage_schema_version"); + + b.Property("AvatarUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("avatar_updated_at"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("DevicesUrl") + .HasColumnType("character varying") + .HasColumnName("devices_url"); + + b.Property("Discoverable") + .HasColumnType("boolean") + .HasColumnName("discoverable"); + + b.Property("DisplayName") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("display_name") + .HasDefaultValueSql("''::character varying"); + + b.Property("Domain") + .HasColumnType("character varying") + .HasColumnName("domain"); + + b.Property("FeaturedCollectionUrl") + .HasColumnType("character varying") + .HasColumnName("featured_collection_url"); + + b.Property("Fields") + .HasColumnType("jsonb") + .HasColumnName("fields"); + + b.Property("FollowersUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("followers_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("HeaderContentType") + .HasColumnType("character varying") + .HasColumnName("header_content_type"); + + b.Property("HeaderFileName") + .HasColumnType("character varying") + .HasColumnName("header_file_name"); + + b.Property("HeaderFileSize") + .HasColumnType("integer") + .HasColumnName("header_file_size"); + + b.Property("HeaderRemoteUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("header_remote_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("HeaderStorageSchemaVersion") + .HasColumnType("integer") + .HasColumnName("header_storage_schema_version"); + + b.Property("HeaderUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("header_updated_at"); + + b.Property("HideCollections") + .HasColumnType("boolean") + .HasColumnName("hide_collections"); + + b.Property("InboxUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("inbox_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("LastWebfingeredAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_webfingered_at"); + + b.Property("Locked") + .HasColumnType("boolean") + .HasColumnName("locked"); + + b.Property("Memorial") + .HasColumnType("boolean") + .HasColumnName("memorial"); + + b.Property("MovedToAccountId") + .HasColumnType("bigint") + .HasColumnName("moved_to_account_id"); + + b.Property("Note") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("note") + .HasDefaultValueSql("''::text"); + + b.Property("OutboxUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("outbox_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("PrivateKey") + .HasColumnType("text") + .HasColumnName("private_key"); + + b.Property("Protocol") + .HasColumnType("integer") + .HasColumnName("protocol"); + + b.Property("PublicKey") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("public_key") + .HasDefaultValueSql("''::text"); + + b.Property("RequestedReviewAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("requested_review_at"); + + b.Property("ReviewedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("reviewed_at"); + + b.Property("SensitizedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("sensitized_at"); + + b.Property("SharedInboxUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("shared_inbox_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("SilencedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("silenced_at"); + + b.Property("SuspendedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("suspended_at"); + + b.Property("SuspensionOrigin") + .HasColumnType("integer") + .HasColumnName("suspension_origin"); + + b.Property("Trendable") + .HasColumnType("boolean") + .HasColumnName("trendable"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("uri") + .HasDefaultValueSql("''::character varying"); + + b.Property("Url") + .HasColumnType("character varying") + .HasColumnName("url"); + + b.Property("Username") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("username") + .HasDefaultValueSql("''::character varying"); + + b.HasKey("Id") + .HasName("accounts_pkey"); + + b.HasIndex("MovedToAccountId") + .HasDatabaseName("index_accounts_on_moved_to_account_id") + .HasFilter("(moved_to_account_id IS NOT NULL)"); + + b.HasIndex("Uri") + .HasDatabaseName("index_accounts_on_uri"); + + b.HasIndex("Url") + .HasDatabaseName("index_accounts_on_url") + .HasFilter("(url IS NOT NULL)"); + + NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex("Url"), new[] { "text_pattern_ops" }); + + b.ToTable("accounts", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountAlias", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Acct") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("acct") + .HasDefaultValueSql("''::character varying"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("uri") + .HasDefaultValueSql("''::character varying"); + + b.HasKey("Id") + .HasName("account_aliases_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_account_aliases_on_account_id"); + + b.ToTable("account_aliases", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountConversation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("ConversationId") + .HasColumnType("bigint") + .HasColumnName("conversation_id"); + + b.Property("LastStatusId") + .HasColumnType("bigint") + .HasColumnName("last_status_id"); + + b.Property("LockVersion") + .HasColumnType("integer") + .HasColumnName("lock_version"); + + b.Property("ParticipantAccountIds") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("bigint[]") + .HasColumnName("participant_account_ids") + .HasDefaultValueSql("'{}'::bigint[]"); + + b.Property("StatusIds") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("bigint[]") + .HasColumnName("status_ids") + .HasDefaultValueSql("'{}'::bigint[]"); + + b.Property("Unread") + .HasColumnType("boolean") + .HasColumnName("unread"); + + b.HasKey("Id") + .HasName("account_conversations_pkey"); + + b.HasIndex("ConversationId") + .HasDatabaseName("index_account_conversations_on_conversation_id"); + + b.HasIndex("AccountId", "ConversationId", "ParticipantAccountIds") + .IsUnique() + .HasDatabaseName("index_unique_conversations"); + + b.ToTable("account_conversations", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountDeletionRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_deletion_requests_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_account_deletion_requests_on_account_id"); + + b.ToTable("account_deletion_requests", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountDomainBlock", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Domain") + .HasColumnType("character varying") + .HasColumnName("domain"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_domain_blocks_pkey"); + + b.HasIndex("AccountId", "Domain") + .IsUnique() + .HasDatabaseName("index_account_domain_blocks_on_account_id_and_domain"); + + b.ToTable("account_domain_blocks", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountMigration", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Acct") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("acct") + .HasDefaultValueSql("''::character varying"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("FollowersCount") + .HasColumnType("bigint") + .HasColumnName("followers_count"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_migrations_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_account_migrations_on_account_id"); + + b.HasIndex("TargetAccountId") + .HasDatabaseName("index_account_migrations_on_target_account_id") + .HasFilter("(target_account_id IS NOT NULL)"); + + b.ToTable("account_migrations", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountModerationNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Content") + .IsRequired() + .HasColumnType("text") + .HasColumnName("content"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_moderation_notes_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_account_moderation_notes_on_account_id"); + + b.HasIndex("TargetAccountId") + .HasDatabaseName("index_account_moderation_notes_on_target_account_id"); + + b.ToTable("account_moderation_notes", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("text") + .HasColumnName("comment"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_notes_pkey"); + + b.HasIndex("TargetAccountId") + .HasDatabaseName("index_account_notes_on_target_account_id"); + + b.HasIndex("AccountId", "TargetAccountId") + .IsUnique() + .HasDatabaseName("index_account_notes_on_account_id_and_target_account_id"); + + b.ToTable("account_notes", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountPin", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_pins_pkey"); + + b.HasIndex("TargetAccountId") + .HasDatabaseName("index_account_pins_on_target_account_id"); + + b.HasIndex("AccountId", "TargetAccountId") + .IsUnique() + .HasDatabaseName("index_account_pins_on_account_id_and_target_account_id"); + + b.ToTable("account_pins", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountStat", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("FollowersCount") + .HasColumnType("bigint") + .HasColumnName("followers_count"); + + b.Property("FollowingCount") + .HasColumnType("bigint") + .HasColumnName("following_count"); + + b.Property("LastStatusAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_status_at"); + + b.Property("StatusesCount") + .HasColumnType("bigint") + .HasColumnName("statuses_count"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_stats_pkey"); + + b.HasIndex("AccountId") + .IsUnique() + .HasDatabaseName("index_account_stats_on_account_id"); + + b.ToTable("account_stats", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountStatusesCleanupPolicy", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("Enabled") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("enabled") + .HasDefaultValueSql("true"); + + b.Property("KeepDirect") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("keep_direct") + .HasDefaultValueSql("true"); + + b.Property("KeepMedia") + .HasColumnType("boolean") + .HasColumnName("keep_media"); + + b.Property("KeepPinned") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("keep_pinned") + .HasDefaultValueSql("true"); + + b.Property("KeepPolls") + .HasColumnType("boolean") + .HasColumnName("keep_polls"); + + b.Property("KeepSelfBookmark") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("keep_self_bookmark") + .HasDefaultValueSql("true"); + + b.Property("KeepSelfFav") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("keep_self_fav") + .HasDefaultValueSql("true"); + + b.Property("MinFavs") + .HasColumnType("integer") + .HasColumnName("min_favs"); + + b.Property("MinReblogs") + .HasColumnType("integer") + .HasColumnName("min_reblogs"); + + b.Property("MinStatusAge") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("min_status_age") + .HasDefaultValueSql("1209600"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_statuses_cleanup_policies_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_account_statuses_cleanup_policies_on_account_id"); + + b.ToTable("account_statuses_cleanup_policies", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountSummary", b => + { + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Language") + .HasColumnType("character varying") + .HasColumnName("language"); + + b.Property("Sensitive") + .HasColumnType("boolean") + .HasColumnName("sensitive"); + + b.ToTable((string)null); + + b.ToView("account_summaries", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountTag", b => + { + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("TagId") + .HasColumnType("bigint") + .HasColumnName("tag_id"); + + b.HasIndex("AccountId", "TagId") + .HasDatabaseName("index_accounts_tags_on_account_id_and_tag_id"); + + b.HasIndex("TagId", "AccountId") + .IsUnique() + .HasDatabaseName("index_accounts_tags_on_tag_id_and_account_id"); + + b.ToTable("accounts_tags", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountWarning", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Action") + .HasColumnType("integer") + .HasColumnName("action"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("OverruledAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("overruled_at"); + + b.Property("ReportId") + .HasColumnType("bigint") + .HasColumnName("report_id"); + + b.Property("StatusIds") + .HasColumnType("character varying[]") + .HasColumnName("status_ids"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("Text") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_warnings_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_account_warnings_on_account_id"); + + b.HasIndex("ReportId") + .HasDatabaseName("ix_account_warnings_report_id"); + + b.HasIndex("TargetAccountId") + .HasDatabaseName("index_account_warnings_on_target_account_id"); + + b.ToTable("account_warnings", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountWarningPreset", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Text") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + b.Property("Title") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("title") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_warning_presets_pkey"); + + b.ToTable("account_warning_presets", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AdminActionLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Action") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("action") + .HasDefaultValueSql("''::character varying"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("HumanIdentifier") + .HasColumnType("character varying") + .HasColumnName("human_identifier"); + + b.Property("Permalink") + .HasColumnType("character varying") + .HasColumnName("permalink"); + + b.Property("RouteParam") + .HasColumnType("character varying") + .HasColumnName("route_param"); + + b.Property("TargetId") + .HasColumnType("bigint") + .HasColumnName("target_id"); + + b.Property("TargetType") + .HasColumnType("character varying") + .HasColumnName("target_type"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("admin_action_logs_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_admin_action_logs_on_account_id"); + + b.HasIndex("TargetType", "TargetId") + .HasDatabaseName("index_admin_action_logs_on_target_type_and_target_id"); + + b.ToTable("admin_action_logs", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Announcement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AllDay") + .HasColumnType("boolean") + .HasColumnName("all_day"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("EndsAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("ends_at"); + + b.Property("Published") + .HasColumnType("boolean") + .HasColumnName("published"); + + b.Property("PublishedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("published_at"); + + b.Property("ScheduledAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("scheduled_at"); + + b.Property("StartsAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("starts_at"); + + b.Property("StatusIds") + .HasColumnType("bigint[]") + .HasColumnName("status_ids"); + + b.Property("Text") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("announcements_pkey"); + + b.ToTable("announcements", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AnnouncementMute", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("AnnouncementId") + .HasColumnType("bigint") + .HasColumnName("announcement_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("announcement_mutes_pkey"); + + b.HasIndex("AnnouncementId") + .HasDatabaseName("index_announcement_mutes_on_announcement_id"); + + b.HasIndex("AccountId", "AnnouncementId") + .IsUnique() + .HasDatabaseName("index_announcement_mutes_on_account_id_and_announcement_id"); + + b.ToTable("announcement_mutes", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AnnouncementReaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("AnnouncementId") + .HasColumnType("bigint") + .HasColumnName("announcement_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("CustomEmojiId") + .HasColumnType("bigint") + .HasColumnName("custom_emoji_id"); + + b.Property("Name") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("name") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("announcement_reactions_pkey"); + + b.HasIndex("AnnouncementId") + .HasDatabaseName("index_announcement_reactions_on_announcement_id"); + + b.HasIndex("CustomEmojiId") + .HasDatabaseName("index_announcement_reactions_on_custom_emoji_id") + .HasFilter("(custom_emoji_id IS NOT NULL)"); + + b.HasIndex("AccountId", "AnnouncementId", "Name") + .IsUnique() + .HasDatabaseName("index_announcement_reactions_on_account_id_and_announcement_id"); + + b.ToTable("announcement_reactions", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Appeal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("AccountWarningId") + .HasColumnType("bigint") + .HasColumnName("account_warning_id"); + + b.Property("ApprovedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("approved_at"); + + b.Property("ApprovedByAccountId") + .HasColumnType("bigint") + .HasColumnName("approved_by_account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("RejectedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("rejected_at"); + + b.Property("RejectedByAccountId") + .HasColumnType("bigint") + .HasColumnName("rejected_by_account_id"); + + b.Property("Text") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("appeals_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_appeals_on_account_id"); + + b.HasIndex("AccountWarningId") + .IsUnique() + .HasDatabaseName("index_appeals_on_account_warning_id"); + + b.HasIndex("ApprovedByAccountId") + .HasDatabaseName("index_appeals_on_approved_by_account_id") + .HasFilter("(approved_by_account_id IS NOT NULL)"); + + b.HasIndex("RejectedByAccountId") + .HasDatabaseName("index_appeals_on_rejected_by_account_id") + .HasFilter("(rejected_by_account_id IS NOT NULL)"); + + b.ToTable("appeals", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ArInternalMetadatum", b => + { + b.Property("Key") + .HasColumnType("character varying") + .HasColumnName("key"); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.Property("Value") + .HasColumnType("character varying") + .HasColumnName("value"); + + b.HasKey("Key") + .HasName("ar_internal_metadata_pkey"); + + b.ToTable("ar_internal_metadata", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Backup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("DumpContentType") + .HasColumnType("character varying") + .HasColumnName("dump_content_type"); + + b.Property("DumpFileName") + .HasColumnType("character varying") + .HasColumnName("dump_file_name"); + + b.Property("DumpFileSize") + .HasColumnType("bigint") + .HasColumnName("dump_file_size"); + + b.Property("DumpUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("dump_updated_at"); + + b.Property("Processed") + .HasColumnType("boolean") + .HasColumnName("processed"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("backups_pkey"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_backups_user_id"); + + b.ToTable("backups", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Block", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .HasColumnType("character varying") + .HasColumnName("uri"); + + b.HasKey("Id") + .HasName("blocks_pkey"); + + b.HasIndex("TargetAccountId") + .HasDatabaseName("index_blocks_on_target_account_id"); + + b.HasIndex("AccountId", "TargetAccountId") + .IsUnique() + .HasDatabaseName("index_blocks_on_account_id_and_target_account_id"); + + b.ToTable("blocks", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Bookmark", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("bookmarks_pkey"); + + b.HasIndex("StatusId") + .HasDatabaseName("index_bookmarks_on_status_id"); + + b.HasIndex("AccountId", "StatusId") + .IsUnique() + .HasDatabaseName("index_bookmarks_on_account_id_and_status_id"); + + b.ToTable("bookmarks", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CanonicalEmailBlock", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CanonicalEmailHash") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("canonical_email_hash") + .HasDefaultValueSql("''::character varying"); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("ReferenceAccountId") + .HasColumnType("bigint") + .HasColumnName("reference_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("canonical_email_blocks_pkey"); + + b.HasIndex("CanonicalEmailHash") + .IsUnique() + .HasDatabaseName("index_canonical_email_blocks_on_canonical_email_hash"); + + b.HasIndex("ReferenceAccountId") + .HasDatabaseName("index_canonical_email_blocks_on_reference_account_id"); + + b.ToTable("canonical_email_blocks", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Conversation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .HasColumnType("character varying") + .HasColumnName("uri"); + + b.HasKey("Id") + .HasName("conversations_pkey"); + + b.HasIndex("Uri") + .IsUnique() + .HasDatabaseName("index_conversations_on_uri") + .HasFilter("(uri IS NOT NULL)"); + + NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex("Uri"), new[] { "text_pattern_ops" }); + + b.ToTable("conversations", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ConversationMute", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("ConversationId") + .HasColumnType("bigint") + .HasColumnName("conversation_id"); + + b.HasKey("Id") + .HasName("conversation_mutes_pkey"); + + b.HasIndex("ConversationId") + .HasDatabaseName("ix_conversation_mutes_conversation_id"); + + b.HasIndex("AccountId", "ConversationId") + .IsUnique() + .HasDatabaseName("index_conversation_mutes_on_account_id_and_conversation_id"); + + b.ToTable("conversation_mutes", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomEmoji", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CategoryId") + .HasColumnType("bigint") + .HasColumnName("category_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Disabled") + .HasColumnType("boolean") + .HasColumnName("disabled"); + + b.Property("Domain") + .HasColumnType("character varying") + .HasColumnName("domain"); + + b.Property("ImageContentType") + .HasColumnType("character varying") + .HasColumnName("image_content_type"); + + b.Property("ImageFileName") + .HasColumnType("character varying") + .HasColumnName("image_file_name"); + + b.Property("ImageFileSize") + .HasColumnType("integer") + .HasColumnName("image_file_size"); + + b.Property("ImageRemoteUrl") + .HasColumnType("character varying") + .HasColumnName("image_remote_url"); + + b.Property("ImageStorageSchemaVersion") + .HasColumnType("integer") + .HasColumnName("image_storage_schema_version"); + + b.Property("ImageUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("image_updated_at"); + + b.Property("Shortcode") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("shortcode") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .HasColumnType("character varying") + .HasColumnName("uri"); + + b.Property("VisibleInPicker") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("visible_in_picker") + .HasDefaultValueSql("true"); + + b.HasKey("Id") + .HasName("custom_emojis_pkey"); + + b.HasIndex("Shortcode", "Domain") + .IsUnique() + .HasDatabaseName("index_custom_emojis_on_shortcode_and_domain"); + + b.ToTable("custom_emojis", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomEmojiCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Name") + .HasColumnType("character varying") + .HasColumnName("name"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("custom_emoji_categories_pkey"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("index_custom_emoji_categories_on_name"); + + b.ToTable("custom_emoji_categories", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomFilter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Action") + .HasColumnType("integer") + .HasColumnName("action"); + + b.Property("Context") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying[]") + .HasColumnName("context") + .HasDefaultValueSql("'{}'::character varying[]"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("expires_at"); + + b.Property("Phrase") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("phrase") + .HasDefaultValueSql("''::text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("custom_filters_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_custom_filters_on_account_id"); + + b.ToTable("custom_filters", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomFilterKeyword", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("CustomFilterId") + .HasColumnType("bigint") + .HasColumnName("custom_filter_id"); + + b.Property("Keyword") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("keyword") + .HasDefaultValueSql("''::text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.Property("WholeWord") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("whole_word") + .HasDefaultValueSql("true"); + + b.HasKey("Id") + .HasName("custom_filter_keywords_pkey"); + + b.HasIndex("CustomFilterId") + .HasDatabaseName("index_custom_filter_keywords_on_custom_filter_id"); + + b.ToTable("custom_filter_keywords", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomFilterStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("CustomFilterId") + .HasColumnType("bigint") + .HasColumnName("custom_filter_id"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("custom_filter_statuses_pkey"); + + b.HasIndex("CustomFilterId") + .HasDatabaseName("index_custom_filter_statuses_on_custom_filter_id"); + + b.HasIndex("StatusId") + .HasDatabaseName("index_custom_filter_statuses_on_status_id"); + + b.ToTable("custom_filter_statuses", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Device", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccessTokenId") + .HasColumnType("bigint") + .HasColumnName("access_token_id"); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("DeviceId") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("device_id") + .HasDefaultValueSql("''::character varying"); + + b.Property("FingerprintKey") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("fingerprint_key") + .HasDefaultValueSql("''::text"); + + b.Property("IdentityKey") + .IsRequired() + .HasColumnType("text") + .HasColumnName("identity_key"); + + b.Property("Name") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("name") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("devices_pkey"); + + b.HasIndex("AccessTokenId") + .HasDatabaseName("index_devices_on_access_token_id"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_devices_on_account_id"); + + b.ToTable("devices", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.DomainAllow", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Domain") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("domain") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("domain_allows_pkey"); + + b.HasIndex("Domain") + .IsUnique() + .HasDatabaseName("index_domain_allows_on_domain"); + + b.ToTable("domain_allows", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.DomainBlock", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Domain") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("domain") + .HasDefaultValueSql("''::character varying"); + + b.Property("Obfuscate") + .HasColumnType("boolean") + .HasColumnName("obfuscate"); + + b.Property("PrivateComment") + .HasColumnType("text") + .HasColumnName("private_comment"); + + b.Property("PublicComment") + .HasColumnType("text") + .HasColumnName("public_comment"); + + b.Property("RejectMedia") + .HasColumnType("boolean") + .HasColumnName("reject_media"); + + b.Property("RejectReports") + .HasColumnType("boolean") + .HasColumnName("reject_reports"); + + b.Property("Severity") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("severity") + .HasDefaultValueSql("0"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("domain_blocks_pkey"); + + b.HasIndex("Domain") + .IsUnique() + .HasDatabaseName("index_domain_blocks_on_domain"); + + b.ToTable("domain_blocks", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.EmailDomainBlock", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Domain") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("domain") + .HasDefaultValueSql("''::character varying"); + + b.Property("ParentId") + .HasColumnType("bigint") + .HasColumnName("parent_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("email_domain_blocks_pkey"); + + b.HasIndex("Domain") + .IsUnique() + .HasDatabaseName("index_email_domain_blocks_on_domain"); + + b.HasIndex("ParentId") + .HasDatabaseName("ix_email_domain_blocks_parent_id"); + + b.ToTable("email_domain_blocks", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.EncryptedMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id") + .HasDefaultValueSql("timestamp_id('encrypted_messages'::text)"); + + b.Property("Body") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("body") + .HasDefaultValueSql("''::text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("DeviceId") + .HasColumnType("bigint") + .HasColumnName("device_id"); + + b.Property("Digest") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("digest") + .HasDefaultValueSql("''::text"); + + b.Property("FromAccountId") + .HasColumnType("bigint") + .HasColumnName("from_account_id"); + + b.Property("FromDeviceId") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("from_device_id") + .HasDefaultValueSql("''::character varying"); + + b.Property("MessageFranking") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("message_franking") + .HasDefaultValueSql("''::text"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("encrypted_messages_pkey"); + + b.HasIndex("DeviceId") + .HasDatabaseName("index_encrypted_messages_on_device_id"); + + b.HasIndex("FromAccountId") + .HasDatabaseName("index_encrypted_messages_on_from_account_id"); + + b.ToTable("encrypted_messages", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Favourite", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("favourites_pkey"); + + b.HasIndex("StatusId") + .HasDatabaseName("index_favourites_on_status_id"); + + b.HasIndex("AccountId", "Id") + .HasDatabaseName("index_favourites_on_account_id_and_id"); + + b.HasIndex("AccountId", "StatusId") + .IsUnique() + .HasDatabaseName("index_favourites_on_account_id_and_status_id"); + + b.ToTable("favourites", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.FeaturedTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("LastStatusAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_status_at"); + + b.Property("Name") + .HasColumnType("character varying") + .HasColumnName("name"); + + b.Property("StatusesCount") + .HasColumnType("bigint") + .HasColumnName("statuses_count"); + + b.Property("TagId") + .HasColumnType("bigint") + .HasColumnName("tag_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("featured_tags_pkey"); + + b.HasIndex("TagId") + .HasDatabaseName("index_featured_tags_on_tag_id"); + + b.HasIndex("AccountId", "TagId") + .IsUnique() + .HasDatabaseName("index_featured_tags_on_account_id_and_tag_id"); + + b.ToTable("featured_tags", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Follow", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Languages") + .HasColumnType("character varying[]") + .HasColumnName("languages"); + + b.Property("Notify") + .HasColumnType("boolean") + .HasColumnName("notify"); + + b.Property("ShowReblogs") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("show_reblogs") + .HasDefaultValueSql("true"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .HasColumnType("character varying") + .HasColumnName("uri"); + + b.HasKey("Id") + .HasName("follows_pkey"); + + b.HasIndex("AccountId", "TargetAccountId") + .IsUnique() + .HasDatabaseName("index_follows_on_account_id_and_target_account_id"); + + b.HasIndex(new[] { "TargetAccountId" }, "index_follows_on_target_account_id") + .HasDatabaseName("ix_follows_target_account_id"); + + b.ToTable("follows", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.FollowRecommendation", b => + { + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Rank") + .HasColumnType("numeric") + .HasColumnName("rank"); + + b.Property("Reason") + .HasColumnType("text[]") + .HasColumnName("reason"); + + b.ToTable((string)null); + + b.ToView("follow_recommendations", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.FollowRecommendationSuppression", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("follow_recommendation_suppressions_pkey"); + + b.HasIndex("AccountId") + .IsUnique() + .HasDatabaseName("index_follow_recommendation_suppressions_on_account_id"); + + b.ToTable("follow_recommendation_suppressions", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.FollowRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Languages") + .HasColumnType("character varying[]") + .HasColumnName("languages"); + + b.Property("Notify") + .HasColumnType("boolean") + .HasColumnName("notify"); + + b.Property("ShowReblogs") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("show_reblogs") + .HasDefaultValueSql("true"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .HasColumnType("character varying") + .HasColumnName("uri"); + + b.HasKey("Id") + .HasName("follow_requests_pkey"); + + b.HasIndex("TargetAccountId") + .HasDatabaseName("ix_follow_requests_target_account_id"); + + b.HasIndex("AccountId", "TargetAccountId") + .IsUnique() + .HasDatabaseName("index_follow_requests_on_account_id_and_target_account_id"); + + b.ToTable("follow_requests", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Identity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Provider") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("provider") + .HasDefaultValueSql("''::character varying"); + + b.Property("Uid") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("uid") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("identities_pkey"); + + b.HasIndex("UserId") + .HasDatabaseName("index_identities_on_user_id"); + + b.ToTable("identities", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Import", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Approved") + .HasColumnType("boolean") + .HasColumnName("approved"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("DataContentType") + .HasColumnType("character varying") + .HasColumnName("data_content_type"); + + b.Property("DataFileName") + .HasColumnType("character varying") + .HasColumnName("data_file_name"); + + b.Property("DataFileSize") + .HasColumnType("integer") + .HasColumnName("data_file_size"); + + b.Property("DataUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("data_updated_at"); + + b.Property("Overwrite") + .HasColumnType("boolean") + .HasColumnName("overwrite"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("imports_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("ix_imports_account_id"); + + b.ToTable("imports", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Instance", b => + { + b.Property("AccountsCount") + .HasColumnType("bigint") + .HasColumnName("accounts_count"); + + b.Property("Domain") + .HasColumnType("character varying") + .HasColumnName("domain"); + + b.ToTable((string)null); + + b.ToView("instances", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Invite", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Autofollow") + .HasColumnType("boolean") + .HasColumnName("autofollow"); + + b.Property("Code") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("code") + .HasDefaultValueSql("''::character varying"); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("expires_at"); + + b.Property("MaxUses") + .HasColumnType("integer") + .HasColumnName("max_uses"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.Property("Uses") + .HasColumnType("integer") + .HasColumnName("uses"); + + b.HasKey("Id") + .HasName("invites_pkey"); + + b.HasIndex("Code") + .IsUnique() + .HasDatabaseName("index_invites_on_code"); + + b.HasIndex("UserId") + .HasDatabaseName("index_invites_on_user_id"); + + b.ToTable("invites", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.IpBlock", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Comment") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("comment") + .HasDefaultValueSql("''::text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("expires_at"); + + b.Property("Ip") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("inet") + .HasColumnName("ip") + .HasDefaultValueSql("'0.0.0.0'::inet"); + + b.Property("Severity") + .HasColumnType("integer") + .HasColumnName("severity"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("ip_blocks_pkey"); + + b.ToTable("ip_blocks", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.List", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("RepliesPolicy") + .HasColumnType("integer") + .HasColumnName("replies_policy"); + + b.Property("Title") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("title") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("lists_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_lists_on_account_id"); + + b.ToTable("lists", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ListAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("FollowId") + .HasColumnType("bigint") + .HasColumnName("follow_id"); + + b.Property("ListId") + .HasColumnType("bigint") + .HasColumnName("list_id"); + + b.HasKey("Id") + .HasName("list_accounts_pkey"); + + b.HasIndex("FollowId") + .HasDatabaseName("index_list_accounts_on_follow_id") + .HasFilter("(follow_id IS NOT NULL)"); + + b.HasIndex("AccountId", "ListId") + .IsUnique() + .HasDatabaseName("index_list_accounts_on_account_id_and_list_id"); + + b.HasIndex("ListId", "AccountId") + .HasDatabaseName("index_list_accounts_on_list_id_and_account_id"); + + b.ToTable("list_accounts", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.LoginActivity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AuthenticationMethod") + .HasColumnType("character varying") + .HasColumnName("authentication_method"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("FailureReason") + .HasColumnType("character varying") + .HasColumnName("failure_reason"); + + b.Property("Ip") + .HasColumnType("inet") + .HasColumnName("ip"); + + b.Property("Provider") + .HasColumnType("character varying") + .HasColumnName("provider"); + + b.Property("Success") + .HasColumnType("boolean") + .HasColumnName("success"); + + b.Property("UserAgent") + .HasColumnType("character varying") + .HasColumnName("user_agent"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("login_activities_pkey"); + + b.HasIndex("UserId") + .HasDatabaseName("index_login_activities_on_user_id"); + + b.ToTable("login_activities", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Marker", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("LastReadId") + .HasColumnType("bigint") + .HasColumnName("last_read_id"); + + b.Property("LockVersion") + .HasColumnType("integer") + .HasColumnName("lock_version"); + + b.Property("Timeline") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("timeline") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("markers_pkey"); + + b.HasIndex("UserId", "Timeline") + .IsUnique() + .HasDatabaseName("index_markers_on_user_id_and_timeline"); + + b.ToTable("markers", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.MediaAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id") + .HasDefaultValueSql("timestamp_id('media_attachments'::text)"); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Blurhash") + .HasColumnType("character varying") + .HasColumnName("blurhash"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("FileContentType") + .HasColumnType("character varying") + .HasColumnName("file_content_type"); + + b.Property("FileFileName") + .HasColumnType("character varying") + .HasColumnName("file_file_name"); + + b.Property("FileFileSize") + .HasColumnType("integer") + .HasColumnName("file_file_size"); + + b.Property("FileMeta") + .HasColumnType("json") + .HasColumnName("file_meta"); + + b.Property("FileStorageSchemaVersion") + .HasColumnType("integer") + .HasColumnName("file_storage_schema_version"); + + b.Property("FileUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("file_updated_at"); + + b.Property("Processing") + .HasColumnType("integer") + .HasColumnName("processing"); + + b.Property("RemoteUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("remote_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("ScheduledStatusId") + .HasColumnType("bigint") + .HasColumnName("scheduled_status_id"); + + b.Property("Shortcode") + .HasColumnType("character varying") + .HasColumnName("shortcode"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("ThumbnailContentType") + .HasColumnType("character varying") + .HasColumnName("thumbnail_content_type"); + + b.Property("ThumbnailFileName") + .HasColumnType("character varying") + .HasColumnName("thumbnail_file_name"); + + b.Property("ThumbnailFileSize") + .HasColumnType("integer") + .HasColumnName("thumbnail_file_size"); + + b.Property("ThumbnailRemoteUrl") + .HasColumnType("character varying") + .HasColumnName("thumbnail_remote_url"); + + b.Property("ThumbnailUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("thumbnail_updated_at"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("media_attachments_pkey"); + + b.HasIndex("ScheduledStatusId") + .HasDatabaseName("index_media_attachments_on_scheduled_status_id") + .HasFilter("(scheduled_status_id IS NOT NULL)"); + + b.HasIndex("Shortcode") + .IsUnique() + .HasDatabaseName("index_media_attachments_on_shortcode") + .HasFilter("(shortcode IS NOT NULL)"); + + NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex("Shortcode"), new[] { "text_pattern_ops" }); + + b.HasIndex("StatusId") + .HasDatabaseName("index_media_attachments_on_status_id"); + + b.HasIndex("AccountId", "StatusId") + .IsDescending(false, true) + .HasDatabaseName("index_media_attachments_on_account_id_and_status_id"); + + b.ToTable("media_attachments", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Mention", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Silent") + .HasColumnType("boolean") + .HasColumnName("silent"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("mentions_pkey"); + + b.HasIndex("StatusId") + .HasDatabaseName("index_mentions_on_status_id"); + + b.HasIndex("AccountId", "StatusId") + .IsUnique() + .HasDatabaseName("index_mentions_on_account_id_and_status_id"); + + b.ToTable("mentions", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Mute", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("expires_at"); + + b.Property("HideNotifications") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("hide_notifications") + .HasDefaultValueSql("true"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("mutes_pkey"); + + b.HasIndex("TargetAccountId") + .HasDatabaseName("index_mutes_on_target_account_id"); + + b.HasIndex("AccountId", "TargetAccountId") + .IsUnique() + .HasDatabaseName("index_mutes_on_account_id_and_target_account_id"); + + b.ToTable("mutes", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Notification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("ActivityId") + .HasColumnType("bigint") + .HasColumnName("activity_id"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("activity_type"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("FromAccountId") + .HasColumnType("bigint") + .HasColumnName("from_account_id"); + + b.Property("Type") + .HasColumnType("character varying") + .HasColumnName("type"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("notifications_pkey"); + + b.HasIndex("FromAccountId") + .HasDatabaseName("index_notifications_on_from_account_id"); + + b.HasIndex("ActivityId", "ActivityType") + .HasDatabaseName("index_notifications_on_activity_id_and_activity_type"); + + b.HasIndex("AccountId", "Id", "Type") + .IsDescending(false, true, false) + .HasDatabaseName("index_notifications_on_account_id_and_id_and_type"); + + b.ToTable("notifications", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OAuthAccessGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ApplicationId") + .HasColumnType("bigint") + .HasColumnName("application_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ExpiresIn") + .HasColumnType("integer") + .HasColumnName("expires_in"); + + b.Property("RedirectUri") + .IsRequired() + .HasColumnType("text") + .HasColumnName("redirect_uri"); + + b.Property("ResourceOwnerId") + .HasColumnType("bigint") + .HasColumnName("resource_owner_id"); + + b.Property("RevokedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("revoked_at"); + + b.Property("Scopes") + .HasColumnType("character varying") + .HasColumnName("scopes"); + + b.Property("Token") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("token"); + + b.HasKey("Id") + .HasName("oauth_access_grants_pkey"); + + b.HasIndex("ApplicationId") + .HasDatabaseName("ix_oauth_access_grants_application_id"); + + b.HasIndex("ResourceOwnerId") + .HasDatabaseName("index_oauth_access_grants_on_resource_owner_id"); + + b.HasIndex("Token") + .IsUnique() + .HasDatabaseName("index_oauth_access_grants_on_token"); + + b.ToTable("oauth_access_grants", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OAuthAccessToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ApplicationId") + .HasColumnType("bigint") + .HasColumnName("application_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ExpiresIn") + .HasColumnType("integer") + .HasColumnName("expires_in"); + + b.Property("LastUsedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_used_at"); + + b.Property("LastUsedIp") + .HasColumnType("inet") + .HasColumnName("last_used_ip"); + + b.Property("RefreshToken") + .HasColumnType("character varying") + .HasColumnName("refresh_token"); + + b.Property("ResourceOwnerId") + .HasColumnType("bigint") + .HasColumnName("resource_owner_id"); + + b.Property("RevokedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("revoked_at"); + + b.Property("Scopes") + .HasColumnType("character varying") + .HasColumnName("scopes"); + + b.Property("Token") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("token"); + + b.HasKey("Id") + .HasName("oauth_access_tokens_pkey"); + + b.HasIndex("ApplicationId") + .HasDatabaseName("ix_oauth_access_tokens_application_id"); + + b.HasIndex("RefreshToken") + .IsUnique() + .HasDatabaseName("index_oauth_access_tokens_on_refresh_token") + .HasFilter("(refresh_token IS NOT NULL)"); + + NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex("RefreshToken"), new[] { "text_pattern_ops" }); + + b.HasIndex("ResourceOwnerId") + .HasDatabaseName("index_oauth_access_tokens_on_resource_owner_id") + .HasFilter("(resource_owner_id IS NOT NULL)"); + + b.HasIndex("Token") + .IsUnique() + .HasDatabaseName("index_oauth_access_tokens_on_token"); + + b.ToTable("oauth_access_tokens", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OAuthApplication", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Confidential") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("confidential") + .HasDefaultValueSql("true"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Name") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("name"); + + b.Property("OwnerId") + .HasColumnType("bigint") + .HasColumnName("owner_id"); + + b.Property("OwnerType") + .HasColumnType("character varying") + .HasColumnName("owner_type"); + + b.Property("RedirectUri") + .IsRequired() + .HasColumnType("text") + .HasColumnName("redirect_uri"); + + b.Property("Scopes") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("scopes") + .HasDefaultValueSql("''::character varying"); + + b.Property("Secret") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("secret"); + + b.Property("Superapp") + .HasColumnType("boolean") + .HasColumnName("superapp"); + + b.Property("Uid") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("uid"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Website") + .HasColumnType("character varying") + .HasColumnName("website"); + + b.HasKey("Id") + .HasName("oauth_applications_pkey"); + + b.HasIndex("Uid") + .IsUnique() + .HasDatabaseName("index_oauth_applications_on_uid"); + + b.HasIndex("OwnerId", "OwnerType") + .HasDatabaseName("index_oauth_applications_on_owner_id_and_owner_type"); + + b.ToTable("oauth_applications", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OneTimeKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("DeviceId") + .HasColumnType("bigint") + .HasColumnName("device_id"); + + b.Property("Key") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("key") + .HasDefaultValueSql("''::text"); + + b.Property("KeyId") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("key_id") + .HasDefaultValueSql("''::character varying"); + + b.Property("Signature") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("signature") + .HasDefaultValueSql("''::text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("one_time_keys_pkey"); + + b.HasIndex("DeviceId") + .HasDatabaseName("index_one_time_keys_on_device_id"); + + b.HasIndex("KeyId") + .HasDatabaseName("index_one_time_keys_on_key_id"); + + b.ToTable("one_time_keys", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.PgheroSpaceStat", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CapturedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("captured_at"); + + b.Property("Database") + .HasColumnType("text") + .HasColumnName("database"); + + b.Property("Relation") + .HasColumnType("text") + .HasColumnName("relation"); + + b.Property("Schema") + .HasColumnType("text") + .HasColumnName("schema"); + + b.Property("Size") + .HasColumnType("bigint") + .HasColumnName("size"); + + b.HasKey("Id") + .HasName("pghero_space_stats_pkey"); + + b.HasIndex("Database", "CapturedAt") + .HasDatabaseName("index_pghero_space_stats_on_database_and_captured_at"); + + b.ToTable("pghero_space_stats", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Poll", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CachedTallies") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("bigint[]") + .HasColumnName("cached_tallies") + .HasDefaultValueSql("'{}'::bigint[]"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("expires_at"); + + b.Property("HideTotals") + .HasColumnType("boolean") + .HasColumnName("hide_totals"); + + b.Property("LastFetchedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_fetched_at"); + + b.Property("LockVersion") + .HasColumnType("integer") + .HasColumnName("lock_version"); + + b.Property("Multiple") + .HasColumnType("boolean") + .HasColumnName("multiple"); + + b.Property("Options") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying[]") + .HasColumnName("options") + .HasDefaultValueSql("'{}'::character varying[]"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("VotersCount") + .HasColumnType("bigint") + .HasColumnName("voters_count"); + + b.Property("VotesCount") + .HasColumnType("bigint") + .HasColumnName("votes_count"); + + b.HasKey("Id") + .HasName("polls_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_polls_on_account_id"); + + b.HasIndex("StatusId") + .HasDatabaseName("index_polls_on_status_id"); + + b.ToTable("polls", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.PollVote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Choice") + .HasColumnType("integer") + .HasColumnName("choice"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("PollId") + .HasColumnType("bigint") + .HasColumnName("poll_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .HasColumnType("character varying") + .HasColumnName("uri"); + + b.HasKey("Id") + .HasName("poll_votes_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_poll_votes_on_account_id"); + + b.HasIndex("PollId") + .HasDatabaseName("index_poll_votes_on_poll_id"); + + b.ToTable("poll_votes", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.PreviewCard", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AuthorName") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("author_name") + .HasDefaultValueSql("''::character varying"); + + b.Property("AuthorUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("author_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("Blurhash") + .HasColumnType("character varying") + .HasColumnName("blurhash"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Description") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("description") + .HasDefaultValueSql("''::character varying"); + + b.Property("EmbedUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("embed_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("Height") + .HasColumnType("integer") + .HasColumnName("height"); + + b.Property("Html") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("html") + .HasDefaultValueSql("''::text"); + + b.Property("ImageContentType") + .HasColumnType("character varying") + .HasColumnName("image_content_type"); + + b.Property("ImageFileName") + .HasColumnType("character varying") + .HasColumnName("image_file_name"); + + b.Property("ImageFileSize") + .HasColumnType("integer") + .HasColumnName("image_file_size"); + + b.Property("ImageStorageSchemaVersion") + .HasColumnType("integer") + .HasColumnName("image_storage_schema_version"); + + b.Property("ImageUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("image_updated_at"); + + b.Property("Language") + .HasColumnType("character varying") + .HasColumnName("language"); + + b.Property("LinkType") + .HasColumnType("integer") + .HasColumnName("link_type"); + + b.Property("MaxScore") + .HasColumnType("double precision") + .HasColumnName("max_score"); + + b.Property("MaxScoreAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("max_score_at"); + + b.Property("ProviderName") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("provider_name") + .HasDefaultValueSql("''::character varying"); + + b.Property("ProviderUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("provider_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("Title") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("title") + .HasDefaultValueSql("''::character varying"); + + b.Property("Trendable") + .HasColumnType("boolean") + .HasColumnName("trendable"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Url") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("url") + .HasDefaultValueSql("''::character varying"); + + b.Property("Width") + .HasColumnType("integer") + .HasColumnName("width"); + + b.HasKey("Id") + .HasName("preview_cards_pkey"); + + b.HasIndex("Url") + .IsUnique() + .HasDatabaseName("index_preview_cards_on_url"); + + b.ToTable("preview_cards", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.PreviewCardProvider", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("Domain") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("domain") + .HasDefaultValueSql("''::character varying"); + + b.Property("IconContentType") + .HasColumnType("character varying") + .HasColumnName("icon_content_type"); + + b.Property("IconFileName") + .HasColumnType("character varying") + .HasColumnName("icon_file_name"); + + b.Property("IconFileSize") + .HasColumnType("bigint") + .HasColumnName("icon_file_size"); + + b.Property("IconUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("icon_updated_at"); + + b.Property("RequestedReviewAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("requested_review_at"); + + b.Property("ReviewedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("reviewed_at"); + + b.Property("Trendable") + .HasColumnType("boolean") + .HasColumnName("trendable"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("preview_card_providers_pkey"); + + b.HasIndex("Domain") + .IsUnique() + .HasDatabaseName("index_preview_card_providers_on_domain"); + + b.ToTable("preview_card_providers", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.PreviewCardStatus", b => + { + b.Property("PreviewCardId") + .HasColumnType("bigint") + .HasColumnName("preview_card_id"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.HasIndex("StatusId", "PreviewCardId") + .HasDatabaseName("index_preview_cards_statuses_on_status_id_and_preview_card_id"); + + b.ToTable("preview_cards_statuses", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.PreviewCardTrend", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Allowed") + .HasColumnType("boolean") + .HasColumnName("allowed"); + + b.Property("Language") + .HasColumnType("character varying") + .HasColumnName("language"); + + b.Property("PreviewCardId") + .HasColumnType("bigint") + .HasColumnName("preview_card_id"); + + b.Property("Rank") + .HasColumnType("integer") + .HasColumnName("rank"); + + b.Property("Score") + .HasColumnType("double precision") + .HasColumnName("score"); + + b.HasKey("Id") + .HasName("preview_card_trends_pkey"); + + b.HasIndex("PreviewCardId") + .IsUnique() + .HasDatabaseName("index_preview_card_trends_on_preview_card_id"); + + b.ToTable("preview_card_trends", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Relay", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("FollowActivityId") + .HasColumnType("character varying") + .HasColumnName("follow_activity_id"); + + b.Property("InboxUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("inbox_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("State") + .HasColumnType("integer") + .HasColumnName("state"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("relays_pkey"); + + b.ToTable("relays", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Report", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("ActionTakenAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("action_taken_at"); + + b.Property("ActionTakenByAccountId") + .HasColumnType("bigint") + .HasColumnName("action_taken_by_account_id"); + + b.Property("AssignedAccountId") + .HasColumnType("bigint") + .HasColumnName("assigned_account_id"); + + b.Property("Category") + .HasColumnType("integer") + .HasColumnName("category"); + + b.Property("Comment") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("comment") + .HasDefaultValueSql("''::text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Forwarded") + .HasColumnType("boolean") + .HasColumnName("forwarded"); + + b.Property("RuleIds") + .HasColumnType("bigint[]") + .HasColumnName("rule_ids"); + + b.Property("StatusIds") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("bigint[]") + .HasColumnName("status_ids") + .HasDefaultValueSql("'{}'::bigint[]"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .HasColumnType("character varying") + .HasColumnName("uri"); + + b.HasKey("Id") + .HasName("reports_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_reports_on_account_id"); + + b.HasIndex("ActionTakenByAccountId") + .HasDatabaseName("index_reports_on_action_taken_by_account_id") + .HasFilter("(action_taken_by_account_id IS NOT NULL)"); + + b.HasIndex("AssignedAccountId") + .HasDatabaseName("index_reports_on_assigned_account_id") + .HasFilter("(assigned_account_id IS NOT NULL)"); + + b.HasIndex("TargetAccountId") + .HasDatabaseName("index_reports_on_target_account_id"); + + b.ToTable("reports", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ReportNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Content") + .IsRequired() + .HasColumnType("text") + .HasColumnName("content"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ReportId") + .HasColumnType("bigint") + .HasColumnName("report_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("report_notes_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_report_notes_on_account_id"); + + b.HasIndex("ReportId") + .HasDatabaseName("index_report_notes_on_report_id"); + + b.ToTable("report_notes", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Rule", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("DeletedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("deleted_at"); + + b.Property("Priority") + .HasColumnType("integer") + .HasColumnName("priority"); + + b.Property("Text") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("rules_pkey"); + + b.ToTable("rules", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ScheduledStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Params") + .HasColumnType("jsonb") + .HasColumnName("params"); + + b.Property("ScheduledAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("scheduled_at"); + + b.HasKey("Id") + .HasName("scheduled_statuses_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_scheduled_statuses_on_account_id"); + + b.HasIndex("ScheduledAt") + .HasDatabaseName("index_scheduled_statuses_on_scheduled_at"); + + b.ToTable("scheduled_statuses", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.SessionActivation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccessTokenId") + .HasColumnType("bigint") + .HasColumnName("access_token_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Ip") + .HasColumnType("inet") + .HasColumnName("ip"); + + b.Property("SessionId") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("session_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("UserAgent") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("user_agent") + .HasDefaultValueSql("''::character varying"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.Property("WebPushSubscriptionId") + .HasColumnType("bigint") + .HasColumnName("web_push_subscription_id"); + + b.HasKey("Id") + .HasName("session_activations_pkey"); + + b.HasIndex("AccessTokenId") + .HasDatabaseName("index_session_activations_on_access_token_id"); + + b.HasIndex("SessionId") + .IsUnique() + .HasDatabaseName("index_session_activations_on_session_id"); + + b.HasIndex("UserId") + .HasDatabaseName("index_session_activations_on_user_id"); + + b.ToTable("session_activations", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ThingId") + .HasColumnType("bigint") + .HasColumnName("thing_id"); + + b.Property("ThingType") + .HasColumnType("character varying") + .HasColumnName("thing_type"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Value") + .HasColumnType("text") + .HasColumnName("value"); + + b.Property("Var") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("var"); + + b.HasKey("Id") + .HasName("settings_pkey"); + + b.HasIndex("ThingType", "ThingId", "Var") + .IsUnique() + .HasDatabaseName("index_settings_on_thing_type_and_thing_id_and_var"); + + b.ToTable("settings", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.SiteUpload", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Blurhash") + .HasColumnType("character varying") + .HasColumnName("blurhash"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("FileContentType") + .HasColumnType("character varying") + .HasColumnName("file_content_type"); + + b.Property("FileFileName") + .HasColumnType("character varying") + .HasColumnName("file_file_name"); + + b.Property("FileFileSize") + .HasColumnType("integer") + .HasColumnName("file_file_size"); + + b.Property("FileUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("file_updated_at"); + + b.Property("Meta") + .HasColumnType("json") + .HasColumnName("meta"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Var") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("var") + .HasDefaultValueSql("''::character varying"); + + b.HasKey("Id") + .HasName("site_uploads_pkey"); + + b.HasIndex("Var") + .IsUnique() + .HasDatabaseName("index_site_uploads_on_var"); + + b.ToTable("site_uploads", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Status", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id") + .HasDefaultValueSql("timestamp_id('statuses'::text)"); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("ApplicationId") + .HasColumnType("bigint") + .HasColumnName("application_id"); + + b.Property("ConversationId") + .HasColumnType("bigint") + .HasColumnName("conversation_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("DeletedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("deleted_at"); + + b.Property("EditedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("edited_at"); + + b.Property("InReplyToAccountId") + .HasColumnType("bigint") + .HasColumnName("in_reply_to_account_id"); + + b.Property("InReplyToId") + .HasColumnType("bigint") + .HasColumnName("in_reply_to_id"); + + b.Property("Language") + .HasColumnType("character varying") + .HasColumnName("language"); + + b.Property("Local") + .HasColumnType("boolean") + .HasColumnName("local"); + + b.Property("OrderedMediaAttachmentIds") + .HasColumnType("bigint[]") + .HasColumnName("ordered_media_attachment_ids"); + + b.Property("PollId") + .HasColumnType("bigint") + .HasColumnName("poll_id"); + + b.Property("ReblogOfId") + .HasColumnType("bigint") + .HasColumnName("reblog_of_id"); + + b.Property("Reply") + .HasColumnType("boolean") + .HasColumnName("reply"); + + b.Property("Sensitive") + .HasColumnType("boolean") + .HasColumnName("sensitive"); + + b.Property("SpoilerText") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("spoiler_text") + .HasDefaultValueSql("''::text"); + + b.Property("Text") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + b.Property("Trendable") + .HasColumnType("boolean") + .HasColumnName("trendable"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .HasColumnType("character varying") + .HasColumnName("uri"); + + b.Property("Url") + .HasColumnType("character varying") + .HasColumnName("url"); + + b.Property("Visibility") + .HasColumnType("integer") + .HasColumnName("visibility"); + + b.HasKey("Id") + .HasName("statuses_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_statuses_on_account_id"); + + b.HasIndex("DeletedAt") + .HasDatabaseName("index_statuses_on_deleted_at") + .HasFilter("(deleted_at IS NOT NULL)"); + + b.HasIndex("InReplyToAccountId") + .HasDatabaseName("index_statuses_on_in_reply_to_account_id") + .HasFilter("(in_reply_to_account_id IS NOT NULL)"); + + b.HasIndex("InReplyToId") + .HasDatabaseName("index_statuses_on_in_reply_to_id") + .HasFilter("(in_reply_to_id IS NOT NULL)"); + + b.HasIndex("Uri") + .IsUnique() + .HasDatabaseName("index_statuses_on_uri") + .HasFilter("(uri IS NOT NULL)"); + + NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex("Uri"), new[] { "text_pattern_ops" }); + + b.HasIndex("Id", "AccountId") + .IsDescending(true, false) + .HasDatabaseName("index_statuses_public_20200119") + .HasFilter("((deleted_at IS NULL) AND (visibility = 0) AND (reblog_of_id IS NULL) AND ((NOT reply) OR (in_reply_to_account_id = account_id)))"); + + b.HasIndex("ReblogOfId", "AccountId") + .HasDatabaseName("index_statuses_on_reblog_of_id_and_account_id"); + + b.HasIndex("AccountId", "Id", "Visibility", "UpdatedAt") + .IsDescending(false, true, false, false) + .HasDatabaseName("index_statuses_20190820") + .HasFilter("(deleted_at IS NULL)"); + + b.ToTable("statuses", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusEdit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("MediaDescriptions") + .HasColumnType("text[]") + .HasColumnName("media_descriptions"); + + b.Property("OrderedMediaAttachmentIds") + .HasColumnType("bigint[]") + .HasColumnName("ordered_media_attachment_ids"); + + b.Property("PollOptions") + .HasColumnType("character varying[]") + .HasColumnName("poll_options"); + + b.Property("Sensitive") + .HasColumnType("boolean") + .HasColumnName("sensitive"); + + b.Property("SpoilerText") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("spoiler_text") + .HasDefaultValueSql("''::text"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("Text") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("status_edits_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_status_edits_on_account_id"); + + b.HasIndex("StatusId") + .HasDatabaseName("index_status_edits_on_status_id"); + + b.ToTable("status_edits", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusPin", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at") + .HasDefaultValueSql("now()"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at") + .HasDefaultValueSql("now()"); + + b.HasKey("Id") + .HasName("status_pins_pkey"); + + b.HasIndex("StatusId") + .HasDatabaseName("index_status_pins_on_status_id"); + + b.HasIndex("AccountId", "StatusId") + .IsUnique() + .HasDatabaseName("index_status_pins_on_account_id_and_status_id"); + + b.ToTable("status_pins", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusStat", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("FavouritesCount") + .HasColumnType("bigint") + .HasColumnName("favourites_count"); + + b.Property("ReblogsCount") + .HasColumnType("bigint") + .HasColumnName("reblogs_count"); + + b.Property("RepliesCount") + .HasColumnType("bigint") + .HasColumnName("replies_count"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("status_stats_pkey"); + + b.HasIndex("StatusId") + .IsUnique() + .HasDatabaseName("index_status_stats_on_status_id"); + + b.ToTable("status_stats", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusTag", b => + { + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("TagId") + .HasColumnType("bigint") + .HasColumnName("tag_id"); + + b.HasIndex("StatusId") + .HasDatabaseName("index_statuses_tags_on_status_id"); + + b.HasIndex("TagId", "StatusId") + .IsUnique() + .HasDatabaseName("index_statuses_tags_on_tag_id_and_status_id"); + + b.ToTable("statuses_tags", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusTrend", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Allowed") + .HasColumnType("boolean") + .HasColumnName("allowed"); + + b.Property("Language") + .HasColumnType("character varying") + .HasColumnName("language"); + + b.Property("Rank") + .HasColumnType("integer") + .HasColumnName("rank"); + + b.Property("Score") + .HasColumnType("double precision") + .HasColumnName("score"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.HasKey("Id") + .HasName("status_trends_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_status_trends_on_account_id"); + + b.HasIndex("StatusId") + .IsUnique() + .HasDatabaseName("index_status_trends_on_status_id"); + + b.ToTable("status_trends", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.SystemKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Key") + .HasColumnType("bytea") + .HasColumnName("key"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("system_keys_pkey"); + + b.ToTable("system_keys", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("DisplayName") + .HasColumnType("character varying") + .HasColumnName("display_name"); + + b.Property("LastStatusAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_status_at"); + + b.Property("Listable") + .HasColumnType("boolean") + .HasColumnName("listable"); + + b.Property("MaxScore") + .HasColumnType("double precision") + .HasColumnName("max_score"); + + b.Property("MaxScoreAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("max_score_at"); + + b.Property("Name") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("name") + .HasDefaultValueSql("''::character varying"); + + b.Property("RequestedReviewAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("requested_review_at"); + + b.Property("ReviewedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("reviewed_at"); + + b.Property("Trendable") + .HasColumnType("boolean") + .HasColumnName("trendable"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Usable") + .HasColumnType("boolean") + .HasColumnName("usable"); + + b.HasKey("Id") + .HasName("tags_pkey"); + + b.ToTable("tags", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.TagFollow", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("TagId") + .HasColumnType("bigint") + .HasColumnName("tag_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("tag_follows_pkey"); + + b.HasIndex("TagId") + .HasDatabaseName("index_tag_follows_on_tag_id"); + + b.HasIndex("AccountId", "TagId") + .IsUnique() + .HasDatabaseName("index_tag_follows_on_account_id_and_tag_id"); + + b.ToTable("tag_follows", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Tombstone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("ByModerator") + .HasColumnType("boolean") + .HasColumnName("by_moderator"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("uri"); + + b.HasKey("Id") + .HasName("tombstones_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_tombstones_on_account_id"); + + b.HasIndex("Uri") + .HasDatabaseName("index_tombstones_on_uri"); + + b.ToTable("tombstones", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.UnavailableDomain", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Domain") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("domain") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("unavailable_domains_pkey"); + + b.HasIndex("Domain") + .IsUnique() + .HasDatabaseName("index_unavailable_domains_on_domain"); + + b.ToTable("unavailable_domains", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Admin") + .HasColumnType("boolean") + .HasColumnName("admin"); + + b.Property("Approved") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("approved") + .HasDefaultValueSql("true"); + + b.Property("ChosenLanguages") + .HasColumnType("character varying[]") + .HasColumnName("chosen_languages"); + + b.Property("ConfirmationSentAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("confirmation_sent_at"); + + b.Property("ConfirmationToken") + .HasColumnType("character varying") + .HasColumnName("confirmation_token"); + + b.Property("ConfirmedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("confirmed_at"); + + b.Property("ConsumedTimestep") + .HasColumnType("integer") + .HasColumnName("consumed_timestep"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("CreatedByApplicationId") + .HasColumnType("bigint") + .HasColumnName("created_by_application_id"); + + b.Property("CurrentSignInAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("current_sign_in_at"); + + b.Property("Disabled") + .HasColumnType("boolean") + .HasColumnName("disabled"); + + b.Property("Email") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("email") + .HasDefaultValueSql("''::character varying"); + + b.Property("EncryptedOtpSecret") + .HasColumnType("character varying") + .HasColumnName("encrypted_otp_secret"); + + b.Property("EncryptedOtpSecretIv") + .HasColumnType("character varying") + .HasColumnName("encrypted_otp_secret_iv"); + + b.Property("EncryptedOtpSecretSalt") + .HasColumnType("character varying") + .HasColumnName("encrypted_otp_secret_salt"); + + b.Property("EncryptedPassword") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("encrypted_password") + .HasDefaultValueSql("''::character varying"); + + b.Property("InviteId") + .HasColumnType("bigint") + .HasColumnName("invite_id"); + + b.Property("LastEmailedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_emailed_at"); + + b.Property("LastSignInAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_sign_in_at"); + + b.Property("Locale") + .HasColumnType("character varying") + .HasColumnName("locale"); + + b.Property("Moderator") + .HasColumnType("boolean") + .HasColumnName("moderator"); + + b.Property("OtpBackupCodes") + .HasColumnType("character varying[]") + .HasColumnName("otp_backup_codes"); + + b.Property("OtpRequiredForLogin") + .HasColumnType("boolean") + .HasColumnName("otp_required_for_login"); + + b.Property("ResetPasswordSentAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("reset_password_sent_at"); + + b.Property("ResetPasswordToken") + .HasColumnType("character varying") + .HasColumnName("reset_password_token"); + + b.Property("RoleId") + .HasColumnType("bigint") + .HasColumnName("role_id"); + + b.Property("SignInCount") + .HasColumnType("integer") + .HasColumnName("sign_in_count"); + + b.Property("SignInToken") + .HasColumnType("character varying") + .HasColumnName("sign_in_token"); + + b.Property("SignInTokenSentAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("sign_in_token_sent_at"); + + b.Property("SignUpIp") + .HasColumnType("inet") + .HasColumnName("sign_up_ip"); + + b.Property("SkipSignInToken") + .HasColumnType("boolean") + .HasColumnName("skip_sign_in_token"); + + b.Property("UnconfirmedEmail") + .HasColumnType("character varying") + .HasColumnName("unconfirmed_email"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("WebAuthnId") + .HasColumnType("character varying") + .HasColumnName("webauthn_id"); + + b.HasKey("Id") + .HasName("users_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_users_on_account_id"); + + b.HasIndex("ConfirmationToken") + .IsUnique() + .HasDatabaseName("index_users_on_confirmation_token"); + + b.HasIndex("CreatedByApplicationId") + .HasDatabaseName("index_users_on_created_by_application_id") + .HasFilter("(created_by_application_id IS NOT NULL)"); + + b.HasIndex("Email") + .IsUnique() + .HasDatabaseName("index_users_on_email"); + + b.HasIndex("InviteId") + .HasDatabaseName("ix_users_invite_id"); + + b.HasIndex("ResetPasswordToken") + .IsUnique() + .HasDatabaseName("index_users_on_reset_password_token") + .HasFilter("(reset_password_token IS NOT NULL)"); + + NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex("ResetPasswordToken"), new[] { "text_pattern_ops" }); + + b.HasIndex("RoleId") + .HasDatabaseName("index_users_on_role_id") + .HasFilter("(role_id IS NOT NULL)"); + + b.ToTable("users", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.UserInviteRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Text") + .HasColumnType("text") + .HasColumnName("text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("user_invite_requests_pkey"); + + b.HasIndex("UserId") + .HasDatabaseName("index_user_invite_requests_on_user_id"); + + b.ToTable("user_invite_requests", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.UserIp", b => + { + b.Property("Ip") + .HasColumnType("inet") + .HasColumnName("ip"); + + b.Property("UsedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("used_at"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.ToTable((string)null); + + b.ToView("user_ips", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Color") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("color") + .HasDefaultValueSql("''::character varying"); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("Highlighted") + .HasColumnType("boolean") + .HasColumnName("highlighted"); + + b.Property("Name") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("name") + .HasDefaultValueSql("''::character varying"); + + b.Property("Permissions") + .HasColumnType("bigint") + .HasColumnName("permissions"); + + b.Property("Position") + .HasColumnType("integer") + .HasColumnName("position"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("user_roles_pkey"); + + b.ToTable("user_roles", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.WebAuthnCredential", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ExternalId") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("external_id"); + + b.Property("Nickname") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("nickname"); + + b.Property("PublicKey") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("public_key"); + + b.Property("SignCount") + .HasColumnType("bigint") + .HasColumnName("sign_count"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("webauthn_credentials_pkey"); + + b.HasIndex("ExternalId") + .IsUnique() + .HasDatabaseName("index_webauthn_credentials_on_external_id"); + + b.HasIndex("UserId") + .HasDatabaseName("index_webauthn_credentials_on_user_id"); + + b.ToTable("webauthn_credentials", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.WebPushSubscription", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccessTokenId") + .HasColumnType("bigint") + .HasColumnName("access_token_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Data") + .HasColumnType("json") + .HasColumnName("data"); + + b.Property("Endpoint") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("endpoint"); + + b.Property("KeyAuth") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("key_auth"); + + b.Property("KeyP256dh") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("key_p256dh"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("web_push_subscriptions_pkey"); + + b.HasIndex("AccessTokenId") + .HasDatabaseName("index_web_push_subscriptions_on_access_token_id") + .HasFilter("(access_token_id IS NOT NULL)"); + + b.HasIndex("UserId") + .HasDatabaseName("index_web_push_subscriptions_on_user_id"); + + b.ToTable("web_push_subscriptions", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.WebSetting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Data") + .HasColumnType("json") + .HasColumnName("data"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("web_settings_pkey"); + + b.HasIndex("UserId") + .IsUnique() + .HasDatabaseName("index_web_settings_on_user_id"); + + b.ToTable("web_settings", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Webhook", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("Enabled") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("enabled") + .HasDefaultValueSql("true"); + + b.Property("Events") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying[]") + .HasColumnName("events") + .HasDefaultValueSql("'{}'::character varying[]"); + + b.Property("Secret") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("secret") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.Property("Url") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("url"); + + b.HasKey("Id") + .HasName("webhooks_pkey"); + + b.HasIndex("Url") + .IsUnique() + .HasDatabaseName("index_webhooks_on_url"); + + b.ToTable("webhooks", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Account", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "MovedToAccount") + .WithMany("InverseMovedToAccount") + .HasForeignKey("MovedToAccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_2320833084"); + + b.Navigation("MovedToAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountAlias", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountAliases") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_fc91575d08"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountConversation", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountConversations") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_6f5278b6e9"); + + b.HasOne("Smilodon.Domain.Models.Conversation", "Conversation") + .WithMany("AccountConversations") + .HasForeignKey("ConversationId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_1491654f9f"); + + b.Navigation("Account"); + + b.Navigation("Conversation"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountDeletionRequest", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountDeletionRequests") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_45bf2626b9"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountDomainBlock", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountDomainBlocks") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_206c6029bd"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountMigration", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountMigrationAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_c9f701caaf"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("AccountMigrationTargetAccounts") + .HasForeignKey("TargetAccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_d9a8dad070"); + + b.Navigation("Account"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountModerationNote", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountModerationNoteAccounts") + .HasForeignKey("AccountId") + .IsRequired() + .HasConstraintName("fk_rails_3f8b75089b"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("AccountModerationNoteTargetAccounts") + .HasForeignKey("TargetAccountId") + .IsRequired() + .HasConstraintName("fk_rails_dd62ed5ac3"); + + b.Navigation("Account"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountNote", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountNoteAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_4ee4503c69"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("AccountNoteTargetAccounts") + .HasForeignKey("TargetAccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_2801b48f1a"); + + b.Navigation("Account"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountPin", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountPinAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_d44979e5dd"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("AccountPinTargetAccounts") + .HasForeignKey("TargetAccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a176e26c37"); + + b.Navigation("Account"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountStat", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithOne("AccountStat") + .HasForeignKey("Smilodon.Domain.Models.AccountStat", "AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_215bb31ff1"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountStatusesCleanupPolicy", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountStatusesCleanupPolicies") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_23d5f73cfe"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountWarning", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountWarningAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_a65a1bf71b"); + + b.HasOne("Smilodon.Domain.Models.Report", "Report") + .WithMany("AccountWarnings") + .HasForeignKey("ReportId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_8f2bab4b16"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("AccountWarningTargetAccounts") + .HasForeignKey("TargetAccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a7ebbb1e37"); + + b.Navigation("Account"); + + b.Navigation("Report"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AdminActionLog", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AdminActionLogs") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a7667297fa"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AnnouncementMute", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AnnouncementMutes") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_9c99f8e835"); + + b.HasOne("Smilodon.Domain.Models.Announcement", "Announcement") + .WithMany("AnnouncementMutes") + .HasForeignKey("AnnouncementId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_e35401adf1"); + + b.Navigation("Account"); + + b.Navigation("Announcement"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AnnouncementReaction", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AnnouncementReactions") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_7444ad831f"); + + b.HasOne("Smilodon.Domain.Models.Announcement", "Announcement") + .WithMany("AnnouncementReactions") + .HasForeignKey("AnnouncementId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a1226eaa5c"); + + b.HasOne("Smilodon.Domain.Models.CustomEmoji", "CustomEmoji") + .WithMany("AnnouncementReactions") + .HasForeignKey("CustomEmojiId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_b742c91c0e"); + + b.Navigation("Account"); + + b.Navigation("Announcement"); + + b.Navigation("CustomEmoji"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Appeal", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AppealAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_ea84881569"); + + b.HasOne("Smilodon.Domain.Models.AccountWarning", "AccountWarning") + .WithOne("Appeal") + .HasForeignKey("Smilodon.Domain.Models.Appeal", "AccountWarningId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_a99f14546e"); + + b.HasOne("Smilodon.Domain.Models.Account", "ApprovedByAccount") + .WithMany("AppealApprovedByAccounts") + .HasForeignKey("ApprovedByAccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_9deb2f63ad"); + + b.HasOne("Smilodon.Domain.Models.Account", "RejectedByAccount") + .WithMany("AppealRejectedByAccounts") + .HasForeignKey("RejectedByAccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_501c3a6e13"); + + b.Navigation("Account"); + + b.Navigation("AccountWarning"); + + b.Navigation("ApprovedByAccount"); + + b.Navigation("RejectedByAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Backup", b => + { + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithMany("Backups") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_096669d221"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Block", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("BlockAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_4269e03e65"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("BlockTargetAccounts") + .HasForeignKey("TargetAccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_9571bfabc1"); + + b.Navigation("Account"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Bookmark", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("Bookmarks") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_9f6ac182a6"); + + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithMany("Bookmarks") + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_11207ffcfd"); + + b.Navigation("Account"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CanonicalEmailBlock", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "ReferenceAccount") + .WithMany("CanonicalEmailBlocks") + .HasForeignKey("ReferenceAccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_1ecb262096"); + + b.Navigation("ReferenceAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ConversationMute", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("ConversationMutes") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_225b4212bb"); + + b.HasOne("Smilodon.Domain.Models.Conversation", "Conversation") + .WithMany("ConversationMutes") + .HasForeignKey("ConversationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_5ab139311f"); + + b.Navigation("Account"); + + b.Navigation("Conversation"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomFilter", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("CustomFilters") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_8b8d786993"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomFilterKeyword", b => + { + b.HasOne("Smilodon.Domain.Models.CustomFilter", "CustomFilter") + .WithMany("CustomFilterKeywords") + .HasForeignKey("CustomFilterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_5a49a74012"); + + b.Navigation("CustomFilter"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomFilterStatus", b => + { + b.HasOne("Smilodon.Domain.Models.CustomFilter", "CustomFilter") + .WithMany("CustomFilterStatuses") + .HasForeignKey("CustomFilterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_e2ddaf5b14"); + + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithMany("CustomFilterStatuses") + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_2f6d20c0cf"); + + b.Navigation("CustomFilter"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Device", b => + { + b.HasOne("Smilodon.Domain.Models.OAuthAccessToken", "AccessToken") + .WithMany("Devices") + .HasForeignKey("AccessTokenId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_393f74df68"); + + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("Devices") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a796b75798"); + + b.Navigation("AccessToken"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.EmailDomainBlock", b => + { + b.HasOne("Smilodon.Domain.Models.EmailDomainBlock", "Parent") + .WithMany("InverseParent") + .HasForeignKey("ParentId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_408efe0a15"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.EncryptedMessage", b => + { + b.HasOne("Smilodon.Domain.Models.Device", "Device") + .WithMany("EncryptedMessages") + .HasForeignKey("DeviceId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a83e4df7ae"); + + b.HasOne("Smilodon.Domain.Models.Account", "FromAccount") + .WithMany("EncryptedMessages") + .HasForeignKey("FromAccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a42ad0f8d5"); + + b.Navigation("Device"); + + b.Navigation("FromAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Favourite", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("Favourites") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_5eb6c2b873"); + + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithMany("Favourites") + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_b0e856845e"); + + b.Navigation("Account"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.FeaturedTag", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("FeaturedTags") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_174efcf15f"); + + b.HasOne("Smilodon.Domain.Models.Tag", "Tag") + .WithMany("FeaturedTags") + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_23a9055c7c"); + + b.Navigation("Account"); + + b.Navigation("Tag"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Follow", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("FollowAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_32ed1b5560"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("FollowTargetAccounts") + .HasForeignKey("TargetAccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_745ca29eac"); + + b.Navigation("Account"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.FollowRecommendationSuppression", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithOne("FollowRecommendationSuppression") + .HasForeignKey("Smilodon.Domain.Models.FollowRecommendationSuppression", "AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_dfb9a1dbe2"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.FollowRequest", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("FollowRequestAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_76d644b0e7"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("FollowRequestTargetAccounts") + .HasForeignKey("TargetAccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_9291ec025d"); + + b.Navigation("Account"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Identity", b => + { + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithMany("Identities") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_bea040f377"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Import", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("Imports") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_6db1b6e408"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Invite", b => + { + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithMany("Invites") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_ff69dbb2ac"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.List", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("Lists") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_3853b78dac"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ListAccount", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("ListAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_85fee9d6ab"); + + b.HasOne("Smilodon.Domain.Models.Follow", "Follow") + .WithMany("ListAccounts") + .HasForeignKey("FollowId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_40f9cc29f1"); + + b.HasOne("Smilodon.Domain.Models.List", "List") + .WithMany("ListAccounts") + .HasForeignKey("ListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_e54e356c88"); + + b.Navigation("Account"); + + b.Navigation("Follow"); + + b.Navigation("List"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.LoginActivity", b => + { + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithMany("LoginActivities") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_e4b6396b41"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Marker", b => + { + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithMany("Markers") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a7009bc2b6"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.MediaAttachment", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("MediaAttachments") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_96dd81e81b"); + + b.HasOne("Smilodon.Domain.Models.ScheduledStatus", "ScheduledStatus") + .WithMany("MediaAttachments") + .HasForeignKey("ScheduledStatusId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_31fc5aeef1"); + + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithMany("MediaAttachments") + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_3ec0cfdd70"); + + b.Navigation("Account"); + + b.Navigation("ScheduledStatus"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Mention", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("Mentions") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_970d43f9d1"); + + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithMany("Mentions") + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_59edbe2887"); + + b.Navigation("Account"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Mute", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("MuteAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_b8d8daf315"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("MuteTargetAccounts") + .HasForeignKey("TargetAccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_eecff219ea"); + + b.Navigation("Account"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Notification", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("NotificationAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_c141c8ee55"); + + b.HasOne("Smilodon.Domain.Models.Account", "FromAccount") + .WithMany("NotificationFromAccounts") + .HasForeignKey("FromAccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_fbd6b0bf9e"); + + b.Navigation("Account"); + + b.Navigation("FromAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OAuthAccessGrant", b => + { + b.HasOne("Smilodon.Domain.Models.OAuthApplication", "Application") + .WithMany("OAuthAccessGrants") + .HasForeignKey("ApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_34d54b0a33"); + + b.HasOne("Smilodon.Domain.Models.User", "ResourceOwner") + .WithMany("OAuthAccessGrants") + .HasForeignKey("ResourceOwnerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_63b044929b"); + + b.Navigation("Application"); + + b.Navigation("ResourceOwner"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OAuthAccessToken", b => + { + b.HasOne("Smilodon.Domain.Models.OAuthApplication", "Application") + .WithMany("OAuthAccessTokens") + .HasForeignKey("ApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_f5fc4c1ee3"); + + b.HasOne("Smilodon.Domain.Models.User", "ResourceOwner") + .WithMany("OAuthAccessTokens") + .HasForeignKey("ResourceOwnerId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_e84df68546"); + + b.Navigation("Application"); + + b.Navigation("ResourceOwner"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OAuthApplication", b => + { + b.HasOne("Smilodon.Domain.Models.User", "Owner") + .WithMany("OAuthApplications") + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_b0988c7c0a"); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OneTimeKey", b => + { + b.HasOne("Smilodon.Domain.Models.Device", "Device") + .WithMany("OneTimeKeys") + .HasForeignKey("DeviceId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_d3edd8c878"); + + b.Navigation("Device"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Poll", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("Polls") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_5b19a0c011"); + + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithMany("Polls") + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_3e0d9f1115"); + + b.Navigation("Account"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.PollVote", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("PollVotes") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_b6c18cf44a"); + + b.HasOne("Smilodon.Domain.Models.Poll", "Poll") + .WithMany("PollVotes") + .HasForeignKey("PollId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a6e6974b7e"); + + b.Navigation("Account"); + + b.Navigation("Poll"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.PreviewCardTrend", b => + { + b.HasOne("Smilodon.Domain.Models.PreviewCard", "PreviewCard") + .WithOne("PreviewCardTrend") + .HasForeignKey("Smilodon.Domain.Models.PreviewCardTrend", "PreviewCardId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_371593db34"); + + b.Navigation("PreviewCard"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Report", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("ReportAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_4b81f7522c"); + + b.HasOne("Smilodon.Domain.Models.Account", "ActionTakenByAccount") + .WithMany("ReportActionTakenByAccounts") + .HasForeignKey("ActionTakenByAccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_bca45b75fd"); + + b.HasOne("Smilodon.Domain.Models.Account", "AssignedAccount") + .WithMany("ReportAssignedAccounts") + .HasForeignKey("AssignedAccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_4e7a498fb4"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("ReportTargetAccounts") + .HasForeignKey("TargetAccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_eb37af34f0"); + + b.Navigation("Account"); + + b.Navigation("ActionTakenByAccount"); + + b.Navigation("AssignedAccount"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ReportNote", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("ReportNotes") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_cae66353f3"); + + b.HasOne("Smilodon.Domain.Models.Report", "Report") + .WithMany("ReportNotes") + .HasForeignKey("ReportId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_7fa83a61eb"); + + b.Navigation("Account"); + + b.Navigation("Report"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ScheduledStatus", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("ScheduledStatuses") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_23bd9018f9"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.SessionActivation", b => + { + b.HasOne("Smilodon.Domain.Models.OAuthAccessToken", "AccessToken") + .WithMany("SessionActivations") + .HasForeignKey("AccessTokenId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_957e5bda89"); + + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithMany("SessionActivations") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_e5fda67334"); + + b.Navigation("AccessToken"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Status", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("StatusAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_9bda1543f7"); + + b.HasOne("Smilodon.Domain.Models.Account", "InReplyToAccount") + .WithMany("StatusInReplyToAccounts") + .HasForeignKey("InReplyToAccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_c7fa917661"); + + b.HasOne("Smilodon.Domain.Models.Status", "InReplyTo") + .WithMany("InverseInReplyTo") + .HasForeignKey("InReplyToId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_94a6f70399"); + + b.HasOne("Smilodon.Domain.Models.Status", "ReblogOf") + .WithMany("InverseReblogOf") + .HasForeignKey("ReblogOfId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_256483a9ab"); + + b.Navigation("Account"); + + b.Navigation("InReplyTo"); + + b.Navigation("InReplyToAccount"); + + b.Navigation("ReblogOf"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusEdit", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("StatusEdits") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_dc8988c545"); + + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithMany("StatusEdits") + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_a960f234a0"); + + b.Navigation("Account"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusPin", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("StatusPins") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_d4cb435b62"); + + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithMany("StatusPins") + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_65c05552f1"); + + b.Navigation("Account"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusStat", b => + { + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithOne("StatusStat") + .HasForeignKey("Smilodon.Domain.Models.StatusStat", "StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_4a247aac42"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusTag", b => + { + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_df0fe11427"); + + b.HasOne("Smilodon.Domain.Models.Tag", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_3081861e21"); + + b.Navigation("Status"); + + b.Navigation("Tag"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusTrend", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("StatusTrends") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_a6b527ea49"); + + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithOne("StatusTrend") + .HasForeignKey("Smilodon.Domain.Models.StatusTrend", "StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_68c610dc1a"); + + b.Navigation("Account"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.TagFollow", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("TagFollows") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_091e831473"); + + b.HasOne("Smilodon.Domain.Models.Tag", "Tag") + .WithMany("TagFollows") + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_0deefe597f"); + + b.Navigation("Account"); + + b.Navigation("Tag"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Tombstone", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("Tombstones") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_f95b861449"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.User", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("Users") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_50500f500d"); + + b.HasOne("Smilodon.Domain.Models.OAuthApplication", "CreatedByApplication") + .WithMany("Users") + .HasForeignKey("CreatedByApplicationId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_ecc9536e7c"); + + b.HasOne("Smilodon.Domain.Models.Invite", "Invite") + .WithMany("Users") + .HasForeignKey("InviteId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_8fb2a43e88"); + + b.HasOne("Smilodon.Domain.Models.UserRole", "Role") + .WithMany("Users") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_642f17018b"); + + b.Navigation("Account"); + + b.Navigation("CreatedByApplication"); + + b.Navigation("Invite"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.UserInviteRequest", b => + { + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithMany("UserInviteRequests") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_3773f15361"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.WebAuthnCredential", b => + { + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithMany("WebAuthnCredentials") + .HasForeignKey("UserId") + .HasConstraintName("fk_rails_a4355aef77"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.WebPushSubscription", b => + { + b.HasOne("Smilodon.Domain.Models.OAuthAccessToken", "AccessToken") + .WithMany("WebPushSubscriptions") + .HasForeignKey("AccessTokenId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_751a9f390b"); + + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithMany("WebPushSubscriptions") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_b006f28dac"); + + b.Navigation("AccessToken"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.WebSetting", b => + { + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithOne("WebSetting") + .HasForeignKey("Smilodon.Domain.Models.WebSetting", "UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_11910667b2"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Account", b => + { + b.Navigation("AccountAliases"); + + b.Navigation("AccountConversations"); + + b.Navigation("AccountDeletionRequests"); + + b.Navigation("AccountDomainBlocks"); + + b.Navigation("AccountMigrationAccounts"); + + b.Navigation("AccountMigrationTargetAccounts"); + + b.Navigation("AccountModerationNoteAccounts"); + + b.Navigation("AccountModerationNoteTargetAccounts"); + + b.Navigation("AccountNoteAccounts"); + + b.Navigation("AccountNoteTargetAccounts"); + + b.Navigation("AccountPinAccounts"); + + b.Navigation("AccountPinTargetAccounts"); + + b.Navigation("AccountStat") + .IsRequired(); + + b.Navigation("AccountStatusesCleanupPolicies"); + + b.Navigation("AccountWarningAccounts"); + + b.Navigation("AccountWarningTargetAccounts"); + + b.Navigation("AdminActionLogs"); + + b.Navigation("AnnouncementMutes"); + + b.Navigation("AnnouncementReactions"); + + b.Navigation("AppealAccounts"); + + b.Navigation("AppealApprovedByAccounts"); + + b.Navigation("AppealRejectedByAccounts"); + + b.Navigation("BlockAccounts"); + + b.Navigation("BlockTargetAccounts"); + + b.Navigation("Bookmarks"); + + b.Navigation("CanonicalEmailBlocks"); + + b.Navigation("ConversationMutes"); + + b.Navigation("CustomFilters"); + + b.Navigation("Devices"); + + b.Navigation("EncryptedMessages"); + + b.Navigation("Favourites"); + + b.Navigation("FeaturedTags"); + + b.Navigation("FollowAccounts"); + + b.Navigation("FollowRecommendationSuppression") + .IsRequired(); + + b.Navigation("FollowRequestAccounts"); + + b.Navigation("FollowRequestTargetAccounts"); + + b.Navigation("FollowTargetAccounts"); + + b.Navigation("Imports"); + + b.Navigation("InverseMovedToAccount"); + + b.Navigation("ListAccounts"); + + b.Navigation("Lists"); + + b.Navigation("MediaAttachments"); + + b.Navigation("Mentions"); + + b.Navigation("MuteAccounts"); + + b.Navigation("MuteTargetAccounts"); + + b.Navigation("NotificationAccounts"); + + b.Navigation("NotificationFromAccounts"); + + b.Navigation("PollVotes"); + + b.Navigation("Polls"); + + b.Navigation("ReportAccounts"); + + b.Navigation("ReportActionTakenByAccounts"); + + b.Navigation("ReportAssignedAccounts"); + + b.Navigation("ReportNotes"); + + b.Navigation("ReportTargetAccounts"); + + b.Navigation("ScheduledStatuses"); + + b.Navigation("StatusAccounts"); + + b.Navigation("StatusEdits"); + + b.Navigation("StatusInReplyToAccounts"); + + b.Navigation("StatusPins"); + + b.Navigation("StatusTrends"); + + b.Navigation("TagFollows"); + + b.Navigation("Tombstones"); + + b.Navigation("Users"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountWarning", b => + { + b.Navigation("Appeal") + .IsRequired(); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Announcement", b => + { + b.Navigation("AnnouncementMutes"); + + b.Navigation("AnnouncementReactions"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Conversation", b => + { + b.Navigation("AccountConversations"); + + b.Navigation("ConversationMutes"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomEmoji", b => + { + b.Navigation("AnnouncementReactions"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomFilter", b => + { + b.Navigation("CustomFilterKeywords"); + + b.Navigation("CustomFilterStatuses"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Device", b => + { + b.Navigation("EncryptedMessages"); + + b.Navigation("OneTimeKeys"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.EmailDomainBlock", b => + { + b.Navigation("InverseParent"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Follow", b => + { + b.Navigation("ListAccounts"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Invite", b => + { + b.Navigation("Users"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.List", b => + { + b.Navigation("ListAccounts"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OAuthAccessToken", b => + { + b.Navigation("Devices"); + + b.Navigation("SessionActivations"); + + b.Navigation("WebPushSubscriptions"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OAuthApplication", b => + { + b.Navigation("OAuthAccessGrants"); + + b.Navigation("OAuthAccessTokens"); + + b.Navigation("Users"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Poll", b => + { + b.Navigation("PollVotes"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.PreviewCard", b => + { + b.Navigation("PreviewCardTrend") + .IsRequired(); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Report", b => + { + b.Navigation("AccountWarnings"); + + b.Navigation("ReportNotes"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ScheduledStatus", b => + { + b.Navigation("MediaAttachments"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Status", b => + { + b.Navigation("Bookmarks"); + + b.Navigation("CustomFilterStatuses"); + + b.Navigation("Favourites"); + + b.Navigation("InverseInReplyTo"); + + b.Navigation("InverseReblogOf"); + + b.Navigation("MediaAttachments"); + + b.Navigation("Mentions"); + + b.Navigation("Polls"); + + b.Navigation("StatusEdits"); + + b.Navigation("StatusPins"); + + b.Navigation("StatusStat") + .IsRequired(); + + b.Navigation("StatusTrend") + .IsRequired(); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Tag", b => + { + b.Navigation("FeaturedTags"); + + b.Navigation("TagFollows"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.User", b => + { + b.Navigation("Backups"); + + b.Navigation("Identities"); + + b.Navigation("Invites"); + + b.Navigation("LoginActivities"); + + b.Navigation("Markers"); + + b.Navigation("OAuthAccessGrants"); + + b.Navigation("OAuthAccessTokens"); + + b.Navigation("OAuthApplications"); + + b.Navigation("SessionActivations"); + + b.Navigation("UserInviteRequests"); + + b.Navigation("WebAuthnCredentials"); + + b.Navigation("WebPushSubscriptions"); + + b.Navigation("WebSetting") + .IsRequired(); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.UserRole", b => + { + b.Navigation("Users"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Infrastructure/Persistence/Migrations/20221125033633_InitialCreate.cs b/src/Infrastructure/Persistence/Migrations/20221125033633_InitialCreate.cs new file mode 100644 index 0000000..0e2c8de --- /dev/null +++ b/src/Infrastructure/Persistence/Migrations/20221125033633_InitialCreate.cs @@ -0,0 +1,3835 @@ +using System; +using System.Net; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Smilodon.Infrastructure.Persistence.Migrations +{ + /// + public partial class InitialCreate : Migration + { + private const string AccountsSearchIndex = """ + CREATE INDEX search_index + ON accounts USING gin (((setweight(to_tsvector('simple'::regconfig, display_name::text), 'A'::"char") || + setweight(to_tsvector('simple'::regconfig, username::text), 'B'::"char")) || + setweight(to_tsvector('simple'::regconfig, COALESCE(domain, ''::CHARACTER VARYING)::text), + 'C'::"char"))); + """; + + private const string AccountsUsernameAndDomainLowerIndex = """ + CREATE UNIQUE INDEX index_accounts_on_username_and_domain_lower + ON accounts (lower(username::text), COALESCE(lower(domain::text), ''::text)); + """; + + private const string TagsNameLowerBtreeIndex = """ + CREATE UNIQUE INDEX index_tags_on_name_lower_btree + ON tags (lower(name::text) text_pattern_ops); + """; + + private const string TimestampIdFunction = """ + CREATE FUNCTION timestamp_id(table_name text) RETURNS bigint + LANGUAGE plpgsql + AS + $$ + DECLARE + time_part bigint; + sequence_base bigint; + tail bigint; + BEGIN + time_part := ( + -- Get the time in milliseconds + ((date_part('epoch', now()) * 1000))::bigint + -- And shift it over two bytes + << 16); + + sequence_base := ( + 'x' || + -- Take the first two bytes (four hex characters) + substr( + -- Of the MD5 hash of the data we documented + md5(table_name || '34bfaf6f0285d60227c6a18d28dab3f2' || time_part::text), + 1, 4 + ) + -- And turn it into a bigint + )::bit(16)::bigint; + + -- Finally, add our sequence number to our base, and chop + -- it to the last two bytes + tail := ( + (sequence_base + nextval(table_name || '_id_seq')) + & 65535); + + -- Return the time part and the sequence part. OR appears + -- faster here than addition, but they're equivalent: + -- time_part has no trailing two bytes, and tail is only + -- the last two bytes. + RETURN time_part | tail; + END + $$; + """; + + private const string UserIpsView = """ + CREATE VIEW user_ips(user_id, ip, used_at) AS + SELECT t0.user_id, + t0.ip, + max(t0.used_at) AS used_at + FROM (SELECT users.id AS user_id, + users.sign_up_ip AS ip, + users.created_at AS used_at + FROM users + WHERE users.sign_up_ip IS NOT NULL + UNION ALL + SELECT session_activations.user_id, + session_activations.ip, + session_activations.updated_at + FROM session_activations + UNION ALL + SELECT login_activities.user_id, + login_activities.ip, + login_activities.created_at + FROM login_activities + WHERE login_activities.success = true) t0 + GROUP BY t0.user_id, t0.ip; + """; + + private const string AccountSummariesView = """ + CREATE MATERIALIZED VIEW account_summaries AS + SELECT accounts.id AS account_id, + mode() WITHIN GROUP (ORDER BY t0.language) AS language, + mode() WITHIN GROUP (ORDER BY t0.sensitive) AS sensitive + FROM accounts + CROSS JOIN LATERAL ( SELECT statuses.account_id, + statuses.language, + statuses.sensitive + FROM statuses + WHERE statuses.account_id = accounts.id + AND statuses.deleted_at IS NULL + AND statuses.reblog_of_id IS NULL + ORDER BY statuses.id DESC + LIMIT 20) t0 + WHERE accounts.suspended_at IS NULL + AND accounts.silenced_at IS NULL + AND accounts.moved_to_account_id IS NULL + AND accounts.discoverable = true + AND accounts.locked = false + GROUP BY accounts.id; + + CREATE UNIQUE INDEX index_account_summaries_on_account_id + ON account_summaries (account_id); + """; + + private const string FollowRecommendationsView = """ + CREATE MATERIALIZED VIEW public.follow_recommendations AS + SELECT t0.account_id, + sum(t0.rank) AS rank, + array_agg(t0.reason) AS reason + FROM (SELECT account_summaries.account_id, + count(follows.id)::numeric / (1.0 + count(follows.id)::numeric) AS rank, + 'most_followed'::text AS reason + FROM follows + JOIN account_summaries ON account_summaries.account_id = follows.target_account_id + JOIN users ON users.account_id = follows.account_id + LEFT JOIN follow_recommendation_suppressions + ON follow_recommendation_suppressions.account_id = follows.target_account_id + WHERE users.current_sign_in_at >= (now() - '30 days'::interval) + AND account_summaries.sensitive = false + AND follow_recommendation_suppressions.id IS NULL + GROUP BY account_summaries.account_id + HAVING count(follows.id) >= 5 + UNION ALL + SELECT account_summaries.account_id, + sum(status_stats.reblogs_count + status_stats.favourites_count) / + (1.0 + sum(status_stats.reblogs_count + status_stats.favourites_count)) AS rank, + 'most_interactions'::text AS reason + FROM status_stats + JOIN statuses ON statuses.id = status_stats.status_id + JOIN account_summaries ON account_summaries.account_id = statuses.account_id + LEFT JOIN follow_recommendation_suppressions + ON follow_recommendation_suppressions.account_id = statuses.account_id + WHERE statuses.id >= + ((date_part('epoch'::text, now() - '30 days'::interval) * 1000::double precision)::bigint << 16) + AND account_summaries.sensitive = false + AND follow_recommendation_suppressions.id IS NULL + GROUP BY account_summaries.account_id + HAVING sum(status_stats.reblogs_count + status_stats.favourites_count) >= 5::numeric) t0 + GROUP BY t0.account_id + ORDER BY (sum(t0.rank)) DESC; + + CREATE UNIQUE INDEX index_follow_recommendations_on_account_id + ON follow_recommendations (account_id); + """; + + private const string InstancesView = """ + CREATE MATERIALIZED VIEW public.instances AS + WITH domain_counts(domain, accounts_count) AS (SELECT accounts.domain, + count(*) AS accounts_count + FROM accounts + WHERE accounts.domain IS NOT NULL + GROUP BY accounts.domain) + SELECT domain_counts.domain, + domain_counts.accounts_count + FROM domain_counts + UNION + SELECT domain_blocks.domain, + COALESCE(domain_counts.accounts_count, 0::bigint) AS accounts_count + FROM domain_blocks + LEFT JOIN domain_counts ON domain_counts.domain::text = domain_blocks.domain::text + UNION + SELECT domain_allows.domain, + COALESCE(domain_counts.accounts_count, 0::bigint) AS accounts_count + FROM domain_allows + LEFT JOIN domain_counts ON domain_counts.domain::text = domain_allows.domain::text; + + CREATE UNIQUE INDEX index_instances_on_domain + ON public.instances (domain); + """; + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterDatabase() + .Annotation("Npgsql:PostgresExtension:plpgsql", ",,"); + + migrationBuilder.Sql(TimestampIdFunction); + + migrationBuilder.CreateSequence( + name: "accounts_id_seq"); + + migrationBuilder.CreateSequence( + name: "encrypted_messages_id_seq"); + + migrationBuilder.CreateSequence( + name: "media_attachments_id_seq"); + + migrationBuilder.CreateSequence( + name: "statuses_id_seq"); + + migrationBuilder.CreateTable( + name: "account_warning_presets", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + text = table.Column(type: "text", nullable: false, defaultValueSql: "''::text"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + title = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying") + }, + constraints: table => + { + table.PrimaryKey("account_warning_presets_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "accounts", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false, defaultValueSql: "timestamp_id('accounts'::text)"), + username = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + domain = table.Column(type: "character varying", nullable: true), + privatekey = table.Column(name: "private_key", type: "text", nullable: true), + publickey = table.Column(name: "public_key", type: "text", nullable: false, defaultValueSql: "''::text"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + note = table.Column(type: "text", nullable: false, defaultValueSql: "''::text"), + displayname = table.Column(name: "display_name", type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + uri = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + url = table.Column(type: "character varying", nullable: true), + avatarfilename = table.Column(name: "avatar_file_name", type: "character varying", nullable: true), + avatarcontenttype = table.Column(name: "avatar_content_type", type: "character varying", nullable: true), + avatarfilesize = table.Column(name: "avatar_file_size", type: "integer", nullable: true), + avatarupdatedat = table.Column(name: "avatar_updated_at", type: "timestamp without time zone", nullable: true), + headerfilename = table.Column(name: "header_file_name", type: "character varying", nullable: true), + headercontenttype = table.Column(name: "header_content_type", type: "character varying", nullable: true), + headerfilesize = table.Column(name: "header_file_size", type: "integer", nullable: true), + headerupdatedat = table.Column(name: "header_updated_at", type: "timestamp without time zone", nullable: true), + avatarremoteurl = table.Column(name: "avatar_remote_url", type: "character varying", nullable: true), + locked = table.Column(type: "boolean", nullable: false), + headerremoteurl = table.Column(name: "header_remote_url", type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + lastwebfingeredat = table.Column(name: "last_webfingered_at", type: "timestamp without time zone", nullable: true), + inboxurl = table.Column(name: "inbox_url", type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + outboxurl = table.Column(name: "outbox_url", type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + sharedinboxurl = table.Column(name: "shared_inbox_url", type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + followersurl = table.Column(name: "followers_url", type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + protocol = table.Column(type: "integer", nullable: false), + memorial = table.Column(type: "boolean", nullable: false), + movedtoaccountid = table.Column(name: "moved_to_account_id", type: "bigint", nullable: true), + featuredcollectionurl = table.Column(name: "featured_collection_url", type: "character varying", nullable: true), + fields = table.Column(type: "jsonb", nullable: true), + actortype = table.Column(name: "actor_type", type: "character varying", nullable: true), + discoverable = table.Column(type: "boolean", nullable: true), + alsoknownas = table.Column(name: "also_known_as", type: "character varying[]", nullable: true), + silencedat = table.Column(name: "silenced_at", type: "timestamp without time zone", nullable: true), + suspendedat = table.Column(name: "suspended_at", type: "timestamp without time zone", nullable: true), + hidecollections = table.Column(name: "hide_collections", type: "boolean", nullable: true), + avatarstorageschemaversion = table.Column(name: "avatar_storage_schema_version", type: "integer", nullable: true), + headerstorageschemaversion = table.Column(name: "header_storage_schema_version", type: "integer", nullable: true), + devicesurl = table.Column(name: "devices_url", type: "character varying", nullable: true), + suspensionorigin = table.Column(name: "suspension_origin", type: "integer", nullable: true), + sensitizedat = table.Column(name: "sensitized_at", type: "timestamp without time zone", nullable: true), + trendable = table.Column(type: "boolean", nullable: true), + reviewedat = table.Column(name: "reviewed_at", type: "timestamp without time zone", nullable: true), + requestedreviewat = table.Column(name: "requested_review_at", type: "timestamp without time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("accounts_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_2320833084", + column: x => x.movedtoaccountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.SetNull); + }); + + migrationBuilder.CreateTable( + name: "accounts_tags", + columns: table => new + { + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + tagid = table.Column(name: "tag_id", type: "bigint", nullable: false) + }, + constraints: table => + { + }); + + migrationBuilder.CreateTable( + name: "announcements", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + text = table.Column(type: "text", nullable: false, defaultValueSql: "''::text"), + published = table.Column(type: "boolean", nullable: false), + allday = table.Column(name: "all_day", type: "boolean", nullable: false), + scheduledat = table.Column(name: "scheduled_at", type: "timestamp without time zone", nullable: true), + startsat = table.Column(name: "starts_at", type: "timestamp without time zone", nullable: true), + endsat = table.Column(name: "ends_at", type: "timestamp without time zone", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + publishedat = table.Column(name: "published_at", type: "timestamp without time zone", nullable: true), + statusids = table.Column(name: "status_ids", type: "bigint[]", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("announcements_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "ar_internal_metadata", + columns: table => new + { + key = table.Column(type: "character varying", nullable: false), + value = table.Column(type: "character varying", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp(6) without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp(6) without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("ar_internal_metadata_pkey", x => x.key); + }); + + migrationBuilder.CreateTable( + name: "conversations", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + uri = table.Column(type: "character varying", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("conversations_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "custom_emoji_categories", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + name = table.Column(type: "character varying", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("custom_emoji_categories_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "custom_emojis", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + shortcode = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + domain = table.Column(type: "character varying", nullable: true), + imagefilename = table.Column(name: "image_file_name", type: "character varying", nullable: true), + imagecontenttype = table.Column(name: "image_content_type", type: "character varying", nullable: true), + imagefilesize = table.Column(name: "image_file_size", type: "integer", nullable: true), + imageupdatedat = table.Column(name: "image_updated_at", type: "timestamp without time zone", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + disabled = table.Column(type: "boolean", nullable: false), + uri = table.Column(type: "character varying", nullable: true), + imageremoteurl = table.Column(name: "image_remote_url", type: "character varying", nullable: true), + visibleinpicker = table.Column(name: "visible_in_picker", type: "boolean", nullable: false, defaultValueSql: "true"), + categoryid = table.Column(name: "category_id", type: "bigint", nullable: true), + imagestorageschemaversion = table.Column(name: "image_storage_schema_version", type: "integer", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("custom_emojis_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "domain_allows", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + domain = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("domain_allows_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "domain_blocks", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + domain = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + severity = table.Column(type: "integer", nullable: true, defaultValueSql: "0"), + rejectmedia = table.Column(name: "reject_media", type: "boolean", nullable: false), + rejectreports = table.Column(name: "reject_reports", type: "boolean", nullable: false), + privatecomment = table.Column(name: "private_comment", type: "text", nullable: true), + publiccomment = table.Column(name: "public_comment", type: "text", nullable: true), + obfuscate = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("domain_blocks_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "email_domain_blocks", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + domain = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + parentid = table.Column(name: "parent_id", type: "bigint", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("email_domain_blocks_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_408efe0a15", + column: x => x.parentid, + principalTable: "email_domain_blocks", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ip_blocks", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + expiresat = table.Column(name: "expires_at", type: "timestamp without time zone", nullable: true), + ip = table.Column(type: "inet", nullable: false, defaultValueSql: "'0.0.0.0'::inet"), + severity = table.Column(type: "integer", nullable: false), + comment = table.Column(type: "text", nullable: false, defaultValueSql: "''::text") + }, + constraints: table => + { + table.PrimaryKey("ip_blocks_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "pghero_space_stats", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + database = table.Column(type: "text", nullable: true), + schema = table.Column(type: "text", nullable: true), + relation = table.Column(type: "text", nullable: true), + size = table.Column(type: "bigint", nullable: true), + capturedat = table.Column(name: "captured_at", type: "timestamp without time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pghero_space_stats_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "preview_card_providers", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + domain = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + iconfilename = table.Column(name: "icon_file_name", type: "character varying", nullable: true), + iconcontenttype = table.Column(name: "icon_content_type", type: "character varying", nullable: true), + iconfilesize = table.Column(name: "icon_file_size", type: "bigint", nullable: true), + iconupdatedat = table.Column(name: "icon_updated_at", type: "timestamp without time zone", nullable: true), + trendable = table.Column(type: "boolean", nullable: true), + reviewedat = table.Column(name: "reviewed_at", type: "timestamp without time zone", nullable: true), + requestedreviewat = table.Column(name: "requested_review_at", type: "timestamp without time zone", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp(6) without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp(6) without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("preview_card_providers_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "preview_cards", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + url = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + title = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + description = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + imagefilename = table.Column(name: "image_file_name", type: "character varying", nullable: true), + imagecontenttype = table.Column(name: "image_content_type", type: "character varying", nullable: true), + imagefilesize = table.Column(name: "image_file_size", type: "integer", nullable: true), + imageupdatedat = table.Column(name: "image_updated_at", type: "timestamp without time zone", nullable: true), + type = table.Column(type: "integer", nullable: false), + html = table.Column(type: "text", nullable: false, defaultValueSql: "''::text"), + authorname = table.Column(name: "author_name", type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + authorurl = table.Column(name: "author_url", type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + providername = table.Column(name: "provider_name", type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + providerurl = table.Column(name: "provider_url", type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + width = table.Column(type: "integer", nullable: false), + height = table.Column(type: "integer", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + embedurl = table.Column(name: "embed_url", type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + imagestorageschemaversion = table.Column(name: "image_storage_schema_version", type: "integer", nullable: true), + blurhash = table.Column(type: "character varying", nullable: true), + language = table.Column(type: "character varying", nullable: true), + maxscore = table.Column(name: "max_score", type: "double precision", nullable: true), + maxscoreat = table.Column(name: "max_score_at", type: "timestamp without time zone", nullable: true), + trendable = table.Column(type: "boolean", nullable: true), + linktype = table.Column(name: "link_type", type: "integer", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("preview_cards_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "preview_cards_statuses", + columns: table => new + { + previewcardid = table.Column(name: "preview_card_id", type: "bigint", nullable: false), + statusid = table.Column(name: "status_id", type: "bigint", nullable: false) + }, + constraints: table => + { + }); + + migrationBuilder.CreateTable( + name: "relays", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + inboxurl = table.Column(name: "inbox_url", type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + followactivityid = table.Column(name: "follow_activity_id", type: "character varying", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + state = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("relays_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "rules", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + priority = table.Column(type: "integer", nullable: false), + deletedat = table.Column(name: "deleted_at", type: "timestamp without time zone", nullable: true), + text = table.Column(type: "text", nullable: false, defaultValueSql: "''::text"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("rules_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "settings", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + var = table.Column(type: "character varying", nullable: false), + value = table.Column(type: "text", nullable: true), + thingtype = table.Column(name: "thing_type", type: "character varying", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: true), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: true), + thingid = table.Column(name: "thing_id", type: "bigint", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("settings_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "site_uploads", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + var = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + filefilename = table.Column(name: "file_file_name", type: "character varying", nullable: true), + filecontenttype = table.Column(name: "file_content_type", type: "character varying", nullable: true), + filefilesize = table.Column(name: "file_file_size", type: "integer", nullable: true), + fileupdatedat = table.Column(name: "file_updated_at", type: "timestamp without time zone", nullable: true), + meta = table.Column(type: "json", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + blurhash = table.Column(type: "character varying", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("site_uploads_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "system_keys", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + key = table.Column(type: "bytea", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("system_keys_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "tags", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + name = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + usable = table.Column(type: "boolean", nullable: true), + trendable = table.Column(type: "boolean", nullable: true), + listable = table.Column(type: "boolean", nullable: true), + reviewedat = table.Column(name: "reviewed_at", type: "timestamp without time zone", nullable: true), + requestedreviewat = table.Column(name: "requested_review_at", type: "timestamp without time zone", nullable: true), + laststatusat = table.Column(name: "last_status_at", type: "timestamp without time zone", nullable: true), + maxscore = table.Column(name: "max_score", type: "double precision", nullable: true), + maxscoreat = table.Column(name: "max_score_at", type: "timestamp without time zone", nullable: true), + displayname = table.Column(name: "display_name", type: "character varying", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("tags_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "unavailable_domains", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + domain = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("unavailable_domains_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "user_roles", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + name = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + color = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + position = table.Column(type: "integer", nullable: false), + permissions = table.Column(type: "bigint", nullable: false), + highlighted = table.Column(type: "boolean", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp(6) without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp(6) without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("user_roles_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "webhooks", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + url = table.Column(type: "character varying", nullable: false), + events = table.Column(type: "character varying[]", nullable: false, defaultValueSql: "'{}'::character varying[]"), + secret = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + enabled = table.Column(type: "boolean", nullable: false, defaultValueSql: "true"), + createdat = table.Column(name: "created_at", type: "timestamp(6) without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp(6) without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("webhooks_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "account_aliases", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true), + acct = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + uri = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("account_aliases_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_fc91575d08", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "account_deletion_requests", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("account_deletion_requests_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_45bf2626b9", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "account_domain_blocks", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + domain = table.Column(type: "character varying", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("account_domain_blocks_pkey", x => x.id); + table.ForeignKey( + name: "fk_206c6029bd", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "account_migrations", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true), + acct = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + followerscount = table.Column(name: "followers_count", type: "bigint", nullable: false), + targetaccountid = table.Column(name: "target_account_id", type: "bigint", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("account_migrations_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_c9f701caaf", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_d9a8dad070", + column: x => x.targetaccountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.SetNull); + }); + + migrationBuilder.CreateTable( + name: "account_moderation_notes", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + content = table.Column(type: "text", nullable: false), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + targetaccountid = table.Column(name: "target_account_id", type: "bigint", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("account_moderation_notes_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_3f8b75089b", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id"); + table.ForeignKey( + name: "fk_rails_dd62ed5ac3", + column: x => x.targetaccountid, + principalTable: "accounts", + principalColumn: "id"); + }); + + migrationBuilder.CreateTable( + name: "account_notes", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true), + targetaccountid = table.Column(name: "target_account_id", type: "bigint", nullable: true), + comment = table.Column(type: "text", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("account_notes_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_2801b48f1a", + column: x => x.targetaccountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_4ee4503c69", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "account_pins", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true), + targetaccountid = table.Column(name: "target_account_id", type: "bigint", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("account_pins_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_a176e26c37", + column: x => x.targetaccountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_d44979e5dd", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "account_stats", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + statusescount = table.Column(name: "statuses_count", type: "bigint", nullable: false), + followingcount = table.Column(name: "following_count", type: "bigint", nullable: false), + followerscount = table.Column(name: "followers_count", type: "bigint", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + laststatusat = table.Column(name: "last_status_at", type: "timestamp without time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("account_stats_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_215bb31ff1", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "account_statuses_cleanup_policies", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + enabled = table.Column(type: "boolean", nullable: false, defaultValueSql: "true"), + minstatusage = table.Column(name: "min_status_age", type: "integer", nullable: false, defaultValueSql: "1209600"), + keepdirect = table.Column(name: "keep_direct", type: "boolean", nullable: false, defaultValueSql: "true"), + keeppinned = table.Column(name: "keep_pinned", type: "boolean", nullable: false, defaultValueSql: "true"), + keeppolls = table.Column(name: "keep_polls", type: "boolean", nullable: false), + keepmedia = table.Column(name: "keep_media", type: "boolean", nullable: false), + keepselffav = table.Column(name: "keep_self_fav", type: "boolean", nullable: false, defaultValueSql: "true"), + keepselfbookmark = table.Column(name: "keep_self_bookmark", type: "boolean", nullable: false, defaultValueSql: "true"), + minfavs = table.Column(name: "min_favs", type: "integer", nullable: true), + minreblogs = table.Column(name: "min_reblogs", type: "integer", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp(6) without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp(6) without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("account_statuses_cleanup_policies_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_23d5f73cfe", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "admin_action_logs", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true), + action = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + targettype = table.Column(name: "target_type", type: "character varying", nullable: true), + targetid = table.Column(name: "target_id", type: "bigint", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + humanidentifier = table.Column(name: "human_identifier", type: "character varying", nullable: true), + routeparam = table.Column(name: "route_param", type: "character varying", nullable: true), + permalink = table.Column(type: "character varying", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("admin_action_logs_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_a7667297fa", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "blocks", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + targetaccountid = table.Column(name: "target_account_id", type: "bigint", nullable: false), + uri = table.Column(type: "character varying", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("blocks_pkey", x => x.id); + table.ForeignKey( + name: "fk_4269e03e65", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_9571bfabc1", + column: x => x.targetaccountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "canonical_email_blocks", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + canonicalemailhash = table.Column(name: "canonical_email_hash", type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + referenceaccountid = table.Column(name: "reference_account_id", type: "bigint", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp(6) without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp(6) without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("canonical_email_blocks_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_1ecb262096", + column: x => x.referenceaccountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "custom_filters", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true), + expiresat = table.Column(name: "expires_at", type: "timestamp without time zone", nullable: true), + phrase = table.Column(type: "text", nullable: false, defaultValueSql: "''::text"), + context = table.Column(type: "character varying[]", nullable: false, defaultValueSql: "'{}'::character varying[]"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + action = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("custom_filters_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_8b8d786993", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "follow_recommendation_suppressions", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp(6) without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp(6) without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("follow_recommendation_suppressions_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_dfb9a1dbe2", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "follow_requests", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + targetaccountid = table.Column(name: "target_account_id", type: "bigint", nullable: false), + showreblogs = table.Column(name: "show_reblogs", type: "boolean", nullable: false, defaultValueSql: "true"), + uri = table.Column(type: "character varying", nullable: true), + notify = table.Column(type: "boolean", nullable: false), + languages = table.Column(type: "character varying[]", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("follow_requests_pkey", x => x.id); + table.ForeignKey( + name: "fk_76d644b0e7", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_9291ec025d", + column: x => x.targetaccountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "follows", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + targetaccountid = table.Column(name: "target_account_id", type: "bigint", nullable: false), + showreblogs = table.Column(name: "show_reblogs", type: "boolean", nullable: false, defaultValueSql: "true"), + uri = table.Column(type: "character varying", nullable: true), + notify = table.Column(type: "boolean", nullable: false), + languages = table.Column(type: "character varying[]", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("follows_pkey", x => x.id); + table.ForeignKey( + name: "fk_32ed1b5560", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_745ca29eac", + column: x => x.targetaccountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "imports", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + type = table.Column(type: "integer", nullable: false), + approved = table.Column(type: "boolean", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + datafilename = table.Column(name: "data_file_name", type: "character varying", nullable: true), + datacontenttype = table.Column(name: "data_content_type", type: "character varying", nullable: true), + datafilesize = table.Column(name: "data_file_size", type: "integer", nullable: true), + dataupdatedat = table.Column(name: "data_updated_at", type: "timestamp without time zone", nullable: true), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + overwrite = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("imports_pkey", x => x.id); + table.ForeignKey( + name: "fk_6db1b6e408", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "lists", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + title = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + repliespolicy = table.Column(name: "replies_policy", type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("lists_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_3853b78dac", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "mutes", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + hidenotifications = table.Column(name: "hide_notifications", type: "boolean", nullable: false, defaultValueSql: "true"), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + targetaccountid = table.Column(name: "target_account_id", type: "bigint", nullable: false), + expiresat = table.Column(name: "expires_at", type: "timestamp without time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("mutes_pkey", x => x.id); + table.ForeignKey( + name: "fk_b8d8daf315", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_eecff219ea", + column: x => x.targetaccountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "notifications", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + activityid = table.Column(name: "activity_id", type: "bigint", nullable: false), + activitytype = table.Column(name: "activity_type", type: "character varying", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + fromaccountid = table.Column(name: "from_account_id", type: "bigint", nullable: false), + type = table.Column(type: "character varying", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("notifications_pkey", x => x.id); + table.ForeignKey( + name: "fk_c141c8ee55", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_fbd6b0bf9e", + column: x => x.fromaccountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "reports", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + statusids = table.Column(name: "status_ids", type: "bigint[]", nullable: false, defaultValueSql: "'{}'::bigint[]"), + comment = table.Column(type: "text", nullable: false, defaultValueSql: "''::text"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + actiontakenbyaccountid = table.Column(name: "action_taken_by_account_id", type: "bigint", nullable: true), + targetaccountid = table.Column(name: "target_account_id", type: "bigint", nullable: false), + assignedaccountid = table.Column(name: "assigned_account_id", type: "bigint", nullable: true), + uri = table.Column(type: "character varying", nullable: true), + forwarded = table.Column(type: "boolean", nullable: true), + category = table.Column(type: "integer", nullable: false), + actiontakenat = table.Column(name: "action_taken_at", type: "timestamp without time zone", nullable: true), + ruleids = table.Column(name: "rule_ids", type: "bigint[]", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("reports_pkey", x => x.id); + table.ForeignKey( + name: "fk_4b81f7522c", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_bca45b75fd", + column: x => x.actiontakenbyaccountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.SetNull); + table.ForeignKey( + name: "fk_eb37af34f0", + column: x => x.targetaccountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_4e7a498fb4", + column: x => x.assignedaccountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.SetNull); + }); + + migrationBuilder.CreateTable( + name: "scheduled_statuses", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true), + scheduledat = table.Column(name: "scheduled_at", type: "timestamp without time zone", nullable: true), + @params = table.Column(name: "params", type: "jsonb", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("scheduled_statuses_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_23bd9018f9", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "statuses", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false, defaultValueSql: "timestamp_id('statuses'::text)"), + uri = table.Column(type: "character varying", nullable: true), + text = table.Column(type: "text", nullable: false, defaultValueSql: "''::text"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + inreplytoid = table.Column(name: "in_reply_to_id", type: "bigint", nullable: true), + reblogofid = table.Column(name: "reblog_of_id", type: "bigint", nullable: true), + url = table.Column(type: "character varying", nullable: true), + sensitive = table.Column(type: "boolean", nullable: false), + visibility = table.Column(type: "integer", nullable: false), + spoilertext = table.Column(name: "spoiler_text", type: "text", nullable: false, defaultValueSql: "''::text"), + reply = table.Column(type: "boolean", nullable: false), + language = table.Column(type: "character varying", nullable: true), + conversationid = table.Column(name: "conversation_id", type: "bigint", nullable: true), + local = table.Column(type: "boolean", nullable: true), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + applicationid = table.Column(name: "application_id", type: "bigint", nullable: true), + inreplytoaccountid = table.Column(name: "in_reply_to_account_id", type: "bigint", nullable: true), + pollid = table.Column(name: "poll_id", type: "bigint", nullable: true), + deletedat = table.Column(name: "deleted_at", type: "timestamp without time zone", nullable: true), + editedat = table.Column(name: "edited_at", type: "timestamp without time zone", nullable: true), + trendable = table.Column(type: "boolean", nullable: true), + orderedmediaattachmentids = table.Column(name: "ordered_media_attachment_ids", type: "bigint[]", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("statuses_pkey", x => x.id); + table.ForeignKey( + name: "fk_9bda1543f7", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_c7fa917661", + column: x => x.inreplytoaccountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.SetNull); + table.ForeignKey( + name: "fk_rails_256483a9ab", + column: x => x.reblogofid, + principalTable: "statuses", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_94a6f70399", + column: x => x.inreplytoid, + principalTable: "statuses", + principalColumn: "id", + onDelete: ReferentialAction.SetNull); + }); + + migrationBuilder.CreateTable( + name: "tombstones", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true), + uri = table.Column(type: "character varying", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + bymoderator = table.Column(name: "by_moderator", type: "boolean", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("tombstones_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_f95b861449", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "announcement_mutes", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true), + announcementid = table.Column(name: "announcement_id", type: "bigint", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("announcement_mutes_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_9c99f8e835", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_e35401adf1", + column: x => x.announcementid, + principalTable: "announcements", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "account_conversations", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true), + conversationid = table.Column(name: "conversation_id", type: "bigint", nullable: true), + participantaccountids = table.Column(name: "participant_account_ids", type: "bigint[]", nullable: false, defaultValueSql: "'{}'::bigint[]"), + statusids = table.Column(name: "status_ids", type: "bigint[]", nullable: false, defaultValueSql: "'{}'::bigint[]"), + laststatusid = table.Column(name: "last_status_id", type: "bigint", nullable: true), + lockversion = table.Column(name: "lock_version", type: "integer", nullable: false), + unread = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("account_conversations_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_1491654f9f", + column: x => x.conversationid, + principalTable: "conversations", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_6f5278b6e9", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "conversation_mutes", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + conversationid = table.Column(name: "conversation_id", type: "bigint", nullable: false), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("conversation_mutes_pkey", x => x.id); + table.ForeignKey( + name: "fk_225b4212bb", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_5ab139311f", + column: x => x.conversationid, + principalTable: "conversations", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "announcement_reactions", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true), + announcementid = table.Column(name: "announcement_id", type: "bigint", nullable: true), + name = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + customemojiid = table.Column(name: "custom_emoji_id", type: "bigint", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("announcement_reactions_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_7444ad831f", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_a1226eaa5c", + column: x => x.announcementid, + principalTable: "announcements", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_b742c91c0e", + column: x => x.customemojiid, + principalTable: "custom_emojis", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "preview_card_trends", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + previewcardid = table.Column(name: "preview_card_id", type: "bigint", nullable: false), + score = table.Column(type: "double precision", nullable: false), + rank = table.Column(type: "integer", nullable: false), + allowed = table.Column(type: "boolean", nullable: false), + language = table.Column(type: "character varying", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("preview_card_trends_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_371593db34", + column: x => x.previewcardid, + principalTable: "preview_cards", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "featured_tags", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + tagid = table.Column(name: "tag_id", type: "bigint", nullable: false), + statusescount = table.Column(name: "statuses_count", type: "bigint", nullable: false), + laststatusat = table.Column(name: "last_status_at", type: "timestamp without time zone", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + name = table.Column(type: "character varying", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("featured_tags_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_174efcf15f", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_23a9055c7c", + column: x => x.tagid, + principalTable: "tags", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "tag_follows", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + tagid = table.Column(name: "tag_id", type: "bigint", nullable: false), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp(6) without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp(6) without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("tag_follows_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_091e831473", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_0deefe597f", + column: x => x.tagid, + principalTable: "tags", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "custom_filter_keywords", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + customfilterid = table.Column(name: "custom_filter_id", type: "bigint", nullable: false), + keyword = table.Column(type: "text", nullable: false, defaultValueSql: "''::text"), + wholeword = table.Column(name: "whole_word", type: "boolean", nullable: false, defaultValueSql: "true"), + createdat = table.Column(name: "created_at", type: "timestamp(6) without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp(6) without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("custom_filter_keywords_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_5a49a74012", + column: x => x.customfilterid, + principalTable: "custom_filters", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "list_accounts", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + listid = table.Column(name: "list_id", type: "bigint", nullable: false), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + followid = table.Column(name: "follow_id", type: "bigint", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("list_accounts_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_40f9cc29f1", + column: x => x.followid, + principalTable: "follows", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_85fee9d6ab", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_e54e356c88", + column: x => x.listid, + principalTable: "lists", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "account_warnings", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true), + targetaccountid = table.Column(name: "target_account_id", type: "bigint", nullable: true), + action = table.Column(type: "integer", nullable: false), + text = table.Column(type: "text", nullable: false, defaultValueSql: "''::text"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + reportid = table.Column(name: "report_id", type: "bigint", nullable: true), + statusids = table.Column(name: "status_ids", type: "character varying[]", nullable: true), + overruledat = table.Column(name: "overruled_at", type: "timestamp without time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("account_warnings_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_8f2bab4b16", + column: x => x.reportid, + principalTable: "reports", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_a65a1bf71b", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.SetNull); + table.ForeignKey( + name: "fk_rails_a7ebbb1e37", + column: x => x.targetaccountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "report_notes", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + content = table.Column(type: "text", nullable: false), + reportid = table.Column(name: "report_id", type: "bigint", nullable: false), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("report_notes_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_7fa83a61eb", + column: x => x.reportid, + principalTable: "reports", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_cae66353f3", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "bookmarks", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + statusid = table.Column(name: "status_id", type: "bigint", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("bookmarks_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_11207ffcfd", + column: x => x.statusid, + principalTable: "statuses", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_9f6ac182a6", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "custom_filter_statuses", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + customfilterid = table.Column(name: "custom_filter_id", type: "bigint", nullable: false), + statusid = table.Column(name: "status_id", type: "bigint", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp(6) without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp(6) without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("custom_filter_statuses_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_2f6d20c0cf", + column: x => x.statusid, + principalTable: "statuses", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_e2ddaf5b14", + column: x => x.customfilterid, + principalTable: "custom_filters", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "favourites", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + statusid = table.Column(name: "status_id", type: "bigint", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("favourites_pkey", x => x.id); + table.ForeignKey( + name: "fk_5eb6c2b873", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_b0e856845e", + column: x => x.statusid, + principalTable: "statuses", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "media_attachments", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false, defaultValueSql: "timestamp_id('media_attachments'::text)"), + statusid = table.Column(name: "status_id", type: "bigint", nullable: true), + filefilename = table.Column(name: "file_file_name", type: "character varying", nullable: true), + filecontenttype = table.Column(name: "file_content_type", type: "character varying", nullable: true), + filefilesize = table.Column(name: "file_file_size", type: "integer", nullable: true), + fileupdatedat = table.Column(name: "file_updated_at", type: "timestamp without time zone", nullable: true), + remoteurl = table.Column(name: "remote_url", type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + shortcode = table.Column(type: "character varying", nullable: true), + type = table.Column(type: "integer", nullable: false), + filemeta = table.Column(name: "file_meta", type: "json", nullable: true), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true), + description = table.Column(type: "text", nullable: true), + scheduledstatusid = table.Column(name: "scheduled_status_id", type: "bigint", nullable: true), + blurhash = table.Column(type: "character varying", nullable: true), + processing = table.Column(type: "integer", nullable: true), + filestorageschemaversion = table.Column(name: "file_storage_schema_version", type: "integer", nullable: true), + thumbnailfilename = table.Column(name: "thumbnail_file_name", type: "character varying", nullable: true), + thumbnailcontenttype = table.Column(name: "thumbnail_content_type", type: "character varying", nullable: true), + thumbnailfilesize = table.Column(name: "thumbnail_file_size", type: "integer", nullable: true), + thumbnailupdatedat = table.Column(name: "thumbnail_updated_at", type: "timestamp without time zone", nullable: true), + thumbnailremoteurl = table.Column(name: "thumbnail_remote_url", type: "character varying", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("media_attachments_pkey", x => x.id); + table.ForeignKey( + name: "fk_96dd81e81b", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.SetNull); + table.ForeignKey( + name: "fk_rails_31fc5aeef1", + column: x => x.scheduledstatusid, + principalTable: "scheduled_statuses", + principalColumn: "id", + onDelete: ReferentialAction.SetNull); + table.ForeignKey( + name: "fk_rails_3ec0cfdd70", + column: x => x.statusid, + principalTable: "statuses", + principalColumn: "id", + onDelete: ReferentialAction.SetNull); + }); + + migrationBuilder.CreateTable( + name: "mentions", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + statusid = table.Column(name: "status_id", type: "bigint", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true), + silent = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("mentions_pkey", x => x.id); + table.ForeignKey( + name: "fk_970d43f9d1", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_59edbe2887", + column: x => x.statusid, + principalTable: "statuses", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "polls", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true), + statusid = table.Column(name: "status_id", type: "bigint", nullable: true), + expiresat = table.Column(name: "expires_at", type: "timestamp without time zone", nullable: true), + options = table.Column(type: "character varying[]", nullable: false, defaultValueSql: "'{}'::character varying[]"), + cachedtallies = table.Column(name: "cached_tallies", type: "bigint[]", nullable: false, defaultValueSql: "'{}'::bigint[]"), + multiple = table.Column(type: "boolean", nullable: false), + hidetotals = table.Column(name: "hide_totals", type: "boolean", nullable: false), + votescount = table.Column(name: "votes_count", type: "bigint", nullable: false), + lastfetchedat = table.Column(name: "last_fetched_at", type: "timestamp without time zone", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + lockversion = table.Column(name: "lock_version", type: "integer", nullable: false), + voterscount = table.Column(name: "voters_count", type: "bigint", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("polls_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_3e0d9f1115", + column: x => x.statusid, + principalTable: "statuses", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_5b19a0c011", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "status_edits", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + statusid = table.Column(name: "status_id", type: "bigint", nullable: false), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true), + text = table.Column(type: "text", nullable: false, defaultValueSql: "''::text"), + spoilertext = table.Column(name: "spoiler_text", type: "text", nullable: false, defaultValueSql: "''::text"), + createdat = table.Column(name: "created_at", type: "timestamp(6) without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp(6) without time zone", nullable: false), + orderedmediaattachmentids = table.Column(name: "ordered_media_attachment_ids", type: "bigint[]", nullable: true), + mediadescriptions = table.Column(name: "media_descriptions", type: "text[]", nullable: true), + polloptions = table.Column(name: "poll_options", type: "character varying[]", nullable: true), + sensitive = table.Column(type: "boolean", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("status_edits_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_a960f234a0", + column: x => x.statusid, + principalTable: "statuses", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_dc8988c545", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.SetNull); + }); + + migrationBuilder.CreateTable( + name: "status_pins", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + statusid = table.Column(name: "status_id", type: "bigint", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false, defaultValueSql: "now()"), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false, defaultValueSql: "now()") + }, + constraints: table => + { + table.PrimaryKey("status_pins_pkey", x => x.id); + table.ForeignKey( + name: "fk_d4cb435b62", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_65c05552f1", + column: x => x.statusid, + principalTable: "statuses", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "status_stats", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + statusid = table.Column(name: "status_id", type: "bigint", nullable: false), + repliescount = table.Column(name: "replies_count", type: "bigint", nullable: false), + reblogscount = table.Column(name: "reblogs_count", type: "bigint", nullable: false), + favouritescount = table.Column(name: "favourites_count", type: "bigint", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("status_stats_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_4a247aac42", + column: x => x.statusid, + principalTable: "statuses", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "status_trends", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + statusid = table.Column(name: "status_id", type: "bigint", nullable: false), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + score = table.Column(type: "double precision", nullable: false), + rank = table.Column(type: "integer", nullable: false), + allowed = table.Column(type: "boolean", nullable: false), + language = table.Column(type: "character varying", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("status_trends_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_68c610dc1a", + column: x => x.statusid, + principalTable: "statuses", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_a6b527ea49", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "statuses_tags", + columns: table => new + { + statusid = table.Column(name: "status_id", type: "bigint", nullable: false), + tagid = table.Column(name: "tag_id", type: "bigint", nullable: false) + }, + constraints: table => + { + table.ForeignKey( + name: "fk_3081861e21", + column: x => x.tagid, + principalTable: "tags", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_df0fe11427", + column: x => x.statusid, + principalTable: "statuses", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "appeals", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + accountwarningid = table.Column(name: "account_warning_id", type: "bigint", nullable: false), + text = table.Column(type: "text", nullable: false, defaultValueSql: "''::text"), + approvedat = table.Column(name: "approved_at", type: "timestamp without time zone", nullable: true), + approvedbyaccountid = table.Column(name: "approved_by_account_id", type: "bigint", nullable: true), + rejectedat = table.Column(name: "rejected_at", type: "timestamp without time zone", nullable: true), + rejectedbyaccountid = table.Column(name: "rejected_by_account_id", type: "bigint", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp(6) without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp(6) without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("appeals_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_501c3a6e13", + column: x => x.rejectedbyaccountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.SetNull); + table.ForeignKey( + name: "fk_rails_9deb2f63ad", + column: x => x.approvedbyaccountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.SetNull); + table.ForeignKey( + name: "fk_rails_a99f14546e", + column: x => x.accountwarningid, + principalTable: "account_warnings", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_ea84881569", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "poll_votes", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true), + pollid = table.Column(name: "poll_id", type: "bigint", nullable: true), + choice = table.Column(type: "integer", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + uri = table.Column(type: "character varying", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("poll_votes_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_a6e6974b7e", + column: x => x.pollid, + principalTable: "polls", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_b6c18cf44a", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "backups", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + userid = table.Column(name: "user_id", type: "bigint", nullable: true), + dumpfilename = table.Column(name: "dump_file_name", type: "character varying", nullable: true), + dumpcontenttype = table.Column(name: "dump_content_type", type: "character varying", nullable: true), + dumpupdatedat = table.Column(name: "dump_updated_at", type: "timestamp without time zone", nullable: true), + processed = table.Column(type: "boolean", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + dumpfilesize = table.Column(name: "dump_file_size", type: "bigint", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("backups_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "devices", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + accesstokenid = table.Column(name: "access_token_id", type: "bigint", nullable: true), + accountid = table.Column(name: "account_id", type: "bigint", nullable: true), + deviceid = table.Column(name: "device_id", type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + name = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + fingerprintkey = table.Column(name: "fingerprint_key", type: "text", nullable: false, defaultValueSql: "''::text"), + identitykey = table.Column(name: "identity_key", type: "text", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("devices_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_a796b75798", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "encrypted_messages", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false, defaultValueSql: "timestamp_id('encrypted_messages'::text)"), + deviceid = table.Column(name: "device_id", type: "bigint", nullable: true), + fromaccountid = table.Column(name: "from_account_id", type: "bigint", nullable: true), + fromdeviceid = table.Column(name: "from_device_id", type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + type = table.Column(type: "integer", nullable: false), + body = table.Column(type: "text", nullable: false, defaultValueSql: "''::text"), + digest = table.Column(type: "text", nullable: false, defaultValueSql: "''::text"), + messagefranking = table.Column(name: "message_franking", type: "text", nullable: false, defaultValueSql: "''::text"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("encrypted_messages_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_a42ad0f8d5", + column: x => x.fromaccountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_a83e4df7ae", + column: x => x.deviceid, + principalTable: "devices", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "one_time_keys", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + deviceid = table.Column(name: "device_id", type: "bigint", nullable: true), + keyid = table.Column(name: "key_id", type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + key = table.Column(type: "text", nullable: false, defaultValueSql: "''::text"), + signature = table.Column(type: "text", nullable: false, defaultValueSql: "''::text"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("one_time_keys_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_d3edd8c878", + column: x => x.deviceid, + principalTable: "devices", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "identities", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + provider = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + uid = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + userid = table.Column(name: "user_id", type: "bigint", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("identities_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "invites", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + userid = table.Column(name: "user_id", type: "bigint", nullable: false), + code = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + expiresat = table.Column(name: "expires_at", type: "timestamp without time zone", nullable: true), + maxuses = table.Column(name: "max_uses", type: "integer", nullable: true), + uses = table.Column(type: "integer", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + autofollow = table.Column(type: "boolean", nullable: false), + comment = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("invites_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "login_activities", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + userid = table.Column(name: "user_id", type: "bigint", nullable: false), + authenticationmethod = table.Column(name: "authentication_method", type: "character varying", nullable: true), + provider = table.Column(type: "character varying", nullable: true), + success = table.Column(type: "boolean", nullable: true), + failurereason = table.Column(name: "failure_reason", type: "character varying", nullable: true), + ip = table.Column(type: "inet", nullable: true), + useragent = table.Column(name: "user_agent", type: "character varying", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("login_activities_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "markers", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + userid = table.Column(name: "user_id", type: "bigint", nullable: true), + timeline = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + lastreadid = table.Column(name: "last_read_id", type: "bigint", nullable: false), + lockversion = table.Column(name: "lock_version", type: "integer", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("markers_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "oauth_access_grants", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + token = table.Column(type: "character varying", nullable: false), + expiresin = table.Column(name: "expires_in", type: "integer", nullable: false), + redirecturi = table.Column(name: "redirect_uri", type: "text", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + revokedat = table.Column(name: "revoked_at", type: "timestamp without time zone", nullable: true), + scopes = table.Column(type: "character varying", nullable: true), + applicationid = table.Column(name: "application_id", type: "bigint", nullable: false), + resourceownerid = table.Column(name: "resource_owner_id", type: "bigint", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("oauth_access_grants_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "oauth_access_tokens", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + token = table.Column(type: "character varying", nullable: false), + refreshtoken = table.Column(name: "refresh_token", type: "character varying", nullable: true), + expiresin = table.Column(name: "expires_in", type: "integer", nullable: true), + revokedat = table.Column(name: "revoked_at", type: "timestamp without time zone", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + scopes = table.Column(type: "character varying", nullable: true), + applicationid = table.Column(name: "application_id", type: "bigint", nullable: true), + resourceownerid = table.Column(name: "resource_owner_id", type: "bigint", nullable: true), + lastusedat = table.Column(name: "last_used_at", type: "timestamp without time zone", nullable: true), + lastusedip = table.Column(name: "last_used_ip", type: "inet", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("oauth_access_tokens_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "oauth_applications", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + name = table.Column(type: "character varying", nullable: false), + uid = table.Column(type: "character varying", nullable: false), + secret = table.Column(type: "character varying", nullable: false), + redirecturi = table.Column(name: "redirect_uri", type: "text", nullable: false), + scopes = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: true), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: true), + superapp = table.Column(type: "boolean", nullable: false), + website = table.Column(type: "character varying", nullable: true), + ownertype = table.Column(name: "owner_type", type: "character varying", nullable: true), + ownerid = table.Column(name: "owner_id", type: "bigint", nullable: true), + confidential = table.Column(type: "boolean", nullable: false, defaultValueSql: "true") + }, + constraints: table => + { + table.PrimaryKey("oauth_applications_pkey", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "users", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + email = table.Column(type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + encryptedpassword = table.Column(name: "encrypted_password", type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + resetpasswordtoken = table.Column(name: "reset_password_token", type: "character varying", nullable: true), + resetpasswordsentat = table.Column(name: "reset_password_sent_at", type: "timestamp without time zone", nullable: true), + signincount = table.Column(name: "sign_in_count", type: "integer", nullable: false), + currentsigninat = table.Column(name: "current_sign_in_at", type: "timestamp without time zone", nullable: true), + lastsigninat = table.Column(name: "last_sign_in_at", type: "timestamp without time zone", nullable: true), + admin = table.Column(type: "boolean", nullable: false), + confirmationtoken = table.Column(name: "confirmation_token", type: "character varying", nullable: true), + confirmedat = table.Column(name: "confirmed_at", type: "timestamp without time zone", nullable: true), + confirmationsentat = table.Column(name: "confirmation_sent_at", type: "timestamp without time zone", nullable: true), + unconfirmedemail = table.Column(name: "unconfirmed_email", type: "character varying", nullable: true), + locale = table.Column(type: "character varying", nullable: true), + encryptedotpsecret = table.Column(name: "encrypted_otp_secret", type: "character varying", nullable: true), + encryptedotpsecretiv = table.Column(name: "encrypted_otp_secret_iv", type: "character varying", nullable: true), + encryptedotpsecretsalt = table.Column(name: "encrypted_otp_secret_salt", type: "character varying", nullable: true), + consumedtimestep = table.Column(name: "consumed_timestep", type: "integer", nullable: true), + otprequiredforlogin = table.Column(name: "otp_required_for_login", type: "boolean", nullable: false), + lastemailedat = table.Column(name: "last_emailed_at", type: "timestamp without time zone", nullable: true), + otpbackupcodes = table.Column(name: "otp_backup_codes", type: "character varying[]", nullable: true), + accountid = table.Column(name: "account_id", type: "bigint", nullable: false), + disabled = table.Column(type: "boolean", nullable: false), + moderator = table.Column(type: "boolean", nullable: false), + inviteid = table.Column(name: "invite_id", type: "bigint", nullable: true), + chosenlanguages = table.Column(name: "chosen_languages", type: "character varying[]", nullable: true), + createdbyapplicationid = table.Column(name: "created_by_application_id", type: "bigint", nullable: true), + approved = table.Column(type: "boolean", nullable: false, defaultValueSql: "true"), + signintoken = table.Column(name: "sign_in_token", type: "character varying", nullable: true), + signintokensentat = table.Column(name: "sign_in_token_sent_at", type: "timestamp without time zone", nullable: true), + webauthnid = table.Column(name: "webauthn_id", type: "character varying", nullable: true), + signupip = table.Column(name: "sign_up_ip", type: "inet", nullable: true), + skipsignintoken = table.Column(name: "skip_sign_in_token", type: "boolean", nullable: true), + roleid = table.Column(name: "role_id", type: "bigint", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("users_pkey", x => x.id); + table.ForeignKey( + name: "fk_50500f500d", + column: x => x.accountid, + principalTable: "accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_642f17018b", + column: x => x.roleid, + principalTable: "user_roles", + principalColumn: "id", + onDelete: ReferentialAction.SetNull); + table.ForeignKey( + name: "fk_rails_8fb2a43e88", + column: x => x.inviteid, + principalTable: "invites", + principalColumn: "id", + onDelete: ReferentialAction.SetNull); + table.ForeignKey( + name: "fk_rails_ecc9536e7c", + column: x => x.createdbyapplicationid, + principalTable: "oauth_applications", + principalColumn: "id", + onDelete: ReferentialAction.SetNull); + }); + + migrationBuilder.CreateTable( + name: "session_activations", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + sessionid = table.Column(name: "session_id", type: "character varying", nullable: false), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + useragent = table.Column(name: "user_agent", type: "character varying", nullable: false, defaultValueSql: "''::character varying"), + ip = table.Column(type: "inet", nullable: true), + accesstokenid = table.Column(name: "access_token_id", type: "bigint", nullable: true), + userid = table.Column(name: "user_id", type: "bigint", nullable: false), + webpushsubscriptionid = table.Column(name: "web_push_subscription_id", type: "bigint", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("session_activations_pkey", x => x.id); + table.ForeignKey( + name: "fk_957e5bda89", + column: x => x.accesstokenid, + principalTable: "oauth_access_tokens", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_e5fda67334", + column: x => x.userid, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "user_invite_requests", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + userid = table.Column(name: "user_id", type: "bigint", nullable: true), + text = table.Column(type: "text", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("user_invite_requests_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_3773f15361", + column: x => x.userid, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "web_push_subscriptions", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + endpoint = table.Column(type: "character varying", nullable: false), + keyp256dh = table.Column(name: "key_p256dh", type: "character varying", nullable: false), + keyauth = table.Column(name: "key_auth", type: "character varying", nullable: false), + data = table.Column(type: "json", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + accesstokenid = table.Column(name: "access_token_id", type: "bigint", nullable: true), + userid = table.Column(name: "user_id", type: "bigint", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("web_push_subscriptions_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_751a9f390b", + column: x => x.accesstokenid, + principalTable: "oauth_access_tokens", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_rails_b006f28dac", + column: x => x.userid, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "web_settings", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + data = table.Column(type: "json", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false), + userid = table.Column(name: "user_id", type: "bigint", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("web_settings_pkey", x => x.id); + table.ForeignKey( + name: "fk_11910667b2", + column: x => x.userid, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "webauthn_credentials", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + externalid = table.Column(name: "external_id", type: "character varying", nullable: false), + publickey = table.Column(name: "public_key", type: "character varying", nullable: false), + nickname = table.Column(type: "character varying", nullable: false), + signcount = table.Column(name: "sign_count", type: "bigint", nullable: false), + userid = table.Column(name: "user_id", type: "bigint", nullable: true), + createdat = table.Column(name: "created_at", type: "timestamp without time zone", nullable: false), + updatedat = table.Column(name: "updated_at", type: "timestamp without time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("webauthn_credentials_pkey", x => x.id); + table.ForeignKey( + name: "fk_rails_a4355aef77", + column: x => x.userid, + principalTable: "users", + principalColumn: "id"); + }); + + migrationBuilder.Sql(AccountsSearchIndex); + + migrationBuilder.Sql(AccountsUsernameAndDomainLowerIndex); + + migrationBuilder.Sql(TagsNameLowerBtreeIndex); + + migrationBuilder.CreateIndex( + name: "index_ip_blocks_on_ip", + table: "ip_blocks", + column: "ip"); + + migrationBuilder.CreateIndex( + name: "index_account_aliases_on_account_id", + table: "account_aliases", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_account_conversations_on_conversation_id", + table: "account_conversations", + column: "conversation_id"); + + migrationBuilder.CreateIndex( + name: "index_unique_conversations", + table: "account_conversations", + columns: new[] { "account_id", "conversation_id", "participant_account_ids" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_account_deletion_requests_on_account_id", + table: "account_deletion_requests", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_account_domain_blocks_on_account_id_and_domain", + table: "account_domain_blocks", + columns: new[] { "account_id", "domain" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_account_migrations_on_account_id", + table: "account_migrations", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_account_migrations_on_target_account_id", + table: "account_migrations", + column: "target_account_id", + filter: "(target_account_id IS NOT NULL)"); + + migrationBuilder.CreateIndex( + name: "index_account_moderation_notes_on_account_id", + table: "account_moderation_notes", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_account_moderation_notes_on_target_account_id", + table: "account_moderation_notes", + column: "target_account_id"); + + migrationBuilder.CreateIndex( + name: "index_account_notes_on_account_id_and_target_account_id", + table: "account_notes", + columns: new[] { "account_id", "target_account_id" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_account_notes_on_target_account_id", + table: "account_notes", + column: "target_account_id"); + + migrationBuilder.CreateIndex( + name: "index_account_pins_on_account_id_and_target_account_id", + table: "account_pins", + columns: new[] { "account_id", "target_account_id" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_account_pins_on_target_account_id", + table: "account_pins", + column: "target_account_id"); + + migrationBuilder.CreateIndex( + name: "index_account_stats_on_account_id", + table: "account_stats", + column: "account_id", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_account_statuses_cleanup_policies_on_account_id", + table: "account_statuses_cleanup_policies", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_account_warnings_on_account_id", + table: "account_warnings", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_account_warnings_on_target_account_id", + table: "account_warnings", + column: "target_account_id"); + + migrationBuilder.CreateIndex( + name: "index_accounts_on_moved_to_account_id", + table: "accounts", + column: "moved_to_account_id", + filter: "(moved_to_account_id IS NOT NULL)"); + + migrationBuilder.CreateIndex( + name: "index_accounts_on_uri", + table: "accounts", + column: "uri"); + + migrationBuilder.CreateIndex( + name: "index_accounts_on_url", + table: "accounts", + column: "url", + filter: "(url IS NOT NULL)") + .Annotation("Npgsql:IndexOperators", new[] { "text_pattern_ops" }); + + migrationBuilder.CreateIndex( + name: "index_accounts_tags_on_account_id_and_tag_id", + table: "accounts_tags", + columns: new[] { "account_id", "tag_id" }); + + migrationBuilder.CreateIndex( + name: "index_accounts_tags_on_tag_id_and_account_id", + table: "accounts_tags", + columns: new[] { "tag_id", "account_id" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_admin_action_logs_on_account_id", + table: "admin_action_logs", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_admin_action_logs_on_target_type_and_target_id", + table: "admin_action_logs", + columns: new[] { "target_type", "target_id" }); + + migrationBuilder.CreateIndex( + name: "index_announcement_mutes_on_account_id_and_announcement_id", + table: "announcement_mutes", + columns: new[] { "account_id", "announcement_id" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_announcement_mutes_on_announcement_id", + table: "announcement_mutes", + column: "announcement_id"); + + migrationBuilder.CreateIndex( + name: "index_announcement_reactions_on_account_id_and_announcement_id", + table: "announcement_reactions", + columns: new[] { "account_id", "announcement_id", "name" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_announcement_reactions_on_announcement_id", + table: "announcement_reactions", + column: "announcement_id"); + + migrationBuilder.CreateIndex( + name: "index_announcement_reactions_on_custom_emoji_id", + table: "announcement_reactions", + column: "custom_emoji_id", + filter: "(custom_emoji_id IS NOT NULL)"); + + migrationBuilder.CreateIndex( + name: "index_appeals_on_account_id", + table: "appeals", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_appeals_on_account_warning_id", + table: "appeals", + column: "account_warning_id", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_appeals_on_approved_by_account_id", + table: "appeals", + column: "approved_by_account_id", + filter: "(approved_by_account_id IS NOT NULL)"); + + migrationBuilder.CreateIndex( + name: "index_appeals_on_rejected_by_account_id", + table: "appeals", + column: "rejected_by_account_id", + filter: "(rejected_by_account_id IS NOT NULL)"); + + migrationBuilder.CreateIndex( + name: "index_blocks_on_account_id_and_target_account_id", + table: "blocks", + columns: new[] { "account_id", "target_account_id" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_blocks_on_target_account_id", + table: "blocks", + column: "target_account_id"); + + migrationBuilder.CreateIndex( + name: "index_bookmarks_on_account_id_and_status_id", + table: "bookmarks", + columns: new[] { "account_id", "status_id" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_bookmarks_on_status_id", + table: "bookmarks", + column: "status_id"); + + migrationBuilder.CreateIndex( + name: "index_canonical_email_blocks_on_canonical_email_hash", + table: "canonical_email_blocks", + column: "canonical_email_hash", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_canonical_email_blocks_on_reference_account_id", + table: "canonical_email_blocks", + column: "reference_account_id"); + + migrationBuilder.CreateIndex( + name: "index_conversation_mutes_on_account_id_and_conversation_id", + table: "conversation_mutes", + columns: new[] { "account_id", "conversation_id" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_conversations_on_uri", + table: "conversations", + column: "uri", + unique: true, + filter: "(uri IS NOT NULL)") + .Annotation("Npgsql:IndexOperators", new[] { "text_pattern_ops" }); + + migrationBuilder.CreateIndex( + name: "index_custom_emoji_categories_on_name", + table: "custom_emoji_categories", + column: "name", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_custom_emojis_on_shortcode_and_domain", + table: "custom_emojis", + columns: new[] { "shortcode", "domain" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_custom_filter_keywords_on_custom_filter_id", + table: "custom_filter_keywords", + column: "custom_filter_id"); + + migrationBuilder.CreateIndex( + name: "index_custom_filter_statuses_on_custom_filter_id", + table: "custom_filter_statuses", + column: "custom_filter_id"); + + migrationBuilder.CreateIndex( + name: "index_custom_filter_statuses_on_status_id", + table: "custom_filter_statuses", + column: "status_id"); + + migrationBuilder.CreateIndex( + name: "index_custom_filters_on_account_id", + table: "custom_filters", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_devices_on_access_token_id", + table: "devices", + column: "access_token_id"); + + migrationBuilder.CreateIndex( + name: "index_devices_on_account_id", + table: "devices", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_domain_allows_on_domain", + table: "domain_allows", + column: "domain", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_domain_blocks_on_domain", + table: "domain_blocks", + column: "domain", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_email_domain_blocks_on_domain", + table: "email_domain_blocks", + column: "domain", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_encrypted_messages_on_device_id", + table: "encrypted_messages", + column: "device_id"); + + migrationBuilder.CreateIndex( + name: "index_encrypted_messages_on_from_account_id", + table: "encrypted_messages", + column: "from_account_id"); + + migrationBuilder.CreateIndex( + name: "index_favourites_on_account_id_and_id", + table: "favourites", + columns: new[] { "account_id", "id" }); + + migrationBuilder.CreateIndex( + name: "index_favourites_on_account_id_and_status_id", + table: "favourites", + columns: new[] { "account_id", "status_id" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_favourites_on_status_id", + table: "favourites", + column: "status_id"); + + migrationBuilder.CreateIndex( + name: "index_featured_tags_on_account_id_and_tag_id", + table: "featured_tags", + columns: new[] { "account_id", "tag_id" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_featured_tags_on_tag_id", + table: "featured_tags", + column: "tag_id"); + + migrationBuilder.CreateIndex( + name: "index_follow_recommendation_suppressions_on_account_id", + table: "follow_recommendation_suppressions", + column: "account_id", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_follow_requests_on_account_id_and_target_account_id", + table: "follow_requests", + columns: new[] { "account_id", "target_account_id" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_follows_on_account_id_and_target_account_id", + table: "follows", + columns: new[] { "account_id", "target_account_id" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_identities_on_user_id", + table: "identities", + column: "user_id"); + + migrationBuilder.CreateIndex( + name: "index_invites_on_code", + table: "invites", + column: "code", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_invites_on_user_id", + table: "invites", + column: "user_id"); + + migrationBuilder.CreateIndex( + name: "index_list_accounts_on_account_id_and_list_id", + table: "list_accounts", + columns: new[] { "account_id", "list_id" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_list_accounts_on_follow_id", + table: "list_accounts", + column: "follow_id", + filter: "(follow_id IS NOT NULL)"); + + migrationBuilder.CreateIndex( + name: "index_list_accounts_on_list_id_and_account_id", + table: "list_accounts", + columns: new[] { "list_id", "account_id" }); + + migrationBuilder.CreateIndex( + name: "index_lists_on_account_id", + table: "lists", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_login_activities_on_user_id", + table: "login_activities", + column: "user_id"); + + migrationBuilder.CreateIndex( + name: "index_markers_on_user_id_and_timeline", + table: "markers", + columns: new[] { "user_id", "timeline" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_media_attachments_on_account_id_and_status_id", + table: "media_attachments", + columns: new[] { "account_id", "status_id" }, + descending: new[] { false, true }); + + migrationBuilder.CreateIndex( + name: "index_media_attachments_on_scheduled_status_id", + table: "media_attachments", + column: "scheduled_status_id", + filter: "(scheduled_status_id IS NOT NULL)"); + + migrationBuilder.CreateIndex( + name: "index_media_attachments_on_shortcode", + table: "media_attachments", + column: "shortcode", + unique: true, + filter: "(shortcode IS NOT NULL)") + .Annotation("Npgsql:IndexOperators", new[] { "text_pattern_ops" }); + + migrationBuilder.CreateIndex( + name: "index_media_attachments_on_status_id", + table: "media_attachments", + column: "status_id"); + + migrationBuilder.CreateIndex( + name: "index_mentions_on_account_id_and_status_id", + table: "mentions", + columns: new[] { "account_id", "status_id" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_mentions_on_status_id", + table: "mentions", + column: "status_id"); + + migrationBuilder.CreateIndex( + name: "index_mutes_on_account_id_and_target_account_id", + table: "mutes", + columns: new[] { "account_id", "target_account_id" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_mutes_on_target_account_id", + table: "mutes", + column: "target_account_id"); + + migrationBuilder.CreateIndex( + name: "index_notifications_on_account_id_and_id_and_type", + table: "notifications", + columns: new[] { "account_id", "id", "type" }, + descending: new[] { false, true, false }); + + migrationBuilder.CreateIndex( + name: "index_notifications_on_activity_id_and_activity_type", + table: "notifications", + columns: new[] { "activity_id", "activity_type" }); + + migrationBuilder.CreateIndex( + name: "index_notifications_on_from_account_id", + table: "notifications", + column: "from_account_id"); + + migrationBuilder.CreateIndex( + name: "index_oauth_access_grants_on_resource_owner_id", + table: "oauth_access_grants", + column: "resource_owner_id"); + + migrationBuilder.CreateIndex( + name: "index_oauth_access_grants_on_token", + table: "oauth_access_grants", + column: "token", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_oauth_access_tokens_on_refresh_token", + table: "oauth_access_tokens", + column: "refresh_token", + unique: true, + filter: "(refresh_token IS NOT NULL)") + .Annotation("Npgsql:IndexOperators", new[] { "text_pattern_ops" }); + + migrationBuilder.CreateIndex( + name: "index_oauth_access_tokens_on_resource_owner_id", + table: "oauth_access_tokens", + column: "resource_owner_id", + filter: "(resource_owner_id IS NOT NULL)"); + + migrationBuilder.CreateIndex( + name: "index_oauth_access_tokens_on_token", + table: "oauth_access_tokens", + column: "token", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_oauth_applications_on_owner_id_and_owner_type", + table: "oauth_applications", + columns: new[] { "owner_id", "owner_type" }); + + migrationBuilder.CreateIndex( + name: "index_oauth_applications_on_uid", + table: "oauth_applications", + column: "uid", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_one_time_keys_on_device_id", + table: "one_time_keys", + column: "device_id"); + + migrationBuilder.CreateIndex( + name: "index_one_time_keys_on_key_id", + table: "one_time_keys", + column: "key_id"); + + migrationBuilder.CreateIndex( + name: "index_pghero_space_stats_on_database_and_captured_at", + table: "pghero_space_stats", + columns: new[] { "database", "captured_at" }); + + migrationBuilder.CreateIndex( + name: "index_poll_votes_on_account_id", + table: "poll_votes", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_poll_votes_on_poll_id", + table: "poll_votes", + column: "poll_id"); + + migrationBuilder.CreateIndex( + name: "index_polls_on_account_id", + table: "polls", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_polls_on_status_id", + table: "polls", + column: "status_id"); + + migrationBuilder.CreateIndex( + name: "index_preview_card_providers_on_domain", + table: "preview_card_providers", + column: "domain", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_preview_card_trends_on_preview_card_id", + table: "preview_card_trends", + column: "preview_card_id", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_preview_cards_on_url", + table: "preview_cards", + column: "url", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_preview_cards_statuses_on_status_id_and_preview_card_id", + table: "preview_cards_statuses", + columns: new[] { "status_id", "preview_card_id" }); + + migrationBuilder.CreateIndex( + name: "index_report_notes_on_account_id", + table: "report_notes", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_report_notes_on_report_id", + table: "report_notes", + column: "report_id"); + + migrationBuilder.CreateIndex( + name: "index_reports_on_account_id", + table: "reports", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_reports_on_action_taken_by_account_id", + table: "reports", + column: "action_taken_by_account_id", + filter: "(action_taken_by_account_id IS NOT NULL)"); + + migrationBuilder.CreateIndex( + name: "index_reports_on_assigned_account_id", + table: "reports", + column: "assigned_account_id", + filter: "(assigned_account_id IS NOT NULL)"); + + migrationBuilder.CreateIndex( + name: "index_reports_on_target_account_id", + table: "reports", + column: "target_account_id"); + + migrationBuilder.CreateIndex( + name: "index_scheduled_statuses_on_account_id", + table: "scheduled_statuses", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_scheduled_statuses_on_scheduled_at", + table: "scheduled_statuses", + column: "scheduled_at"); + + migrationBuilder.CreateIndex( + name: "index_session_activations_on_access_token_id", + table: "session_activations", + column: "access_token_id"); + + migrationBuilder.CreateIndex( + name: "index_session_activations_on_session_id", + table: "session_activations", + column: "session_id", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_session_activations_on_user_id", + table: "session_activations", + column: "user_id"); + + migrationBuilder.CreateIndex( + name: "index_settings_on_thing_type_and_thing_id_and_var", + table: "settings", + columns: new[] { "thing_type", "thing_id", "var" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_site_uploads_on_var", + table: "site_uploads", + column: "var", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_status_edits_on_account_id", + table: "status_edits", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_status_edits_on_status_id", + table: "status_edits", + column: "status_id"); + + migrationBuilder.CreateIndex( + name: "index_status_pins_on_account_id_and_status_id", + table: "status_pins", + columns: new[] { "account_id", "status_id" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_status_pins_on_status_id", + table: "status_pins", + column: "status_id"); + + migrationBuilder.CreateIndex( + name: "index_status_stats_on_status_id", + table: "status_stats", + column: "status_id", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_status_trends_on_account_id", + table: "status_trends", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_status_trends_on_status_id", + table: "status_trends", + column: "status_id", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_statuses_20190820", + table: "statuses", + columns: new[] { "account_id", "id", "visibility", "updated_at" }, + descending: new[] { false, true, false, false }, + filter: "(deleted_at IS NULL)"); + + migrationBuilder.CreateIndex( + name: "index_statuses_on_account_id", + table: "statuses", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_statuses_on_deleted_at", + table: "statuses", + column: "deleted_at", + filter: "(deleted_at IS NOT NULL)"); + + migrationBuilder.CreateIndex( + name: "index_statuses_on_in_reply_to_account_id", + table: "statuses", + column: "in_reply_to_account_id", + filter: "(in_reply_to_account_id IS NOT NULL)"); + + migrationBuilder.CreateIndex( + name: "index_statuses_on_in_reply_to_id", + table: "statuses", + column: "in_reply_to_id", + filter: "(in_reply_to_id IS NOT NULL)"); + + migrationBuilder.CreateIndex( + name: "index_statuses_on_reblog_of_id_and_account_id", + table: "statuses", + columns: new[] { "reblog_of_id", "account_id" }); + + migrationBuilder.CreateIndex( + name: "index_statuses_on_uri", + table: "statuses", + column: "uri", + unique: true, + filter: "(uri IS NOT NULL)") + .Annotation("Npgsql:IndexOperators", new[] { "text_pattern_ops" }); + + migrationBuilder.CreateIndex( + name: "index_statuses_public_20200119", + table: "statuses", + columns: new[] { "id", "account_id" }, + descending: new[] { true, false }, + filter: "((deleted_at IS NULL) AND (visibility = 0) AND (reblog_of_id IS NULL) AND ((NOT reply) OR (in_reply_to_account_id = account_id)))"); + + migrationBuilder.CreateIndex( + name: "index_statuses_tags_on_status_id", + table: "statuses_tags", + column: "status_id"); + + migrationBuilder.CreateIndex( + name: "index_statuses_tags_on_tag_id_and_status_id", + table: "statuses_tags", + columns: new[] { "tag_id", "status_id" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_tag_follows_on_account_id_and_tag_id", + table: "tag_follows", + columns: new[] { "account_id", "tag_id" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "index_tag_follows_on_tag_id", + table: "tag_follows", + column: "tag_id"); + + migrationBuilder.CreateIndex( + name: "index_tombstones_on_account_id", + table: "tombstones", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_tombstones_on_uri", + table: "tombstones", + column: "uri"); + + migrationBuilder.CreateIndex( + name: "index_unavailable_domains_on_domain", + table: "unavailable_domains", + column: "domain", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_user_invite_requests_on_user_id", + table: "user_invite_requests", + column: "user_id"); + + migrationBuilder.CreateIndex( + name: "index_users_on_account_id", + table: "users", + column: "account_id"); + + migrationBuilder.CreateIndex( + name: "index_users_on_confirmation_token", + table: "users", + column: "confirmation_token", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_users_on_created_by_application_id", + table: "users", + column: "created_by_application_id", + filter: "(created_by_application_id IS NOT NULL)"); + + migrationBuilder.CreateIndex( + name: "index_users_on_email", + table: "users", + column: "email", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_users_on_reset_password_token", + table: "users", + column: "reset_password_token", + unique: true, + filter: "(reset_password_token IS NOT NULL)") + .Annotation("Npgsql:IndexOperators", new[] { "text_pattern_ops" }); + + migrationBuilder.CreateIndex( + name: "index_users_on_role_id", + table: "users", + column: "role_id", + filter: "(role_id IS NOT NULL)"); + + migrationBuilder.CreateIndex( + name: "index_web_push_subscriptions_on_access_token_id", + table: "web_push_subscriptions", + column: "access_token_id", + filter: "(access_token_id IS NOT NULL)"); + + migrationBuilder.CreateIndex( + name: "index_web_push_subscriptions_on_user_id", + table: "web_push_subscriptions", + column: "user_id"); + + migrationBuilder.CreateIndex( + name: "index_web_settings_on_user_id", + table: "web_settings", + column: "user_id", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_webauthn_credentials_on_external_id", + table: "webauthn_credentials", + column: "external_id", + unique: true); + + migrationBuilder.CreateIndex( + name: "index_webauthn_credentials_on_user_id", + table: "webauthn_credentials", + column: "user_id"); + + migrationBuilder.CreateIndex( + name: "index_webhooks_on_url", + table: "webhooks", + column: "url", + unique: true); + + migrationBuilder.AddForeignKey( + name: "fk_rails_096669d221", + table: "backups", + column: "user_id", + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.SetNull); + + migrationBuilder.AddForeignKey( + name: "fk_rails_393f74df68", + table: "devices", + column: "access_token_id", + principalTable: "oauth_access_tokens", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "fk_bea040f377", + table: "identities", + column: "user_id", + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "fk_rails_ff69dbb2ac", + table: "invites", + column: "user_id", + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "fk_rails_e4b6396b41", + table: "login_activities", + column: "user_id", + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "fk_rails_a7009bc2b6", + table: "markers", + column: "user_id", + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "fk_34d54b0a33", + table: "oauth_access_grants", + column: "application_id", + principalTable: "oauth_applications", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "fk_63b044929b", + table: "oauth_access_grants", + column: "resource_owner_id", + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "fk_e84df68546", + table: "oauth_access_tokens", + column: "resource_owner_id", + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "fk_f5fc4c1ee3", + table: "oauth_access_tokens", + column: "application_id", + principalTable: "oauth_applications", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "fk_b0988c7c0a", + table: "oauth_applications", + column: "owner_id", + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.Sql(UserIpsView); + + migrationBuilder.Sql(AccountSummariesView); + + migrationBuilder.Sql(FollowRecommendationsView); + + migrationBuilder.Sql(InstancesView); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.Sql("DROP MATERIALIZED VIEW instances;"); + + migrationBuilder.Sql("DROP MATERIALIZED VIEW follow_recommendations;"); + + migrationBuilder.Sql("DROP MATERIALIZED VIEW account_summaries;"); + + migrationBuilder.Sql("DROP VIEW user_ips;"); + + migrationBuilder.DropForeignKey( + name: "fk_50500f500d", + table: "users"); + + migrationBuilder.DropForeignKey( + name: "fk_rails_ff69dbb2ac", + table: "invites"); + + migrationBuilder.DropForeignKey( + name: "fk_b0988c7c0a", + table: "oauth_applications"); + + migrationBuilder.DropTable( + name: "account_aliases"); + + migrationBuilder.DropTable( + name: "account_conversations"); + + migrationBuilder.DropTable( + name: "account_deletion_requests"); + + migrationBuilder.DropTable( + name: "account_domain_blocks"); + + migrationBuilder.DropTable( + name: "account_migrations"); + + migrationBuilder.DropTable( + name: "account_moderation_notes"); + + migrationBuilder.DropTable( + name: "account_notes"); + + migrationBuilder.DropTable( + name: "account_pins"); + + migrationBuilder.DropTable( + name: "account_stats"); + + migrationBuilder.DropTable( + name: "account_statuses_cleanup_policies"); + + migrationBuilder.DropTable( + name: "account_warning_presets"); + + migrationBuilder.DropTable( + name: "accounts_tags"); + + migrationBuilder.DropTable( + name: "admin_action_logs"); + + migrationBuilder.DropTable( + name: "announcement_mutes"); + + migrationBuilder.DropTable( + name: "announcement_reactions"); + + migrationBuilder.DropTable( + name: "appeals"); + + migrationBuilder.DropTable( + name: "ar_internal_metadata"); + + migrationBuilder.DropTable( + name: "backups"); + + migrationBuilder.DropTable( + name: "blocks"); + + migrationBuilder.DropTable( + name: "bookmarks"); + + migrationBuilder.DropTable( + name: "canonical_email_blocks"); + + migrationBuilder.DropTable( + name: "conversation_mutes"); + + migrationBuilder.DropTable( + name: "custom_emoji_categories"); + + migrationBuilder.DropTable( + name: "custom_filter_keywords"); + + migrationBuilder.DropTable( + name: "custom_filter_statuses"); + + migrationBuilder.DropTable( + name: "domain_allows"); + + migrationBuilder.DropTable( + name: "domain_blocks"); + + migrationBuilder.DropTable( + name: "email_domain_blocks"); + + migrationBuilder.DropTable( + name: "encrypted_messages"); + + migrationBuilder.DropTable( + name: "favourites"); + + migrationBuilder.DropTable( + name: "featured_tags"); + + migrationBuilder.DropTable( + name: "follow_recommendation_suppressions"); + + migrationBuilder.DropTable( + name: "follow_requests"); + + migrationBuilder.DropTable( + name: "identities"); + + migrationBuilder.DropTable( + name: "imports"); + + migrationBuilder.DropTable( + name: "ip_blocks"); + + migrationBuilder.DropTable( + name: "list_accounts"); + + migrationBuilder.DropTable( + name: "login_activities"); + + migrationBuilder.DropTable( + name: "markers"); + + migrationBuilder.DropTable( + name: "media_attachments"); + + migrationBuilder.DropTable( + name: "mentions"); + + migrationBuilder.DropTable( + name: "mutes"); + + migrationBuilder.DropTable( + name: "notifications"); + + migrationBuilder.DropTable( + name: "oauth_access_grants"); + + migrationBuilder.DropTable( + name: "one_time_keys"); + + migrationBuilder.DropTable( + name: "pghero_space_stats"); + + migrationBuilder.DropTable( + name: "poll_votes"); + + migrationBuilder.DropTable( + name: "preview_card_providers"); + + migrationBuilder.DropTable( + name: "preview_card_trends"); + + migrationBuilder.DropTable( + name: "preview_cards_statuses"); + + migrationBuilder.DropTable( + name: "relays"); + + migrationBuilder.DropTable( + name: "report_notes"); + + migrationBuilder.DropTable( + name: "rules"); + + migrationBuilder.DropTable( + name: "session_activations"); + + migrationBuilder.DropTable( + name: "settings"); + + migrationBuilder.DropTable( + name: "site_uploads"); + + migrationBuilder.DropTable( + name: "status_edits"); + + migrationBuilder.DropTable( + name: "status_pins"); + + migrationBuilder.DropTable( + name: "status_stats"); + + migrationBuilder.DropTable( + name: "status_trends"); + + migrationBuilder.DropTable( + name: "statuses_tags"); + + migrationBuilder.DropTable( + name: "system_keys"); + + migrationBuilder.DropTable( + name: "tag_follows"); + + migrationBuilder.DropTable( + name: "tombstones"); + + migrationBuilder.DropTable( + name: "unavailable_domains"); + + migrationBuilder.DropTable( + name: "user_invite_requests"); + + migrationBuilder.DropTable( + name: "web_push_subscriptions"); + + migrationBuilder.DropTable( + name: "web_settings"); + + migrationBuilder.DropTable( + name: "webauthn_credentials"); + + migrationBuilder.DropTable( + name: "webhooks"); + + migrationBuilder.DropTable( + name: "announcements"); + + migrationBuilder.DropTable( + name: "custom_emojis"); + + migrationBuilder.DropTable( + name: "account_warnings"); + + migrationBuilder.DropTable( + name: "conversations"); + + migrationBuilder.DropTable( + name: "custom_filters"); + + migrationBuilder.DropTable( + name: "follows"); + + migrationBuilder.DropTable( + name: "lists"); + + migrationBuilder.DropTable( + name: "scheduled_statuses"); + + migrationBuilder.DropTable( + name: "devices"); + + migrationBuilder.DropTable( + name: "polls"); + + migrationBuilder.DropTable( + name: "preview_cards"); + + migrationBuilder.DropTable( + name: "tags"); + + migrationBuilder.DropTable( + name: "reports"); + + migrationBuilder.DropTable( + name: "oauth_access_tokens"); + + migrationBuilder.DropTable( + name: "statuses"); + + migrationBuilder.DropTable( + name: "accounts"); + + migrationBuilder.DropTable( + name: "users"); + + migrationBuilder.DropTable( + name: "user_roles"); + + migrationBuilder.DropTable( + name: "invites"); + + migrationBuilder.DropTable( + name: "oauth_applications"); + + migrationBuilder.DropSequence( + name: "accounts_id_seq"); + + migrationBuilder.DropSequence( + name: "encrypted_messages_id_seq"); + + migrationBuilder.DropSequence( + name: "media_attachments_id_seq"); + + migrationBuilder.DropSequence( + name: "statuses_id_seq"); + + migrationBuilder.Sql("drop function timestamp_id(text)"); + } + } +} diff --git a/src/Infrastructure/Persistence/Migrations/SmilodonDbContextModelSnapshot.cs b/src/Infrastructure/Persistence/Migrations/SmilodonDbContextModelSnapshot.cs new file mode 100644 index 0000000..fbf429a --- /dev/null +++ b/src/Infrastructure/Persistence/Migrations/SmilodonDbContextModelSnapshot.cs @@ -0,0 +1,6493 @@ +// +using System; +using System.Net; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using Smilodon.Infrastructure.Persistence; + +#nullable disable + +namespace Smilodon.Infrastructure.Persistence.Migrations +{ + [DbContext(typeof(SmilodonDbContext))] + partial class SmilodonDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "plpgsql"); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.HasSequence("accounts_id_seq"); + + modelBuilder.HasSequence("encrypted_messages_id_seq"); + + modelBuilder.HasSequence("media_attachments_id_seq"); + + modelBuilder.HasSequence("statuses_id_seq"); + + modelBuilder.Entity("Smilodon.Domain.Models.Account", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id") + .HasDefaultValueSql("timestamp_id('accounts'::text)"); + + b.Property("ActorType") + .HasColumnType("character varying") + .HasColumnName("actor_type"); + + b.Property("AlsoKnownAs") + .HasColumnType("character varying[]") + .HasColumnName("also_known_as"); + + b.Property("AvatarContentType") + .HasColumnType("character varying") + .HasColumnName("avatar_content_type"); + + b.Property("AvatarFileName") + .HasColumnType("character varying") + .HasColumnName("avatar_file_name"); + + b.Property("AvatarFileSize") + .HasColumnType("integer") + .HasColumnName("avatar_file_size"); + + b.Property("AvatarRemoteUrl") + .HasColumnType("character varying") + .HasColumnName("avatar_remote_url"); + + b.Property("AvatarStorageSchemaVersion") + .HasColumnType("integer") + .HasColumnName("avatar_storage_schema_version"); + + b.Property("AvatarUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("avatar_updated_at"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("DevicesUrl") + .HasColumnType("character varying") + .HasColumnName("devices_url"); + + b.Property("Discoverable") + .HasColumnType("boolean") + .HasColumnName("discoverable"); + + b.Property("DisplayName") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("display_name") + .HasDefaultValueSql("''::character varying"); + + b.Property("Domain") + .HasColumnType("character varying") + .HasColumnName("domain"); + + b.Property("FeaturedCollectionUrl") + .HasColumnType("character varying") + .HasColumnName("featured_collection_url"); + + b.Property("Fields") + .HasColumnType("jsonb") + .HasColumnName("fields"); + + b.Property("FollowersUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("followers_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("HeaderContentType") + .HasColumnType("character varying") + .HasColumnName("header_content_type"); + + b.Property("HeaderFileName") + .HasColumnType("character varying") + .HasColumnName("header_file_name"); + + b.Property("HeaderFileSize") + .HasColumnType("integer") + .HasColumnName("header_file_size"); + + b.Property("HeaderRemoteUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("header_remote_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("HeaderStorageSchemaVersion") + .HasColumnType("integer") + .HasColumnName("header_storage_schema_version"); + + b.Property("HeaderUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("header_updated_at"); + + b.Property("HideCollections") + .HasColumnType("boolean") + .HasColumnName("hide_collections"); + + b.Property("InboxUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("inbox_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("LastWebfingeredAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_webfingered_at"); + + b.Property("Locked") + .HasColumnType("boolean") + .HasColumnName("locked"); + + b.Property("Memorial") + .HasColumnType("boolean") + .HasColumnName("memorial"); + + b.Property("MovedToAccountId") + .HasColumnType("bigint") + .HasColumnName("moved_to_account_id"); + + b.Property("Note") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("note") + .HasDefaultValueSql("''::text"); + + b.Property("OutboxUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("outbox_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("PrivateKey") + .HasColumnType("text") + .HasColumnName("private_key"); + + b.Property("Protocol") + .HasColumnType("integer") + .HasColumnName("protocol"); + + b.Property("PublicKey") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("public_key") + .HasDefaultValueSql("''::text"); + + b.Property("RequestedReviewAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("requested_review_at"); + + b.Property("ReviewedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("reviewed_at"); + + b.Property("SensitizedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("sensitized_at"); + + b.Property("SharedInboxUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("shared_inbox_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("SilencedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("silenced_at"); + + b.Property("SuspendedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("suspended_at"); + + b.Property("SuspensionOrigin") + .HasColumnType("integer") + .HasColumnName("suspension_origin"); + + b.Property("Trendable") + .HasColumnType("boolean") + .HasColumnName("trendable"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("uri") + .HasDefaultValueSql("''::character varying"); + + b.Property("Url") + .HasColumnType("character varying") + .HasColumnName("url"); + + b.Property("Username") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("username") + .HasDefaultValueSql("''::character varying"); + + b.HasKey("Id") + .HasName("accounts_pkey"); + + b.HasIndex("MovedToAccountId") + .HasDatabaseName("index_accounts_on_moved_to_account_id") + .HasFilter("(moved_to_account_id IS NOT NULL)"); + + b.HasIndex("Uri") + .HasDatabaseName("index_accounts_on_uri"); + + b.HasIndex("Url") + .HasDatabaseName("index_accounts_on_url") + .HasFilter("(url IS NOT NULL)"); + + NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex("Url"), new[] { "text_pattern_ops" }); + + b.ToTable("accounts", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountAlias", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Acct") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("acct") + .HasDefaultValueSql("''::character varying"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("uri") + .HasDefaultValueSql("''::character varying"); + + b.HasKey("Id") + .HasName("account_aliases_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_account_aliases_on_account_id"); + + b.ToTable("account_aliases", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountConversation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("ConversationId") + .HasColumnType("bigint") + .HasColumnName("conversation_id"); + + b.Property("LastStatusId") + .HasColumnType("bigint") + .HasColumnName("last_status_id"); + + b.Property("LockVersion") + .HasColumnType("integer") + .HasColumnName("lock_version"); + + b.Property("ParticipantAccountIds") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("bigint[]") + .HasColumnName("participant_account_ids") + .HasDefaultValueSql("'{}'::bigint[]"); + + b.Property("StatusIds") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("bigint[]") + .HasColumnName("status_ids") + .HasDefaultValueSql("'{}'::bigint[]"); + + b.Property("Unread") + .HasColumnType("boolean") + .HasColumnName("unread"); + + b.HasKey("Id") + .HasName("account_conversations_pkey"); + + b.HasIndex("ConversationId") + .HasDatabaseName("index_account_conversations_on_conversation_id"); + + b.HasIndex("AccountId", "ConversationId", "ParticipantAccountIds") + .IsUnique() + .HasDatabaseName("index_unique_conversations"); + + b.ToTable("account_conversations", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountDeletionRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_deletion_requests_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_account_deletion_requests_on_account_id"); + + b.ToTable("account_deletion_requests", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountDomainBlock", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Domain") + .HasColumnType("character varying") + .HasColumnName("domain"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_domain_blocks_pkey"); + + b.HasIndex("AccountId", "Domain") + .IsUnique() + .HasDatabaseName("index_account_domain_blocks_on_account_id_and_domain"); + + b.ToTable("account_domain_blocks", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountMigration", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Acct") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("acct") + .HasDefaultValueSql("''::character varying"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("FollowersCount") + .HasColumnType("bigint") + .HasColumnName("followers_count"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_migrations_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_account_migrations_on_account_id"); + + b.HasIndex("TargetAccountId") + .HasDatabaseName("index_account_migrations_on_target_account_id") + .HasFilter("(target_account_id IS NOT NULL)"); + + b.ToTable("account_migrations", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountModerationNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Content") + .IsRequired() + .HasColumnType("text") + .HasColumnName("content"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_moderation_notes_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_account_moderation_notes_on_account_id"); + + b.HasIndex("TargetAccountId") + .HasDatabaseName("index_account_moderation_notes_on_target_account_id"); + + b.ToTable("account_moderation_notes", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("text") + .HasColumnName("comment"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_notes_pkey"); + + b.HasIndex("TargetAccountId") + .HasDatabaseName("index_account_notes_on_target_account_id"); + + b.HasIndex("AccountId", "TargetAccountId") + .IsUnique() + .HasDatabaseName("index_account_notes_on_account_id_and_target_account_id"); + + b.ToTable("account_notes", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountPin", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_pins_pkey"); + + b.HasIndex("TargetAccountId") + .HasDatabaseName("index_account_pins_on_target_account_id"); + + b.HasIndex("AccountId", "TargetAccountId") + .IsUnique() + .HasDatabaseName("index_account_pins_on_account_id_and_target_account_id"); + + b.ToTable("account_pins", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountStat", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("FollowersCount") + .HasColumnType("bigint") + .HasColumnName("followers_count"); + + b.Property("FollowingCount") + .HasColumnType("bigint") + .HasColumnName("following_count"); + + b.Property("LastStatusAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_status_at"); + + b.Property("StatusesCount") + .HasColumnType("bigint") + .HasColumnName("statuses_count"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_stats_pkey"); + + b.HasIndex("AccountId") + .IsUnique() + .HasDatabaseName("index_account_stats_on_account_id"); + + b.ToTable("account_stats", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountStatusesCleanupPolicy", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("Enabled") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("enabled") + .HasDefaultValueSql("true"); + + b.Property("KeepDirect") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("keep_direct") + .HasDefaultValueSql("true"); + + b.Property("KeepMedia") + .HasColumnType("boolean") + .HasColumnName("keep_media"); + + b.Property("KeepPinned") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("keep_pinned") + .HasDefaultValueSql("true"); + + b.Property("KeepPolls") + .HasColumnType("boolean") + .HasColumnName("keep_polls"); + + b.Property("KeepSelfBookmark") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("keep_self_bookmark") + .HasDefaultValueSql("true"); + + b.Property("KeepSelfFav") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("keep_self_fav") + .HasDefaultValueSql("true"); + + b.Property("MinFavs") + .HasColumnType("integer") + .HasColumnName("min_favs"); + + b.Property("MinReblogs") + .HasColumnType("integer") + .HasColumnName("min_reblogs"); + + b.Property("MinStatusAge") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("min_status_age") + .HasDefaultValueSql("1209600"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_statuses_cleanup_policies_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_account_statuses_cleanup_policies_on_account_id"); + + b.ToTable("account_statuses_cleanup_policies", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountSummary", b => + { + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Language") + .HasColumnType("character varying") + .HasColumnName("language"); + + b.Property("Sensitive") + .HasColumnType("boolean") + .HasColumnName("sensitive"); + + b.ToTable((string)null); + + b.ToView("account_summaries", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountTag", b => + { + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("TagId") + .HasColumnType("bigint") + .HasColumnName("tag_id"); + + b.HasIndex("AccountId", "TagId") + .HasDatabaseName("index_accounts_tags_on_account_id_and_tag_id"); + + b.HasIndex("TagId", "AccountId") + .IsUnique() + .HasDatabaseName("index_accounts_tags_on_tag_id_and_account_id"); + + b.ToTable("accounts_tags", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountWarning", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Action") + .HasColumnType("integer") + .HasColumnName("action"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("OverruledAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("overruled_at"); + + b.Property("ReportId") + .HasColumnType("bigint") + .HasColumnName("report_id"); + + b.Property("StatusIds") + .HasColumnType("character varying[]") + .HasColumnName("status_ids"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("Text") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_warnings_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_account_warnings_on_account_id"); + + b.HasIndex("ReportId") + .HasDatabaseName("ix_account_warnings_report_id"); + + b.HasIndex("TargetAccountId") + .HasDatabaseName("index_account_warnings_on_target_account_id"); + + b.ToTable("account_warnings", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountWarningPreset", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Text") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + b.Property("Title") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("title") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("account_warning_presets_pkey"); + + b.ToTable("account_warning_presets", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AdminActionLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Action") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("action") + .HasDefaultValueSql("''::character varying"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("HumanIdentifier") + .HasColumnType("character varying") + .HasColumnName("human_identifier"); + + b.Property("Permalink") + .HasColumnType("character varying") + .HasColumnName("permalink"); + + b.Property("RouteParam") + .HasColumnType("character varying") + .HasColumnName("route_param"); + + b.Property("TargetId") + .HasColumnType("bigint") + .HasColumnName("target_id"); + + b.Property("TargetType") + .HasColumnType("character varying") + .HasColumnName("target_type"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("admin_action_logs_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_admin_action_logs_on_account_id"); + + b.HasIndex("TargetType", "TargetId") + .HasDatabaseName("index_admin_action_logs_on_target_type_and_target_id"); + + b.ToTable("admin_action_logs", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Announcement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AllDay") + .HasColumnType("boolean") + .HasColumnName("all_day"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("EndsAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("ends_at"); + + b.Property("Published") + .HasColumnType("boolean") + .HasColumnName("published"); + + b.Property("PublishedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("published_at"); + + b.Property("ScheduledAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("scheduled_at"); + + b.Property("StartsAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("starts_at"); + + b.Property("StatusIds") + .HasColumnType("bigint[]") + .HasColumnName("status_ids"); + + b.Property("Text") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("announcements_pkey"); + + b.ToTable("announcements", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AnnouncementMute", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("AnnouncementId") + .HasColumnType("bigint") + .HasColumnName("announcement_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("announcement_mutes_pkey"); + + b.HasIndex("AnnouncementId") + .HasDatabaseName("index_announcement_mutes_on_announcement_id"); + + b.HasIndex("AccountId", "AnnouncementId") + .IsUnique() + .HasDatabaseName("index_announcement_mutes_on_account_id_and_announcement_id"); + + b.ToTable("announcement_mutes", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AnnouncementReaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("AnnouncementId") + .HasColumnType("bigint") + .HasColumnName("announcement_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("CustomEmojiId") + .HasColumnType("bigint") + .HasColumnName("custom_emoji_id"); + + b.Property("Name") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("name") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("announcement_reactions_pkey"); + + b.HasIndex("AnnouncementId") + .HasDatabaseName("index_announcement_reactions_on_announcement_id"); + + b.HasIndex("CustomEmojiId") + .HasDatabaseName("index_announcement_reactions_on_custom_emoji_id") + .HasFilter("(custom_emoji_id IS NOT NULL)"); + + b.HasIndex("AccountId", "AnnouncementId", "Name") + .IsUnique() + .HasDatabaseName("index_announcement_reactions_on_account_id_and_announcement_id"); + + b.ToTable("announcement_reactions", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Appeal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("AccountWarningId") + .HasColumnType("bigint") + .HasColumnName("account_warning_id"); + + b.Property("ApprovedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("approved_at"); + + b.Property("ApprovedByAccountId") + .HasColumnType("bigint") + .HasColumnName("approved_by_account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("RejectedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("rejected_at"); + + b.Property("RejectedByAccountId") + .HasColumnType("bigint") + .HasColumnName("rejected_by_account_id"); + + b.Property("Text") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("appeals_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_appeals_on_account_id"); + + b.HasIndex("AccountWarningId") + .IsUnique() + .HasDatabaseName("index_appeals_on_account_warning_id"); + + b.HasIndex("ApprovedByAccountId") + .HasDatabaseName("index_appeals_on_approved_by_account_id") + .HasFilter("(approved_by_account_id IS NOT NULL)"); + + b.HasIndex("RejectedByAccountId") + .HasDatabaseName("index_appeals_on_rejected_by_account_id") + .HasFilter("(rejected_by_account_id IS NOT NULL)"); + + b.ToTable("appeals", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ArInternalMetadatum", b => + { + b.Property("Key") + .HasColumnType("character varying") + .HasColumnName("key"); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.Property("Value") + .HasColumnType("character varying") + .HasColumnName("value"); + + b.HasKey("Key") + .HasName("ar_internal_metadata_pkey"); + + b.ToTable("ar_internal_metadata", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Backup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("DumpContentType") + .HasColumnType("character varying") + .HasColumnName("dump_content_type"); + + b.Property("DumpFileName") + .HasColumnType("character varying") + .HasColumnName("dump_file_name"); + + b.Property("DumpFileSize") + .HasColumnType("bigint") + .HasColumnName("dump_file_size"); + + b.Property("DumpUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("dump_updated_at"); + + b.Property("Processed") + .HasColumnType("boolean") + .HasColumnName("processed"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("backups_pkey"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_backups_user_id"); + + b.ToTable("backups", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Block", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .HasColumnType("character varying") + .HasColumnName("uri"); + + b.HasKey("Id") + .HasName("blocks_pkey"); + + b.HasIndex("TargetAccountId") + .HasDatabaseName("index_blocks_on_target_account_id"); + + b.HasIndex("AccountId", "TargetAccountId") + .IsUnique() + .HasDatabaseName("index_blocks_on_account_id_and_target_account_id"); + + b.ToTable("blocks", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Bookmark", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("bookmarks_pkey"); + + b.HasIndex("StatusId") + .HasDatabaseName("index_bookmarks_on_status_id"); + + b.HasIndex("AccountId", "StatusId") + .IsUnique() + .HasDatabaseName("index_bookmarks_on_account_id_and_status_id"); + + b.ToTable("bookmarks", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CanonicalEmailBlock", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CanonicalEmailHash") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("canonical_email_hash") + .HasDefaultValueSql("''::character varying"); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("ReferenceAccountId") + .HasColumnType("bigint") + .HasColumnName("reference_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("canonical_email_blocks_pkey"); + + b.HasIndex("CanonicalEmailHash") + .IsUnique() + .HasDatabaseName("index_canonical_email_blocks_on_canonical_email_hash"); + + b.HasIndex("ReferenceAccountId") + .HasDatabaseName("index_canonical_email_blocks_on_reference_account_id"); + + b.ToTable("canonical_email_blocks", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Conversation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .HasColumnType("character varying") + .HasColumnName("uri"); + + b.HasKey("Id") + .HasName("conversations_pkey"); + + b.HasIndex("Uri") + .IsUnique() + .HasDatabaseName("index_conversations_on_uri") + .HasFilter("(uri IS NOT NULL)"); + + NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex("Uri"), new[] { "text_pattern_ops" }); + + b.ToTable("conversations", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ConversationMute", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("ConversationId") + .HasColumnType("bigint") + .HasColumnName("conversation_id"); + + b.HasKey("Id") + .HasName("conversation_mutes_pkey"); + + b.HasIndex("ConversationId") + .HasDatabaseName("ix_conversation_mutes_conversation_id"); + + b.HasIndex("AccountId", "ConversationId") + .IsUnique() + .HasDatabaseName("index_conversation_mutes_on_account_id_and_conversation_id"); + + b.ToTable("conversation_mutes", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomEmoji", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CategoryId") + .HasColumnType("bigint") + .HasColumnName("category_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Disabled") + .HasColumnType("boolean") + .HasColumnName("disabled"); + + b.Property("Domain") + .HasColumnType("character varying") + .HasColumnName("domain"); + + b.Property("ImageContentType") + .HasColumnType("character varying") + .HasColumnName("image_content_type"); + + b.Property("ImageFileName") + .HasColumnType("character varying") + .HasColumnName("image_file_name"); + + b.Property("ImageFileSize") + .HasColumnType("integer") + .HasColumnName("image_file_size"); + + b.Property("ImageRemoteUrl") + .HasColumnType("character varying") + .HasColumnName("image_remote_url"); + + b.Property("ImageStorageSchemaVersion") + .HasColumnType("integer") + .HasColumnName("image_storage_schema_version"); + + b.Property("ImageUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("image_updated_at"); + + b.Property("Shortcode") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("shortcode") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .HasColumnType("character varying") + .HasColumnName("uri"); + + b.Property("VisibleInPicker") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("visible_in_picker") + .HasDefaultValueSql("true"); + + b.HasKey("Id") + .HasName("custom_emojis_pkey"); + + b.HasIndex("Shortcode", "Domain") + .IsUnique() + .HasDatabaseName("index_custom_emojis_on_shortcode_and_domain"); + + b.ToTable("custom_emojis", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomEmojiCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Name") + .HasColumnType("character varying") + .HasColumnName("name"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("custom_emoji_categories_pkey"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("index_custom_emoji_categories_on_name"); + + b.ToTable("custom_emoji_categories", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomFilter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Action") + .HasColumnType("integer") + .HasColumnName("action"); + + b.Property("Context") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying[]") + .HasColumnName("context") + .HasDefaultValueSql("'{}'::character varying[]"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("expires_at"); + + b.Property("Phrase") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("phrase") + .HasDefaultValueSql("''::text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("custom_filters_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_custom_filters_on_account_id"); + + b.ToTable("custom_filters", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomFilterKeyword", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("CustomFilterId") + .HasColumnType("bigint") + .HasColumnName("custom_filter_id"); + + b.Property("Keyword") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("keyword") + .HasDefaultValueSql("''::text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.Property("WholeWord") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("whole_word") + .HasDefaultValueSql("true"); + + b.HasKey("Id") + .HasName("custom_filter_keywords_pkey"); + + b.HasIndex("CustomFilterId") + .HasDatabaseName("index_custom_filter_keywords_on_custom_filter_id"); + + b.ToTable("custom_filter_keywords", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomFilterStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("CustomFilterId") + .HasColumnType("bigint") + .HasColumnName("custom_filter_id"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("custom_filter_statuses_pkey"); + + b.HasIndex("CustomFilterId") + .HasDatabaseName("index_custom_filter_statuses_on_custom_filter_id"); + + b.HasIndex("StatusId") + .HasDatabaseName("index_custom_filter_statuses_on_status_id"); + + b.ToTable("custom_filter_statuses", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Device", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccessTokenId") + .HasColumnType("bigint") + .HasColumnName("access_token_id"); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("DeviceId") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("device_id") + .HasDefaultValueSql("''::character varying"); + + b.Property("FingerprintKey") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("fingerprint_key") + .HasDefaultValueSql("''::text"); + + b.Property("IdentityKey") + .IsRequired() + .HasColumnType("text") + .HasColumnName("identity_key"); + + b.Property("Name") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("name") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("devices_pkey"); + + b.HasIndex("AccessTokenId") + .HasDatabaseName("index_devices_on_access_token_id"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_devices_on_account_id"); + + b.ToTable("devices", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.DomainAllow", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Domain") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("domain") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("domain_allows_pkey"); + + b.HasIndex("Domain") + .IsUnique() + .HasDatabaseName("index_domain_allows_on_domain"); + + b.ToTable("domain_allows", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.DomainBlock", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Domain") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("domain") + .HasDefaultValueSql("''::character varying"); + + b.Property("Obfuscate") + .HasColumnType("boolean") + .HasColumnName("obfuscate"); + + b.Property("PrivateComment") + .HasColumnType("text") + .HasColumnName("private_comment"); + + b.Property("PublicComment") + .HasColumnType("text") + .HasColumnName("public_comment"); + + b.Property("RejectMedia") + .HasColumnType("boolean") + .HasColumnName("reject_media"); + + b.Property("RejectReports") + .HasColumnType("boolean") + .HasColumnName("reject_reports"); + + b.Property("Severity") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("severity") + .HasDefaultValueSql("0"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("domain_blocks_pkey"); + + b.HasIndex("Domain") + .IsUnique() + .HasDatabaseName("index_domain_blocks_on_domain"); + + b.ToTable("domain_blocks", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.EmailDomainBlock", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Domain") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("domain") + .HasDefaultValueSql("''::character varying"); + + b.Property("ParentId") + .HasColumnType("bigint") + .HasColumnName("parent_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("email_domain_blocks_pkey"); + + b.HasIndex("Domain") + .IsUnique() + .HasDatabaseName("index_email_domain_blocks_on_domain"); + + b.HasIndex("ParentId") + .HasDatabaseName("ix_email_domain_blocks_parent_id"); + + b.ToTable("email_domain_blocks", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.EncryptedMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id") + .HasDefaultValueSql("timestamp_id('encrypted_messages'::text)"); + + b.Property("Body") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("body") + .HasDefaultValueSql("''::text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("DeviceId") + .HasColumnType("bigint") + .HasColumnName("device_id"); + + b.Property("Digest") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("digest") + .HasDefaultValueSql("''::text"); + + b.Property("FromAccountId") + .HasColumnType("bigint") + .HasColumnName("from_account_id"); + + b.Property("FromDeviceId") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("from_device_id") + .HasDefaultValueSql("''::character varying"); + + b.Property("MessageFranking") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("message_franking") + .HasDefaultValueSql("''::text"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("encrypted_messages_pkey"); + + b.HasIndex("DeviceId") + .HasDatabaseName("index_encrypted_messages_on_device_id"); + + b.HasIndex("FromAccountId") + .HasDatabaseName("index_encrypted_messages_on_from_account_id"); + + b.ToTable("encrypted_messages", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Favourite", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("favourites_pkey"); + + b.HasIndex("StatusId") + .HasDatabaseName("index_favourites_on_status_id"); + + b.HasIndex("AccountId", "Id") + .HasDatabaseName("index_favourites_on_account_id_and_id"); + + b.HasIndex("AccountId", "StatusId") + .IsUnique() + .HasDatabaseName("index_favourites_on_account_id_and_status_id"); + + b.ToTable("favourites", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.FeaturedTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("LastStatusAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_status_at"); + + b.Property("Name") + .HasColumnType("character varying") + .HasColumnName("name"); + + b.Property("StatusesCount") + .HasColumnType("bigint") + .HasColumnName("statuses_count"); + + b.Property("TagId") + .HasColumnType("bigint") + .HasColumnName("tag_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("featured_tags_pkey"); + + b.HasIndex("TagId") + .HasDatabaseName("index_featured_tags_on_tag_id"); + + b.HasIndex("AccountId", "TagId") + .IsUnique() + .HasDatabaseName("index_featured_tags_on_account_id_and_tag_id"); + + b.ToTable("featured_tags", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Follow", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Languages") + .HasColumnType("character varying[]") + .HasColumnName("languages"); + + b.Property("Notify") + .HasColumnType("boolean") + .HasColumnName("notify"); + + b.Property("ShowReblogs") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("show_reblogs") + .HasDefaultValueSql("true"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .HasColumnType("character varying") + .HasColumnName("uri"); + + b.HasKey("Id") + .HasName("follows_pkey"); + + b.HasIndex("AccountId", "TargetAccountId") + .IsUnique() + .HasDatabaseName("index_follows_on_account_id_and_target_account_id"); + + b.HasIndex(new[] { "TargetAccountId" }, "index_follows_on_target_account_id") + .HasDatabaseName("ix_follows_target_account_id"); + + b.ToTable("follows", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.FollowRecommendation", b => + { + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Rank") + .HasColumnType("numeric") + .HasColumnName("rank"); + + b.Property("Reason") + .HasColumnType("text[]") + .HasColumnName("reason"); + + b.ToTable((string)null); + + b.ToView("follow_recommendations", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.FollowRecommendationSuppression", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("follow_recommendation_suppressions_pkey"); + + b.HasIndex("AccountId") + .IsUnique() + .HasDatabaseName("index_follow_recommendation_suppressions_on_account_id"); + + b.ToTable("follow_recommendation_suppressions", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.FollowRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Languages") + .HasColumnType("character varying[]") + .HasColumnName("languages"); + + b.Property("Notify") + .HasColumnType("boolean") + .HasColumnName("notify"); + + b.Property("ShowReblogs") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("show_reblogs") + .HasDefaultValueSql("true"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .HasColumnType("character varying") + .HasColumnName("uri"); + + b.HasKey("Id") + .HasName("follow_requests_pkey"); + + b.HasIndex("TargetAccountId") + .HasDatabaseName("ix_follow_requests_target_account_id"); + + b.HasIndex("AccountId", "TargetAccountId") + .IsUnique() + .HasDatabaseName("index_follow_requests_on_account_id_and_target_account_id"); + + b.ToTable("follow_requests", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Identity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Provider") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("provider") + .HasDefaultValueSql("''::character varying"); + + b.Property("Uid") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("uid") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("identities_pkey"); + + b.HasIndex("UserId") + .HasDatabaseName("index_identities_on_user_id"); + + b.ToTable("identities", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Import", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Approved") + .HasColumnType("boolean") + .HasColumnName("approved"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("DataContentType") + .HasColumnType("character varying") + .HasColumnName("data_content_type"); + + b.Property("DataFileName") + .HasColumnType("character varying") + .HasColumnName("data_file_name"); + + b.Property("DataFileSize") + .HasColumnType("integer") + .HasColumnName("data_file_size"); + + b.Property("DataUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("data_updated_at"); + + b.Property("Overwrite") + .HasColumnType("boolean") + .HasColumnName("overwrite"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("imports_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("ix_imports_account_id"); + + b.ToTable("imports", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Instance", b => + { + b.Property("AccountsCount") + .HasColumnType("bigint") + .HasColumnName("accounts_count"); + + b.Property("Domain") + .HasColumnType("character varying") + .HasColumnName("domain"); + + b.ToTable((string)null); + + b.ToView("instances", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Invite", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Autofollow") + .HasColumnType("boolean") + .HasColumnName("autofollow"); + + b.Property("Code") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("code") + .HasDefaultValueSql("''::character varying"); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("expires_at"); + + b.Property("MaxUses") + .HasColumnType("integer") + .HasColumnName("max_uses"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.Property("Uses") + .HasColumnType("integer") + .HasColumnName("uses"); + + b.HasKey("Id") + .HasName("invites_pkey"); + + b.HasIndex("Code") + .IsUnique() + .HasDatabaseName("index_invites_on_code"); + + b.HasIndex("UserId") + .HasDatabaseName("index_invites_on_user_id"); + + b.ToTable("invites", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.IpBlock", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Comment") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("comment") + .HasDefaultValueSql("''::text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("expires_at"); + + b.Property("Ip") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("inet") + .HasColumnName("ip") + .HasDefaultValueSql("'0.0.0.0'::inet"); + + b.Property("Severity") + .HasColumnType("integer") + .HasColumnName("severity"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("ip_blocks_pkey"); + + b.ToTable("ip_blocks", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.List", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("RepliesPolicy") + .HasColumnType("integer") + .HasColumnName("replies_policy"); + + b.Property("Title") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("title") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("lists_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_lists_on_account_id"); + + b.ToTable("lists", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ListAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("FollowId") + .HasColumnType("bigint") + .HasColumnName("follow_id"); + + b.Property("ListId") + .HasColumnType("bigint") + .HasColumnName("list_id"); + + b.HasKey("Id") + .HasName("list_accounts_pkey"); + + b.HasIndex("FollowId") + .HasDatabaseName("index_list_accounts_on_follow_id") + .HasFilter("(follow_id IS NOT NULL)"); + + b.HasIndex("AccountId", "ListId") + .IsUnique() + .HasDatabaseName("index_list_accounts_on_account_id_and_list_id"); + + b.HasIndex("ListId", "AccountId") + .HasDatabaseName("index_list_accounts_on_list_id_and_account_id"); + + b.ToTable("list_accounts", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.LoginActivity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AuthenticationMethod") + .HasColumnType("character varying") + .HasColumnName("authentication_method"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("FailureReason") + .HasColumnType("character varying") + .HasColumnName("failure_reason"); + + b.Property("Ip") + .HasColumnType("inet") + .HasColumnName("ip"); + + b.Property("Provider") + .HasColumnType("character varying") + .HasColumnName("provider"); + + b.Property("Success") + .HasColumnType("boolean") + .HasColumnName("success"); + + b.Property("UserAgent") + .HasColumnType("character varying") + .HasColumnName("user_agent"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("login_activities_pkey"); + + b.HasIndex("UserId") + .HasDatabaseName("index_login_activities_on_user_id"); + + b.ToTable("login_activities", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Marker", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("LastReadId") + .HasColumnType("bigint") + .HasColumnName("last_read_id"); + + b.Property("LockVersion") + .HasColumnType("integer") + .HasColumnName("lock_version"); + + b.Property("Timeline") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("timeline") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("markers_pkey"); + + b.HasIndex("UserId", "Timeline") + .IsUnique() + .HasDatabaseName("index_markers_on_user_id_and_timeline"); + + b.ToTable("markers", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.MediaAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id") + .HasDefaultValueSql("timestamp_id('media_attachments'::text)"); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Blurhash") + .HasColumnType("character varying") + .HasColumnName("blurhash"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("FileContentType") + .HasColumnType("character varying") + .HasColumnName("file_content_type"); + + b.Property("FileFileName") + .HasColumnType("character varying") + .HasColumnName("file_file_name"); + + b.Property("FileFileSize") + .HasColumnType("integer") + .HasColumnName("file_file_size"); + + b.Property("FileMeta") + .HasColumnType("json") + .HasColumnName("file_meta"); + + b.Property("FileStorageSchemaVersion") + .HasColumnType("integer") + .HasColumnName("file_storage_schema_version"); + + b.Property("FileUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("file_updated_at"); + + b.Property("Processing") + .HasColumnType("integer") + .HasColumnName("processing"); + + b.Property("RemoteUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("remote_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("ScheduledStatusId") + .HasColumnType("bigint") + .HasColumnName("scheduled_status_id"); + + b.Property("Shortcode") + .HasColumnType("character varying") + .HasColumnName("shortcode"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("ThumbnailContentType") + .HasColumnType("character varying") + .HasColumnName("thumbnail_content_type"); + + b.Property("ThumbnailFileName") + .HasColumnType("character varying") + .HasColumnName("thumbnail_file_name"); + + b.Property("ThumbnailFileSize") + .HasColumnType("integer") + .HasColumnName("thumbnail_file_size"); + + b.Property("ThumbnailRemoteUrl") + .HasColumnType("character varying") + .HasColumnName("thumbnail_remote_url"); + + b.Property("ThumbnailUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("thumbnail_updated_at"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("media_attachments_pkey"); + + b.HasIndex("ScheduledStatusId") + .HasDatabaseName("index_media_attachments_on_scheduled_status_id") + .HasFilter("(scheduled_status_id IS NOT NULL)"); + + b.HasIndex("Shortcode") + .IsUnique() + .HasDatabaseName("index_media_attachments_on_shortcode") + .HasFilter("(shortcode IS NOT NULL)"); + + NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex("Shortcode"), new[] { "text_pattern_ops" }); + + b.HasIndex("StatusId") + .HasDatabaseName("index_media_attachments_on_status_id"); + + b.HasIndex("AccountId", "StatusId") + .IsDescending(false, true) + .HasDatabaseName("index_media_attachments_on_account_id_and_status_id"); + + b.ToTable("media_attachments", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Mention", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Silent") + .HasColumnType("boolean") + .HasColumnName("silent"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("mentions_pkey"); + + b.HasIndex("StatusId") + .HasDatabaseName("index_mentions_on_status_id"); + + b.HasIndex("AccountId", "StatusId") + .IsUnique() + .HasDatabaseName("index_mentions_on_account_id_and_status_id"); + + b.ToTable("mentions", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Mute", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("expires_at"); + + b.Property("HideNotifications") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("hide_notifications") + .HasDefaultValueSql("true"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("mutes_pkey"); + + b.HasIndex("TargetAccountId") + .HasDatabaseName("index_mutes_on_target_account_id"); + + b.HasIndex("AccountId", "TargetAccountId") + .IsUnique() + .HasDatabaseName("index_mutes_on_account_id_and_target_account_id"); + + b.ToTable("mutes", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Notification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("ActivityId") + .HasColumnType("bigint") + .HasColumnName("activity_id"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("activity_type"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("FromAccountId") + .HasColumnType("bigint") + .HasColumnName("from_account_id"); + + b.Property("Type") + .HasColumnType("character varying") + .HasColumnName("type"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("notifications_pkey"); + + b.HasIndex("FromAccountId") + .HasDatabaseName("index_notifications_on_from_account_id"); + + b.HasIndex("ActivityId", "ActivityType") + .HasDatabaseName("index_notifications_on_activity_id_and_activity_type"); + + b.HasIndex("AccountId", "Id", "Type") + .IsDescending(false, true, false) + .HasDatabaseName("index_notifications_on_account_id_and_id_and_type"); + + b.ToTable("notifications", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OAuthAccessGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ApplicationId") + .HasColumnType("bigint") + .HasColumnName("application_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ExpiresIn") + .HasColumnType("integer") + .HasColumnName("expires_in"); + + b.Property("RedirectUri") + .IsRequired() + .HasColumnType("text") + .HasColumnName("redirect_uri"); + + b.Property("ResourceOwnerId") + .HasColumnType("bigint") + .HasColumnName("resource_owner_id"); + + b.Property("RevokedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("revoked_at"); + + b.Property("Scopes") + .HasColumnType("character varying") + .HasColumnName("scopes"); + + b.Property("Token") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("token"); + + b.HasKey("Id") + .HasName("oauth_access_grants_pkey"); + + b.HasIndex("ApplicationId") + .HasDatabaseName("ix_oauth_access_grants_application_id"); + + b.HasIndex("ResourceOwnerId") + .HasDatabaseName("index_oauth_access_grants_on_resource_owner_id"); + + b.HasIndex("Token") + .IsUnique() + .HasDatabaseName("index_oauth_access_grants_on_token"); + + b.ToTable("oauth_access_grants", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OAuthAccessToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ApplicationId") + .HasColumnType("bigint") + .HasColumnName("application_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ExpiresIn") + .HasColumnType("integer") + .HasColumnName("expires_in"); + + b.Property("LastUsedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_used_at"); + + b.Property("LastUsedIp") + .HasColumnType("inet") + .HasColumnName("last_used_ip"); + + b.Property("RefreshToken") + .HasColumnType("character varying") + .HasColumnName("refresh_token"); + + b.Property("ResourceOwnerId") + .HasColumnType("bigint") + .HasColumnName("resource_owner_id"); + + b.Property("RevokedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("revoked_at"); + + b.Property("Scopes") + .HasColumnType("character varying") + .HasColumnName("scopes"); + + b.Property("Token") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("token"); + + b.HasKey("Id") + .HasName("oauth_access_tokens_pkey"); + + b.HasIndex("ApplicationId") + .HasDatabaseName("ix_oauth_access_tokens_application_id"); + + b.HasIndex("RefreshToken") + .IsUnique() + .HasDatabaseName("index_oauth_access_tokens_on_refresh_token") + .HasFilter("(refresh_token IS NOT NULL)"); + + NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex("RefreshToken"), new[] { "text_pattern_ops" }); + + b.HasIndex("ResourceOwnerId") + .HasDatabaseName("index_oauth_access_tokens_on_resource_owner_id") + .HasFilter("(resource_owner_id IS NOT NULL)"); + + b.HasIndex("Token") + .IsUnique() + .HasDatabaseName("index_oauth_access_tokens_on_token"); + + b.ToTable("oauth_access_tokens", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OAuthApplication", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Confidential") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("confidential") + .HasDefaultValueSql("true"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Name") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("name"); + + b.Property("OwnerId") + .HasColumnType("bigint") + .HasColumnName("owner_id"); + + b.Property("OwnerType") + .HasColumnType("character varying") + .HasColumnName("owner_type"); + + b.Property("RedirectUri") + .IsRequired() + .HasColumnType("text") + .HasColumnName("redirect_uri"); + + b.Property("Scopes") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("scopes") + .HasDefaultValueSql("''::character varying"); + + b.Property("Secret") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("secret"); + + b.Property("Superapp") + .HasColumnType("boolean") + .HasColumnName("superapp"); + + b.Property("Uid") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("uid"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Website") + .HasColumnType("character varying") + .HasColumnName("website"); + + b.HasKey("Id") + .HasName("oauth_applications_pkey"); + + b.HasIndex("Uid") + .IsUnique() + .HasDatabaseName("index_oauth_applications_on_uid"); + + b.HasIndex("OwnerId", "OwnerType") + .HasDatabaseName("index_oauth_applications_on_owner_id_and_owner_type"); + + b.ToTable("oauth_applications", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OneTimeKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("DeviceId") + .HasColumnType("bigint") + .HasColumnName("device_id"); + + b.Property("Key") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("key") + .HasDefaultValueSql("''::text"); + + b.Property("KeyId") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("key_id") + .HasDefaultValueSql("''::character varying"); + + b.Property("Signature") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("signature") + .HasDefaultValueSql("''::text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("one_time_keys_pkey"); + + b.HasIndex("DeviceId") + .HasDatabaseName("index_one_time_keys_on_device_id"); + + b.HasIndex("KeyId") + .HasDatabaseName("index_one_time_keys_on_key_id"); + + b.ToTable("one_time_keys", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.PgheroSpaceStat", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CapturedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("captured_at"); + + b.Property("Database") + .HasColumnType("text") + .HasColumnName("database"); + + b.Property("Relation") + .HasColumnType("text") + .HasColumnName("relation"); + + b.Property("Schema") + .HasColumnType("text") + .HasColumnName("schema"); + + b.Property("Size") + .HasColumnType("bigint") + .HasColumnName("size"); + + b.HasKey("Id") + .HasName("pghero_space_stats_pkey"); + + b.HasIndex("Database", "CapturedAt") + .HasDatabaseName("index_pghero_space_stats_on_database_and_captured_at"); + + b.ToTable("pghero_space_stats", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Poll", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CachedTallies") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("bigint[]") + .HasColumnName("cached_tallies") + .HasDefaultValueSql("'{}'::bigint[]"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("expires_at"); + + b.Property("HideTotals") + .HasColumnType("boolean") + .HasColumnName("hide_totals"); + + b.Property("LastFetchedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_fetched_at"); + + b.Property("LockVersion") + .HasColumnType("integer") + .HasColumnName("lock_version"); + + b.Property("Multiple") + .HasColumnType("boolean") + .HasColumnName("multiple"); + + b.Property("Options") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying[]") + .HasColumnName("options") + .HasDefaultValueSql("'{}'::character varying[]"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("VotersCount") + .HasColumnType("bigint") + .HasColumnName("voters_count"); + + b.Property("VotesCount") + .HasColumnType("bigint") + .HasColumnName("votes_count"); + + b.HasKey("Id") + .HasName("polls_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_polls_on_account_id"); + + b.HasIndex("StatusId") + .HasDatabaseName("index_polls_on_status_id"); + + b.ToTable("polls", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.PollVote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Choice") + .HasColumnType("integer") + .HasColumnName("choice"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("PollId") + .HasColumnType("bigint") + .HasColumnName("poll_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .HasColumnType("character varying") + .HasColumnName("uri"); + + b.HasKey("Id") + .HasName("poll_votes_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_poll_votes_on_account_id"); + + b.HasIndex("PollId") + .HasDatabaseName("index_poll_votes_on_poll_id"); + + b.ToTable("poll_votes", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.PreviewCard", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AuthorName") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("author_name") + .HasDefaultValueSql("''::character varying"); + + b.Property("AuthorUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("author_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("Blurhash") + .HasColumnType("character varying") + .HasColumnName("blurhash"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Description") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("description") + .HasDefaultValueSql("''::character varying"); + + b.Property("EmbedUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("embed_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("Height") + .HasColumnType("integer") + .HasColumnName("height"); + + b.Property("Html") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("html") + .HasDefaultValueSql("''::text"); + + b.Property("ImageContentType") + .HasColumnType("character varying") + .HasColumnName("image_content_type"); + + b.Property("ImageFileName") + .HasColumnType("character varying") + .HasColumnName("image_file_name"); + + b.Property("ImageFileSize") + .HasColumnType("integer") + .HasColumnName("image_file_size"); + + b.Property("ImageStorageSchemaVersion") + .HasColumnType("integer") + .HasColumnName("image_storage_schema_version"); + + b.Property("ImageUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("image_updated_at"); + + b.Property("Language") + .HasColumnType("character varying") + .HasColumnName("language"); + + b.Property("LinkType") + .HasColumnType("integer") + .HasColumnName("link_type"); + + b.Property("MaxScore") + .HasColumnType("double precision") + .HasColumnName("max_score"); + + b.Property("MaxScoreAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("max_score_at"); + + b.Property("ProviderName") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("provider_name") + .HasDefaultValueSql("''::character varying"); + + b.Property("ProviderUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("provider_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("Title") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("title") + .HasDefaultValueSql("''::character varying"); + + b.Property("Trendable") + .HasColumnType("boolean") + .HasColumnName("trendable"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Url") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("url") + .HasDefaultValueSql("''::character varying"); + + b.Property("Width") + .HasColumnType("integer") + .HasColumnName("width"); + + b.HasKey("Id") + .HasName("preview_cards_pkey"); + + b.HasIndex("Url") + .IsUnique() + .HasDatabaseName("index_preview_cards_on_url"); + + b.ToTable("preview_cards", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.PreviewCardProvider", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("Domain") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("domain") + .HasDefaultValueSql("''::character varying"); + + b.Property("IconContentType") + .HasColumnType("character varying") + .HasColumnName("icon_content_type"); + + b.Property("IconFileName") + .HasColumnType("character varying") + .HasColumnName("icon_file_name"); + + b.Property("IconFileSize") + .HasColumnType("bigint") + .HasColumnName("icon_file_size"); + + b.Property("IconUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("icon_updated_at"); + + b.Property("RequestedReviewAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("requested_review_at"); + + b.Property("ReviewedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("reviewed_at"); + + b.Property("Trendable") + .HasColumnType("boolean") + .HasColumnName("trendable"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("preview_card_providers_pkey"); + + b.HasIndex("Domain") + .IsUnique() + .HasDatabaseName("index_preview_card_providers_on_domain"); + + b.ToTable("preview_card_providers", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.PreviewCardStatus", b => + { + b.Property("PreviewCardId") + .HasColumnType("bigint") + .HasColumnName("preview_card_id"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.HasIndex("StatusId", "PreviewCardId") + .HasDatabaseName("index_preview_cards_statuses_on_status_id_and_preview_card_id"); + + b.ToTable("preview_cards_statuses", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.PreviewCardTrend", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Allowed") + .HasColumnType("boolean") + .HasColumnName("allowed"); + + b.Property("Language") + .HasColumnType("character varying") + .HasColumnName("language"); + + b.Property("PreviewCardId") + .HasColumnType("bigint") + .HasColumnName("preview_card_id"); + + b.Property("Rank") + .HasColumnType("integer") + .HasColumnName("rank"); + + b.Property("Score") + .HasColumnType("double precision") + .HasColumnName("score"); + + b.HasKey("Id") + .HasName("preview_card_trends_pkey"); + + b.HasIndex("PreviewCardId") + .IsUnique() + .HasDatabaseName("index_preview_card_trends_on_preview_card_id"); + + b.ToTable("preview_card_trends", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Relay", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("FollowActivityId") + .HasColumnType("character varying") + .HasColumnName("follow_activity_id"); + + b.Property("InboxUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("inbox_url") + .HasDefaultValueSql("''::character varying"); + + b.Property("State") + .HasColumnType("integer") + .HasColumnName("state"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("relays_pkey"); + + b.ToTable("relays", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Report", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("ActionTakenAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("action_taken_at"); + + b.Property("ActionTakenByAccountId") + .HasColumnType("bigint") + .HasColumnName("action_taken_by_account_id"); + + b.Property("AssignedAccountId") + .HasColumnType("bigint") + .HasColumnName("assigned_account_id"); + + b.Property("Category") + .HasColumnType("integer") + .HasColumnName("category"); + + b.Property("Comment") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("comment") + .HasDefaultValueSql("''::text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Forwarded") + .HasColumnType("boolean") + .HasColumnName("forwarded"); + + b.Property("RuleIds") + .HasColumnType("bigint[]") + .HasColumnName("rule_ids"); + + b.Property("StatusIds") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("bigint[]") + .HasColumnName("status_ids") + .HasDefaultValueSql("'{}'::bigint[]"); + + b.Property("TargetAccountId") + .HasColumnType("bigint") + .HasColumnName("target_account_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .HasColumnType("character varying") + .HasColumnName("uri"); + + b.HasKey("Id") + .HasName("reports_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_reports_on_account_id"); + + b.HasIndex("ActionTakenByAccountId") + .HasDatabaseName("index_reports_on_action_taken_by_account_id") + .HasFilter("(action_taken_by_account_id IS NOT NULL)"); + + b.HasIndex("AssignedAccountId") + .HasDatabaseName("index_reports_on_assigned_account_id") + .HasFilter("(assigned_account_id IS NOT NULL)"); + + b.HasIndex("TargetAccountId") + .HasDatabaseName("index_reports_on_target_account_id"); + + b.ToTable("reports", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ReportNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Content") + .IsRequired() + .HasColumnType("text") + .HasColumnName("content"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ReportId") + .HasColumnType("bigint") + .HasColumnName("report_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("report_notes_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_report_notes_on_account_id"); + + b.HasIndex("ReportId") + .HasDatabaseName("index_report_notes_on_report_id"); + + b.ToTable("report_notes", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Rule", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("DeletedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("deleted_at"); + + b.Property("Priority") + .HasColumnType("integer") + .HasColumnName("priority"); + + b.Property("Text") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("rules_pkey"); + + b.ToTable("rules", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ScheduledStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Params") + .HasColumnType("jsonb") + .HasColumnName("params"); + + b.Property("ScheduledAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("scheduled_at"); + + b.HasKey("Id") + .HasName("scheduled_statuses_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_scheduled_statuses_on_account_id"); + + b.HasIndex("ScheduledAt") + .HasDatabaseName("index_scheduled_statuses_on_scheduled_at"); + + b.ToTable("scheduled_statuses", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.SessionActivation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccessTokenId") + .HasColumnType("bigint") + .HasColumnName("access_token_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Ip") + .HasColumnType("inet") + .HasColumnName("ip"); + + b.Property("SessionId") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("session_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("UserAgent") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("user_agent") + .HasDefaultValueSql("''::character varying"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.Property("WebPushSubscriptionId") + .HasColumnType("bigint") + .HasColumnName("web_push_subscription_id"); + + b.HasKey("Id") + .HasName("session_activations_pkey"); + + b.HasIndex("AccessTokenId") + .HasDatabaseName("index_session_activations_on_access_token_id"); + + b.HasIndex("SessionId") + .IsUnique() + .HasDatabaseName("index_session_activations_on_session_id"); + + b.HasIndex("UserId") + .HasDatabaseName("index_session_activations_on_user_id"); + + b.ToTable("session_activations", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ThingId") + .HasColumnType("bigint") + .HasColumnName("thing_id"); + + b.Property("ThingType") + .HasColumnType("character varying") + .HasColumnName("thing_type"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Value") + .HasColumnType("text") + .HasColumnName("value"); + + b.Property("Var") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("var"); + + b.HasKey("Id") + .HasName("settings_pkey"); + + b.HasIndex("ThingType", "ThingId", "Var") + .IsUnique() + .HasDatabaseName("index_settings_on_thing_type_and_thing_id_and_var"); + + b.ToTable("settings", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.SiteUpload", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Blurhash") + .HasColumnType("character varying") + .HasColumnName("blurhash"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("FileContentType") + .HasColumnType("character varying") + .HasColumnName("file_content_type"); + + b.Property("FileFileName") + .HasColumnType("character varying") + .HasColumnName("file_file_name"); + + b.Property("FileFileSize") + .HasColumnType("integer") + .HasColumnName("file_file_size"); + + b.Property("FileUpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("file_updated_at"); + + b.Property("Meta") + .HasColumnType("json") + .HasColumnName("meta"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Var") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("var") + .HasDefaultValueSql("''::character varying"); + + b.HasKey("Id") + .HasName("site_uploads_pkey"); + + b.HasIndex("Var") + .IsUnique() + .HasDatabaseName("index_site_uploads_on_var"); + + b.ToTable("site_uploads", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Status", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id") + .HasDefaultValueSql("timestamp_id('statuses'::text)"); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("ApplicationId") + .HasColumnType("bigint") + .HasColumnName("application_id"); + + b.Property("ConversationId") + .HasColumnType("bigint") + .HasColumnName("conversation_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("DeletedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("deleted_at"); + + b.Property("EditedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("edited_at"); + + b.Property("InReplyToAccountId") + .HasColumnType("bigint") + .HasColumnName("in_reply_to_account_id"); + + b.Property("InReplyToId") + .HasColumnType("bigint") + .HasColumnName("in_reply_to_id"); + + b.Property("Language") + .HasColumnType("character varying") + .HasColumnName("language"); + + b.Property("Local") + .HasColumnType("boolean") + .HasColumnName("local"); + + b.Property("OrderedMediaAttachmentIds") + .HasColumnType("bigint[]") + .HasColumnName("ordered_media_attachment_ids"); + + b.Property("PollId") + .HasColumnType("bigint") + .HasColumnName("poll_id"); + + b.Property("ReblogOfId") + .HasColumnType("bigint") + .HasColumnName("reblog_of_id"); + + b.Property("Reply") + .HasColumnType("boolean") + .HasColumnName("reply"); + + b.Property("Sensitive") + .HasColumnType("boolean") + .HasColumnName("sensitive"); + + b.Property("SpoilerText") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("spoiler_text") + .HasDefaultValueSql("''::text"); + + b.Property("Text") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + b.Property("Trendable") + .HasColumnType("boolean") + .HasColumnName("trendable"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .HasColumnType("character varying") + .HasColumnName("uri"); + + b.Property("Url") + .HasColumnType("character varying") + .HasColumnName("url"); + + b.Property("Visibility") + .HasColumnType("integer") + .HasColumnName("visibility"); + + b.HasKey("Id") + .HasName("statuses_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_statuses_on_account_id"); + + b.HasIndex("DeletedAt") + .HasDatabaseName("index_statuses_on_deleted_at") + .HasFilter("(deleted_at IS NOT NULL)"); + + b.HasIndex("InReplyToAccountId") + .HasDatabaseName("index_statuses_on_in_reply_to_account_id") + .HasFilter("(in_reply_to_account_id IS NOT NULL)"); + + b.HasIndex("InReplyToId") + .HasDatabaseName("index_statuses_on_in_reply_to_id") + .HasFilter("(in_reply_to_id IS NOT NULL)"); + + b.HasIndex("Uri") + .IsUnique() + .HasDatabaseName("index_statuses_on_uri") + .HasFilter("(uri IS NOT NULL)"); + + NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex("Uri"), new[] { "text_pattern_ops" }); + + b.HasIndex("Id", "AccountId") + .IsDescending(true, false) + .HasDatabaseName("index_statuses_public_20200119") + .HasFilter("((deleted_at IS NULL) AND (visibility = 0) AND (reblog_of_id IS NULL) AND ((NOT reply) OR (in_reply_to_account_id = account_id)))"); + + b.HasIndex("ReblogOfId", "AccountId") + .HasDatabaseName("index_statuses_on_reblog_of_id_and_account_id"); + + b.HasIndex("AccountId", "Id", "Visibility", "UpdatedAt") + .IsDescending(false, true, false, false) + .HasDatabaseName("index_statuses_20190820") + .HasFilter("(deleted_at IS NULL)"); + + b.ToTable("statuses", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusEdit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("MediaDescriptions") + .HasColumnType("text[]") + .HasColumnName("media_descriptions"); + + b.Property("OrderedMediaAttachmentIds") + .HasColumnType("bigint[]") + .HasColumnName("ordered_media_attachment_ids"); + + b.Property("PollOptions") + .HasColumnType("character varying[]") + .HasColumnName("poll_options"); + + b.Property("Sensitive") + .HasColumnType("boolean") + .HasColumnName("sensitive"); + + b.Property("SpoilerText") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("spoiler_text") + .HasDefaultValueSql("''::text"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("Text") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("text") + .HasColumnName("text") + .HasDefaultValueSql("''::text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("status_edits_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_status_edits_on_account_id"); + + b.HasIndex("StatusId") + .HasDatabaseName("index_status_edits_on_status_id"); + + b.ToTable("status_edits", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusPin", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at") + .HasDefaultValueSql("now()"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at") + .HasDefaultValueSql("now()"); + + b.HasKey("Id") + .HasName("status_pins_pkey"); + + b.HasIndex("StatusId") + .HasDatabaseName("index_status_pins_on_status_id"); + + b.HasIndex("AccountId", "StatusId") + .IsUnique() + .HasDatabaseName("index_status_pins_on_account_id_and_status_id"); + + b.ToTable("status_pins", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusStat", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("FavouritesCount") + .HasColumnType("bigint") + .HasColumnName("favourites_count"); + + b.Property("ReblogsCount") + .HasColumnType("bigint") + .HasColumnName("reblogs_count"); + + b.Property("RepliesCount") + .HasColumnType("bigint") + .HasColumnName("replies_count"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("status_stats_pkey"); + + b.HasIndex("StatusId") + .IsUnique() + .HasDatabaseName("index_status_stats_on_status_id"); + + b.ToTable("status_stats", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusTag", b => + { + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.Property("TagId") + .HasColumnType("bigint") + .HasColumnName("tag_id"); + + b.HasIndex("StatusId") + .HasDatabaseName("index_statuses_tags_on_status_id"); + + b.HasIndex("TagId", "StatusId") + .IsUnique() + .HasDatabaseName("index_statuses_tags_on_tag_id_and_status_id"); + + b.ToTable("statuses_tags", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusTrend", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Allowed") + .HasColumnType("boolean") + .HasColumnName("allowed"); + + b.Property("Language") + .HasColumnType("character varying") + .HasColumnName("language"); + + b.Property("Rank") + .HasColumnType("integer") + .HasColumnName("rank"); + + b.Property("Score") + .HasColumnType("double precision") + .HasColumnName("score"); + + b.Property("StatusId") + .HasColumnType("bigint") + .HasColumnName("status_id"); + + b.HasKey("Id") + .HasName("status_trends_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_status_trends_on_account_id"); + + b.HasIndex("StatusId") + .IsUnique() + .HasDatabaseName("index_status_trends_on_status_id"); + + b.ToTable("status_trends", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.SystemKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Key") + .HasColumnType("bytea") + .HasColumnName("key"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("system_keys_pkey"); + + b.ToTable("system_keys", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("DisplayName") + .HasColumnType("character varying") + .HasColumnName("display_name"); + + b.Property("LastStatusAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_status_at"); + + b.Property("Listable") + .HasColumnType("boolean") + .HasColumnName("listable"); + + b.Property("MaxScore") + .HasColumnType("double precision") + .HasColumnName("max_score"); + + b.Property("MaxScoreAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("max_score_at"); + + b.Property("Name") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("name") + .HasDefaultValueSql("''::character varying"); + + b.Property("RequestedReviewAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("requested_review_at"); + + b.Property("ReviewedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("reviewed_at"); + + b.Property("Trendable") + .HasColumnType("boolean") + .HasColumnName("trendable"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Usable") + .HasColumnType("boolean") + .HasColumnName("usable"); + + b.HasKey("Id") + .HasName("tags_pkey"); + + b.ToTable("tags", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.TagFollow", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("TagId") + .HasColumnType("bigint") + .HasColumnName("tag_id"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("tag_follows_pkey"); + + b.HasIndex("TagId") + .HasDatabaseName("index_tag_follows_on_tag_id"); + + b.HasIndex("AccountId", "TagId") + .IsUnique() + .HasDatabaseName("index_tag_follows_on_account_id_and_tag_id"); + + b.ToTable("tag_follows", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Tombstone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("ByModerator") + .HasColumnType("boolean") + .HasColumnName("by_moderator"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("uri"); + + b.HasKey("Id") + .HasName("tombstones_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_tombstones_on_account_id"); + + b.HasIndex("Uri") + .HasDatabaseName("index_tombstones_on_uri"); + + b.ToTable("tombstones", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.UnavailableDomain", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Domain") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("domain") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("unavailable_domains_pkey"); + + b.HasIndex("Domain") + .IsUnique() + .HasDatabaseName("index_unavailable_domains_on_domain"); + + b.ToTable("unavailable_domains", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint") + .HasColumnName("account_id"); + + b.Property("Admin") + .HasColumnType("boolean") + .HasColumnName("admin"); + + b.Property("Approved") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("approved") + .HasDefaultValueSql("true"); + + b.Property("ChosenLanguages") + .HasColumnType("character varying[]") + .HasColumnName("chosen_languages"); + + b.Property("ConfirmationSentAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("confirmation_sent_at"); + + b.Property("ConfirmationToken") + .HasColumnType("character varying") + .HasColumnName("confirmation_token"); + + b.Property("ConfirmedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("confirmed_at"); + + b.Property("ConsumedTimestep") + .HasColumnType("integer") + .HasColumnName("consumed_timestep"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("CreatedByApplicationId") + .HasColumnType("bigint") + .HasColumnName("created_by_application_id"); + + b.Property("CurrentSignInAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("current_sign_in_at"); + + b.Property("Disabled") + .HasColumnType("boolean") + .HasColumnName("disabled"); + + b.Property("Email") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("email") + .HasDefaultValueSql("''::character varying"); + + b.Property("EncryptedOtpSecret") + .HasColumnType("character varying") + .HasColumnName("encrypted_otp_secret"); + + b.Property("EncryptedOtpSecretIv") + .HasColumnType("character varying") + .HasColumnName("encrypted_otp_secret_iv"); + + b.Property("EncryptedOtpSecretSalt") + .HasColumnType("character varying") + .HasColumnName("encrypted_otp_secret_salt"); + + b.Property("EncryptedPassword") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("encrypted_password") + .HasDefaultValueSql("''::character varying"); + + b.Property("InviteId") + .HasColumnType("bigint") + .HasColumnName("invite_id"); + + b.Property("LastEmailedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_emailed_at"); + + b.Property("LastSignInAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("last_sign_in_at"); + + b.Property("Locale") + .HasColumnType("character varying") + .HasColumnName("locale"); + + b.Property("Moderator") + .HasColumnType("boolean") + .HasColumnName("moderator"); + + b.Property("OtpBackupCodes") + .HasColumnType("character varying[]") + .HasColumnName("otp_backup_codes"); + + b.Property("OtpRequiredForLogin") + .HasColumnType("boolean") + .HasColumnName("otp_required_for_login"); + + b.Property("ResetPasswordSentAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("reset_password_sent_at"); + + b.Property("ResetPasswordToken") + .HasColumnType("character varying") + .HasColumnName("reset_password_token"); + + b.Property("RoleId") + .HasColumnType("bigint") + .HasColumnName("role_id"); + + b.Property("SignInCount") + .HasColumnType("integer") + .HasColumnName("sign_in_count"); + + b.Property("SignInToken") + .HasColumnType("character varying") + .HasColumnName("sign_in_token"); + + b.Property("SignInTokenSentAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("sign_in_token_sent_at"); + + b.Property("SignUpIp") + .HasColumnType("inet") + .HasColumnName("sign_up_ip"); + + b.Property("SkipSignInToken") + .HasColumnType("boolean") + .HasColumnName("skip_sign_in_token"); + + b.Property("UnconfirmedEmail") + .HasColumnType("character varying") + .HasColumnName("unconfirmed_email"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("WebAuthnId") + .HasColumnType("character varying") + .HasColumnName("webauthn_id"); + + b.HasKey("Id") + .HasName("users_pkey"); + + b.HasIndex("AccountId") + .HasDatabaseName("index_users_on_account_id"); + + b.HasIndex("ConfirmationToken") + .IsUnique() + .HasDatabaseName("index_users_on_confirmation_token"); + + b.HasIndex("CreatedByApplicationId") + .HasDatabaseName("index_users_on_created_by_application_id") + .HasFilter("(created_by_application_id IS NOT NULL)"); + + b.HasIndex("Email") + .IsUnique() + .HasDatabaseName("index_users_on_email"); + + b.HasIndex("InviteId") + .HasDatabaseName("ix_users_invite_id"); + + b.HasIndex("ResetPasswordToken") + .IsUnique() + .HasDatabaseName("index_users_on_reset_password_token") + .HasFilter("(reset_password_token IS NOT NULL)"); + + NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex("ResetPasswordToken"), new[] { "text_pattern_ops" }); + + b.HasIndex("RoleId") + .HasDatabaseName("index_users_on_role_id") + .HasFilter("(role_id IS NOT NULL)"); + + b.ToTable("users", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.UserInviteRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Text") + .HasColumnType("text") + .HasColumnName("text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("user_invite_requests_pkey"); + + b.HasIndex("UserId") + .HasDatabaseName("index_user_invite_requests_on_user_id"); + + b.ToTable("user_invite_requests", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.UserIp", b => + { + b.Property("Ip") + .HasColumnType("inet") + .HasColumnName("ip"); + + b.Property("UsedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("used_at"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.ToTable((string)null); + + b.ToView("user_ips", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Color") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("color") + .HasDefaultValueSql("''::character varying"); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("Highlighted") + .HasColumnType("boolean") + .HasColumnName("highlighted"); + + b.Property("Name") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("name") + .HasDefaultValueSql("''::character varying"); + + b.Property("Permissions") + .HasColumnType("bigint") + .HasColumnName("permissions"); + + b.Property("Position") + .HasColumnType("integer") + .HasColumnName("position"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("user_roles_pkey"); + + b.ToTable("user_roles", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.WebAuthnCredential", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("ExternalId") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("external_id"); + + b.Property("Nickname") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("nickname"); + + b.Property("PublicKey") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("public_key"); + + b.Property("SignCount") + .HasColumnType("bigint") + .HasColumnName("sign_count"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("webauthn_credentials_pkey"); + + b.HasIndex("ExternalId") + .IsUnique() + .HasDatabaseName("index_webauthn_credentials_on_external_id"); + + b.HasIndex("UserId") + .HasDatabaseName("index_webauthn_credentials_on_user_id"); + + b.ToTable("webauthn_credentials", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.WebPushSubscription", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccessTokenId") + .HasColumnType("bigint") + .HasColumnName("access_token_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Data") + .HasColumnType("json") + .HasColumnName("data"); + + b.Property("Endpoint") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("endpoint"); + + b.Property("KeyAuth") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("key_auth"); + + b.Property("KeyP256dh") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("key_p256dh"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("web_push_subscriptions_pkey"); + + b.HasIndex("AccessTokenId") + .HasDatabaseName("index_web_push_subscriptions_on_access_token_id") + .HasFilter("(access_token_id IS NOT NULL)"); + + b.HasIndex("UserId") + .HasDatabaseName("index_web_push_subscriptions_on_user_id"); + + b.ToTable("web_push_subscriptions", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.WebSetting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("created_at"); + + b.Property("Data") + .HasColumnType("json") + .HasColumnName("data"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp without time zone") + .HasColumnName("updated_at"); + + b.Property("UserId") + .HasColumnType("bigint") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("web_settings_pkey"); + + b.HasIndex("UserId") + .IsUnique() + .HasDatabaseName("index_web_settings_on_user_id"); + + b.ToTable("web_settings", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Webhook", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("created_at"); + + b.Property("Enabled") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasColumnName("enabled") + .HasDefaultValueSql("true"); + + b.Property("Events") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying[]") + .HasColumnName("events") + .HasDefaultValueSql("'{}'::character varying[]"); + + b.Property("Secret") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("character varying") + .HasColumnName("secret") + .HasDefaultValueSql("''::character varying"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp(6) without time zone") + .HasColumnName("updated_at"); + + b.Property("Url") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("url"); + + b.HasKey("Id") + .HasName("webhooks_pkey"); + + b.HasIndex("Url") + .IsUnique() + .HasDatabaseName("index_webhooks_on_url"); + + b.ToTable("webhooks", (string)null); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Account", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "MovedToAccount") + .WithMany("InverseMovedToAccount") + .HasForeignKey("MovedToAccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_2320833084"); + + b.Navigation("MovedToAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountAlias", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountAliases") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_fc91575d08"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountConversation", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountConversations") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_6f5278b6e9"); + + b.HasOne("Smilodon.Domain.Models.Conversation", "Conversation") + .WithMany("AccountConversations") + .HasForeignKey("ConversationId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_1491654f9f"); + + b.Navigation("Account"); + + b.Navigation("Conversation"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountDeletionRequest", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountDeletionRequests") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_45bf2626b9"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountDomainBlock", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountDomainBlocks") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_206c6029bd"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountMigration", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountMigrationAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_c9f701caaf"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("AccountMigrationTargetAccounts") + .HasForeignKey("TargetAccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_d9a8dad070"); + + b.Navigation("Account"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountModerationNote", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountModerationNoteAccounts") + .HasForeignKey("AccountId") + .IsRequired() + .HasConstraintName("fk_rails_3f8b75089b"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("AccountModerationNoteTargetAccounts") + .HasForeignKey("TargetAccountId") + .IsRequired() + .HasConstraintName("fk_rails_dd62ed5ac3"); + + b.Navigation("Account"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountNote", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountNoteAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_4ee4503c69"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("AccountNoteTargetAccounts") + .HasForeignKey("TargetAccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_2801b48f1a"); + + b.Navigation("Account"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountPin", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountPinAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_d44979e5dd"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("AccountPinTargetAccounts") + .HasForeignKey("TargetAccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a176e26c37"); + + b.Navigation("Account"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountStat", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithOne("AccountStat") + .HasForeignKey("Smilodon.Domain.Models.AccountStat", "AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_215bb31ff1"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountStatusesCleanupPolicy", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountStatusesCleanupPolicies") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_23d5f73cfe"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountWarning", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AccountWarningAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_a65a1bf71b"); + + b.HasOne("Smilodon.Domain.Models.Report", "Report") + .WithMany("AccountWarnings") + .HasForeignKey("ReportId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_8f2bab4b16"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("AccountWarningTargetAccounts") + .HasForeignKey("TargetAccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a7ebbb1e37"); + + b.Navigation("Account"); + + b.Navigation("Report"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AdminActionLog", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AdminActionLogs") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a7667297fa"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AnnouncementMute", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AnnouncementMutes") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_9c99f8e835"); + + b.HasOne("Smilodon.Domain.Models.Announcement", "Announcement") + .WithMany("AnnouncementMutes") + .HasForeignKey("AnnouncementId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_e35401adf1"); + + b.Navigation("Account"); + + b.Navigation("Announcement"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AnnouncementReaction", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AnnouncementReactions") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_7444ad831f"); + + b.HasOne("Smilodon.Domain.Models.Announcement", "Announcement") + .WithMany("AnnouncementReactions") + .HasForeignKey("AnnouncementId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a1226eaa5c"); + + b.HasOne("Smilodon.Domain.Models.CustomEmoji", "CustomEmoji") + .WithMany("AnnouncementReactions") + .HasForeignKey("CustomEmojiId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_b742c91c0e"); + + b.Navigation("Account"); + + b.Navigation("Announcement"); + + b.Navigation("CustomEmoji"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Appeal", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("AppealAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_ea84881569"); + + b.HasOne("Smilodon.Domain.Models.AccountWarning", "AccountWarning") + .WithOne("Appeal") + .HasForeignKey("Smilodon.Domain.Models.Appeal", "AccountWarningId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_a99f14546e"); + + b.HasOne("Smilodon.Domain.Models.Account", "ApprovedByAccount") + .WithMany("AppealApprovedByAccounts") + .HasForeignKey("ApprovedByAccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_9deb2f63ad"); + + b.HasOne("Smilodon.Domain.Models.Account", "RejectedByAccount") + .WithMany("AppealRejectedByAccounts") + .HasForeignKey("RejectedByAccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_501c3a6e13"); + + b.Navigation("Account"); + + b.Navigation("AccountWarning"); + + b.Navigation("ApprovedByAccount"); + + b.Navigation("RejectedByAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Backup", b => + { + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithMany("Backups") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_096669d221"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Block", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("BlockAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_4269e03e65"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("BlockTargetAccounts") + .HasForeignKey("TargetAccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_9571bfabc1"); + + b.Navigation("Account"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Bookmark", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("Bookmarks") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_9f6ac182a6"); + + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithMany("Bookmarks") + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_11207ffcfd"); + + b.Navigation("Account"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CanonicalEmailBlock", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "ReferenceAccount") + .WithMany("CanonicalEmailBlocks") + .HasForeignKey("ReferenceAccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_1ecb262096"); + + b.Navigation("ReferenceAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ConversationMute", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("ConversationMutes") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_225b4212bb"); + + b.HasOne("Smilodon.Domain.Models.Conversation", "Conversation") + .WithMany("ConversationMutes") + .HasForeignKey("ConversationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_5ab139311f"); + + b.Navigation("Account"); + + b.Navigation("Conversation"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomFilter", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("CustomFilters") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_8b8d786993"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomFilterKeyword", b => + { + b.HasOne("Smilodon.Domain.Models.CustomFilter", "CustomFilter") + .WithMany("CustomFilterKeywords") + .HasForeignKey("CustomFilterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_5a49a74012"); + + b.Navigation("CustomFilter"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomFilterStatus", b => + { + b.HasOne("Smilodon.Domain.Models.CustomFilter", "CustomFilter") + .WithMany("CustomFilterStatuses") + .HasForeignKey("CustomFilterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_e2ddaf5b14"); + + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithMany("CustomFilterStatuses") + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_2f6d20c0cf"); + + b.Navigation("CustomFilter"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Device", b => + { + b.HasOne("Smilodon.Domain.Models.OAuthAccessToken", "AccessToken") + .WithMany("Devices") + .HasForeignKey("AccessTokenId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_393f74df68"); + + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("Devices") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a796b75798"); + + b.Navigation("AccessToken"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.EmailDomainBlock", b => + { + b.HasOne("Smilodon.Domain.Models.EmailDomainBlock", "Parent") + .WithMany("InverseParent") + .HasForeignKey("ParentId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_408efe0a15"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.EncryptedMessage", b => + { + b.HasOne("Smilodon.Domain.Models.Device", "Device") + .WithMany("EncryptedMessages") + .HasForeignKey("DeviceId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a83e4df7ae"); + + b.HasOne("Smilodon.Domain.Models.Account", "FromAccount") + .WithMany("EncryptedMessages") + .HasForeignKey("FromAccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a42ad0f8d5"); + + b.Navigation("Device"); + + b.Navigation("FromAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Favourite", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("Favourites") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_5eb6c2b873"); + + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithMany("Favourites") + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_b0e856845e"); + + b.Navigation("Account"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.FeaturedTag", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("FeaturedTags") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_174efcf15f"); + + b.HasOne("Smilodon.Domain.Models.Tag", "Tag") + .WithMany("FeaturedTags") + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_23a9055c7c"); + + b.Navigation("Account"); + + b.Navigation("Tag"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Follow", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("FollowAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_32ed1b5560"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("FollowTargetAccounts") + .HasForeignKey("TargetAccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_745ca29eac"); + + b.Navigation("Account"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.FollowRecommendationSuppression", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithOne("FollowRecommendationSuppression") + .HasForeignKey("Smilodon.Domain.Models.FollowRecommendationSuppression", "AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_dfb9a1dbe2"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.FollowRequest", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("FollowRequestAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_76d644b0e7"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("FollowRequestTargetAccounts") + .HasForeignKey("TargetAccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_9291ec025d"); + + b.Navigation("Account"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Identity", b => + { + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithMany("Identities") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_bea040f377"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Import", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("Imports") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_6db1b6e408"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Invite", b => + { + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithMany("Invites") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_ff69dbb2ac"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.List", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("Lists") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_3853b78dac"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ListAccount", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("ListAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_85fee9d6ab"); + + b.HasOne("Smilodon.Domain.Models.Follow", "Follow") + .WithMany("ListAccounts") + .HasForeignKey("FollowId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_40f9cc29f1"); + + b.HasOne("Smilodon.Domain.Models.List", "List") + .WithMany("ListAccounts") + .HasForeignKey("ListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_e54e356c88"); + + b.Navigation("Account"); + + b.Navigation("Follow"); + + b.Navigation("List"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.LoginActivity", b => + { + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithMany("LoginActivities") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_e4b6396b41"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Marker", b => + { + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithMany("Markers") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a7009bc2b6"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.MediaAttachment", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("MediaAttachments") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_96dd81e81b"); + + b.HasOne("Smilodon.Domain.Models.ScheduledStatus", "ScheduledStatus") + .WithMany("MediaAttachments") + .HasForeignKey("ScheduledStatusId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_31fc5aeef1"); + + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithMany("MediaAttachments") + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_3ec0cfdd70"); + + b.Navigation("Account"); + + b.Navigation("ScheduledStatus"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Mention", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("Mentions") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_970d43f9d1"); + + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithMany("Mentions") + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_59edbe2887"); + + b.Navigation("Account"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Mute", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("MuteAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_b8d8daf315"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("MuteTargetAccounts") + .HasForeignKey("TargetAccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_eecff219ea"); + + b.Navigation("Account"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Notification", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("NotificationAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_c141c8ee55"); + + b.HasOne("Smilodon.Domain.Models.Account", "FromAccount") + .WithMany("NotificationFromAccounts") + .HasForeignKey("FromAccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_fbd6b0bf9e"); + + b.Navigation("Account"); + + b.Navigation("FromAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OAuthAccessGrant", b => + { + b.HasOne("Smilodon.Domain.Models.OAuthApplication", "Application") + .WithMany("OAuthAccessGrants") + .HasForeignKey("ApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_34d54b0a33"); + + b.HasOne("Smilodon.Domain.Models.User", "ResourceOwner") + .WithMany("OAuthAccessGrants") + .HasForeignKey("ResourceOwnerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_63b044929b"); + + b.Navigation("Application"); + + b.Navigation("ResourceOwner"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OAuthAccessToken", b => + { + b.HasOne("Smilodon.Domain.Models.OAuthApplication", "Application") + .WithMany("OAuthAccessTokens") + .HasForeignKey("ApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_f5fc4c1ee3"); + + b.HasOne("Smilodon.Domain.Models.User", "ResourceOwner") + .WithMany("OAuthAccessTokens") + .HasForeignKey("ResourceOwnerId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_e84df68546"); + + b.Navigation("Application"); + + b.Navigation("ResourceOwner"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OAuthApplication", b => + { + b.HasOne("Smilodon.Domain.Models.User", "Owner") + .WithMany("OAuthApplications") + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_b0988c7c0a"); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OneTimeKey", b => + { + b.HasOne("Smilodon.Domain.Models.Device", "Device") + .WithMany("OneTimeKeys") + .HasForeignKey("DeviceId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_d3edd8c878"); + + b.Navigation("Device"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Poll", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("Polls") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_5b19a0c011"); + + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithMany("Polls") + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_3e0d9f1115"); + + b.Navigation("Account"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.PollVote", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("PollVotes") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_b6c18cf44a"); + + b.HasOne("Smilodon.Domain.Models.Poll", "Poll") + .WithMany("PollVotes") + .HasForeignKey("PollId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_a6e6974b7e"); + + b.Navigation("Account"); + + b.Navigation("Poll"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.PreviewCardTrend", b => + { + b.HasOne("Smilodon.Domain.Models.PreviewCard", "PreviewCard") + .WithOne("PreviewCardTrend") + .HasForeignKey("Smilodon.Domain.Models.PreviewCardTrend", "PreviewCardId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_371593db34"); + + b.Navigation("PreviewCard"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Report", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("ReportAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_4b81f7522c"); + + b.HasOne("Smilodon.Domain.Models.Account", "ActionTakenByAccount") + .WithMany("ReportActionTakenByAccounts") + .HasForeignKey("ActionTakenByAccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_bca45b75fd"); + + b.HasOne("Smilodon.Domain.Models.Account", "AssignedAccount") + .WithMany("ReportAssignedAccounts") + .HasForeignKey("AssignedAccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_4e7a498fb4"); + + b.HasOne("Smilodon.Domain.Models.Account", "TargetAccount") + .WithMany("ReportTargetAccounts") + .HasForeignKey("TargetAccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_eb37af34f0"); + + b.Navigation("Account"); + + b.Navigation("ActionTakenByAccount"); + + b.Navigation("AssignedAccount"); + + b.Navigation("TargetAccount"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ReportNote", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("ReportNotes") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_cae66353f3"); + + b.HasOne("Smilodon.Domain.Models.Report", "Report") + .WithMany("ReportNotes") + .HasForeignKey("ReportId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_7fa83a61eb"); + + b.Navigation("Account"); + + b.Navigation("Report"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ScheduledStatus", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("ScheduledStatuses") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_23bd9018f9"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.SessionActivation", b => + { + b.HasOne("Smilodon.Domain.Models.OAuthAccessToken", "AccessToken") + .WithMany("SessionActivations") + .HasForeignKey("AccessTokenId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_957e5bda89"); + + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithMany("SessionActivations") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_e5fda67334"); + + b.Navigation("AccessToken"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Status", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("StatusAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_9bda1543f7"); + + b.HasOne("Smilodon.Domain.Models.Account", "InReplyToAccount") + .WithMany("StatusInReplyToAccounts") + .HasForeignKey("InReplyToAccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_c7fa917661"); + + b.HasOne("Smilodon.Domain.Models.Status", "InReplyTo") + .WithMany("InverseInReplyTo") + .HasForeignKey("InReplyToId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_94a6f70399"); + + b.HasOne("Smilodon.Domain.Models.Status", "ReblogOf") + .WithMany("InverseReblogOf") + .HasForeignKey("ReblogOfId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_256483a9ab"); + + b.Navigation("Account"); + + b.Navigation("InReplyTo"); + + b.Navigation("InReplyToAccount"); + + b.Navigation("ReblogOf"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusEdit", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("StatusEdits") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_dc8988c545"); + + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithMany("StatusEdits") + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_a960f234a0"); + + b.Navigation("Account"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusPin", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("StatusPins") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_d4cb435b62"); + + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithMany("StatusPins") + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_65c05552f1"); + + b.Navigation("Account"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusStat", b => + { + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithOne("StatusStat") + .HasForeignKey("Smilodon.Domain.Models.StatusStat", "StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_4a247aac42"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusTag", b => + { + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_df0fe11427"); + + b.HasOne("Smilodon.Domain.Models.Tag", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_3081861e21"); + + b.Navigation("Status"); + + b.Navigation("Tag"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.StatusTrend", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("StatusTrends") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_a6b527ea49"); + + b.HasOne("Smilodon.Domain.Models.Status", "Status") + .WithOne("StatusTrend") + .HasForeignKey("Smilodon.Domain.Models.StatusTrend", "StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_68c610dc1a"); + + b.Navigation("Account"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.TagFollow", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("TagFollows") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_091e831473"); + + b.HasOne("Smilodon.Domain.Models.Tag", "Tag") + .WithMany("TagFollows") + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_rails_0deefe597f"); + + b.Navigation("Account"); + + b.Navigation("Tag"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Tombstone", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("Tombstones") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_f95b861449"); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.User", b => + { + b.HasOne("Smilodon.Domain.Models.Account", "Account") + .WithMany("Users") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_50500f500d"); + + b.HasOne("Smilodon.Domain.Models.OAuthApplication", "CreatedByApplication") + .WithMany("Users") + .HasForeignKey("CreatedByApplicationId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_ecc9536e7c"); + + b.HasOne("Smilodon.Domain.Models.Invite", "Invite") + .WithMany("Users") + .HasForeignKey("InviteId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_8fb2a43e88"); + + b.HasOne("Smilodon.Domain.Models.UserRole", "Role") + .WithMany("Users") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("fk_rails_642f17018b"); + + b.Navigation("Account"); + + b.Navigation("CreatedByApplication"); + + b.Navigation("Invite"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.UserInviteRequest", b => + { + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithMany("UserInviteRequests") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_3773f15361"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.WebAuthnCredential", b => + { + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithMany("WebAuthnCredentials") + .HasForeignKey("UserId") + .HasConstraintName("fk_rails_a4355aef77"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.WebPushSubscription", b => + { + b.HasOne("Smilodon.Domain.Models.OAuthAccessToken", "AccessToken") + .WithMany("WebPushSubscriptions") + .HasForeignKey("AccessTokenId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_751a9f390b"); + + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithMany("WebPushSubscriptions") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_rails_b006f28dac"); + + b.Navigation("AccessToken"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.WebSetting", b => + { + b.HasOne("Smilodon.Domain.Models.User", "User") + .WithOne("WebSetting") + .HasForeignKey("Smilodon.Domain.Models.WebSetting", "UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_11910667b2"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Account", b => + { + b.Navigation("AccountAliases"); + + b.Navigation("AccountConversations"); + + b.Navigation("AccountDeletionRequests"); + + b.Navigation("AccountDomainBlocks"); + + b.Navigation("AccountMigrationAccounts"); + + b.Navigation("AccountMigrationTargetAccounts"); + + b.Navigation("AccountModerationNoteAccounts"); + + b.Navigation("AccountModerationNoteTargetAccounts"); + + b.Navigation("AccountNoteAccounts"); + + b.Navigation("AccountNoteTargetAccounts"); + + b.Navigation("AccountPinAccounts"); + + b.Navigation("AccountPinTargetAccounts"); + + b.Navigation("AccountStat") + .IsRequired(); + + b.Navigation("AccountStatusesCleanupPolicies"); + + b.Navigation("AccountWarningAccounts"); + + b.Navigation("AccountWarningTargetAccounts"); + + b.Navigation("AdminActionLogs"); + + b.Navigation("AnnouncementMutes"); + + b.Navigation("AnnouncementReactions"); + + b.Navigation("AppealAccounts"); + + b.Navigation("AppealApprovedByAccounts"); + + b.Navigation("AppealRejectedByAccounts"); + + b.Navigation("BlockAccounts"); + + b.Navigation("BlockTargetAccounts"); + + b.Navigation("Bookmarks"); + + b.Navigation("CanonicalEmailBlocks"); + + b.Navigation("ConversationMutes"); + + b.Navigation("CustomFilters"); + + b.Navigation("Devices"); + + b.Navigation("EncryptedMessages"); + + b.Navigation("Favourites"); + + b.Navigation("FeaturedTags"); + + b.Navigation("FollowAccounts"); + + b.Navigation("FollowRecommendationSuppression") + .IsRequired(); + + b.Navigation("FollowRequestAccounts"); + + b.Navigation("FollowRequestTargetAccounts"); + + b.Navigation("FollowTargetAccounts"); + + b.Navigation("Imports"); + + b.Navigation("InverseMovedToAccount"); + + b.Navigation("ListAccounts"); + + b.Navigation("Lists"); + + b.Navigation("MediaAttachments"); + + b.Navigation("Mentions"); + + b.Navigation("MuteAccounts"); + + b.Navigation("MuteTargetAccounts"); + + b.Navigation("NotificationAccounts"); + + b.Navigation("NotificationFromAccounts"); + + b.Navigation("PollVotes"); + + b.Navigation("Polls"); + + b.Navigation("ReportAccounts"); + + b.Navigation("ReportActionTakenByAccounts"); + + b.Navigation("ReportAssignedAccounts"); + + b.Navigation("ReportNotes"); + + b.Navigation("ReportTargetAccounts"); + + b.Navigation("ScheduledStatuses"); + + b.Navigation("StatusAccounts"); + + b.Navigation("StatusEdits"); + + b.Navigation("StatusInReplyToAccounts"); + + b.Navigation("StatusPins"); + + b.Navigation("StatusTrends"); + + b.Navigation("TagFollows"); + + b.Navigation("Tombstones"); + + b.Navigation("Users"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.AccountWarning", b => + { + b.Navigation("Appeal") + .IsRequired(); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Announcement", b => + { + b.Navigation("AnnouncementMutes"); + + b.Navigation("AnnouncementReactions"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Conversation", b => + { + b.Navigation("AccountConversations"); + + b.Navigation("ConversationMutes"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomEmoji", b => + { + b.Navigation("AnnouncementReactions"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.CustomFilter", b => + { + b.Navigation("CustomFilterKeywords"); + + b.Navigation("CustomFilterStatuses"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Device", b => + { + b.Navigation("EncryptedMessages"); + + b.Navigation("OneTimeKeys"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.EmailDomainBlock", b => + { + b.Navigation("InverseParent"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Follow", b => + { + b.Navigation("ListAccounts"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Invite", b => + { + b.Navigation("Users"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.List", b => + { + b.Navigation("ListAccounts"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OAuthAccessToken", b => + { + b.Navigation("Devices"); + + b.Navigation("SessionActivations"); + + b.Navigation("WebPushSubscriptions"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.OAuthApplication", b => + { + b.Navigation("OAuthAccessGrants"); + + b.Navigation("OAuthAccessTokens"); + + b.Navigation("Users"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Poll", b => + { + b.Navigation("PollVotes"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.PreviewCard", b => + { + b.Navigation("PreviewCardTrend") + .IsRequired(); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Report", b => + { + b.Navigation("AccountWarnings"); + + b.Navigation("ReportNotes"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.ScheduledStatus", b => + { + b.Navigation("MediaAttachments"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Status", b => + { + b.Navigation("Bookmarks"); + + b.Navigation("CustomFilterStatuses"); + + b.Navigation("Favourites"); + + b.Navigation("InverseInReplyTo"); + + b.Navigation("InverseReblogOf"); + + b.Navigation("MediaAttachments"); + + b.Navigation("Mentions"); + + b.Navigation("Polls"); + + b.Navigation("StatusEdits"); + + b.Navigation("StatusPins"); + + b.Navigation("StatusStat") + .IsRequired(); + + b.Navigation("StatusTrend") + .IsRequired(); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.Tag", b => + { + b.Navigation("FeaturedTags"); + + b.Navigation("TagFollows"); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.User", b => + { + b.Navigation("Backups"); + + b.Navigation("Identities"); + + b.Navigation("Invites"); + + b.Navigation("LoginActivities"); + + b.Navigation("Markers"); + + b.Navigation("OAuthAccessGrants"); + + b.Navigation("OAuthAccessTokens"); + + b.Navigation("OAuthApplications"); + + b.Navigation("SessionActivations"); + + b.Navigation("UserInviteRequests"); + + b.Navigation("WebAuthnCredentials"); + + b.Navigation("WebPushSubscriptions"); + + b.Navigation("WebSetting") + .IsRequired(); + }); + + modelBuilder.Entity("Smilodon.Domain.Models.UserRole", b => + { + b.Navigation("Users"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Infrastructure/Persistence/SmilodonDbContext.cs b/src/Infrastructure/Persistence/SmilodonDbContext.cs new file mode 100644 index 0000000..fec4b7f --- /dev/null +++ b/src/Infrastructure/Persistence/SmilodonDbContext.cs @@ -0,0 +1,127 @@ +using Microsoft.EntityFrameworkCore; +using Smilodon.Domain.Models; + +namespace Smilodon.Infrastructure.Persistence; + +/// +/// The core application DB Context. +/// +public class SmilodonDbContext : DbContext +{ + /// + /// Constructs a new Smilodon DB Context. + /// + /// The . + public SmilodonDbContext(DbContextOptions options) : base(options) { } + + /// + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + // Required for scripts + modelBuilder.HasPostgresExtension("plpgsql"); + + // Built-in sequences + modelBuilder.HasSequence("accounts_id_seq"); + modelBuilder.HasSequence("encrypted_messages_id_seq"); + modelBuilder.HasSequence("media_attachments_id_seq"); + modelBuilder.HasSequence("statuses_id_seq"); + + // Apply entity configurations for the current assembly + modelBuilder.ApplyConfigurationsFromAssembly(typeof(SmilodonDbContext).Assembly); + } + + public virtual DbSet Accounts { get; set; } = null!; + public virtual DbSet AccountAliases { get; set; } = null!; + public virtual DbSet AccountConversations { get; set; } = null!; + public virtual DbSet AccountDeletionRequests { get; set; } = null!; + public virtual DbSet AccountDomainBlocks { get; set; } = null!; + public virtual DbSet AccountMigrations { get; set; } = null!; + public virtual DbSet AccountModerationNotes { get; set; } = null!; + public virtual DbSet AccountNotes { get; set; } = null!; + public virtual DbSet AccountPins { get; set; } = null!; + public virtual DbSet AccountStats { get; set; } = null!; + public virtual DbSet AccountStatusesCleanupPolicies { get; set; } = null!; + public virtual DbSet AccountSummaries { get; set; } = null!; + public virtual DbSet AccountWarnings { get; set; } = null!; + public virtual DbSet AccountWarningPresets { get; set; } = null!; + public virtual DbSet AccountTags { get; set; } = null!; + public virtual DbSet AdminActionLogs { get; set; } = null!; + public virtual DbSet Announcements { get; set; } = null!; + public virtual DbSet AnnouncementMutes { get; set; } = null!; + public virtual DbSet AnnouncementReactions { get; set; } = null!; + public virtual DbSet Appeals { get; set; } = null!; + public virtual DbSet ArInternalMetadata { get; set; } = null!; + public virtual DbSet Backups { get; set; } = null!; + public virtual DbSet Blocks { get; set; } = null!; + public virtual DbSet Bookmarks { get; set; } = null!; + public virtual DbSet CanonicalEmailBlocks { get; set; } = null!; + public virtual DbSet Conversations { get; set; } = null!; + public virtual DbSet ConversationMutes { get; set; } = null!; + public virtual DbSet CustomEmojis { get; set; } = null!; + public virtual DbSet CustomEmojiCategories { get; set; } = null!; + public virtual DbSet CustomFilters { get; set; } = null!; + public virtual DbSet CustomFilterKeywords { get; set; } = null!; + public virtual DbSet CustomFilterStatuses { get; set; } = null!; + public virtual DbSet Devices { get; set; } = null!; + public virtual DbSet DomainAllows { get; set; } = null!; + public virtual DbSet DomainBlocks { get; set; } = null!; + public virtual DbSet EmailDomainBlocks { get; set; } = null!; + public virtual DbSet EncryptedMessages { get; set; } = null!; + public virtual DbSet Favourites { get; set; } = null!; + public virtual DbSet FeaturedTags { get; set; } = null!; + public virtual DbSet Follows { get; set; } = null!; + public virtual DbSet FollowRecommendations { get; set; } = null!; + public virtual DbSet FollowRecommendationSuppressions { get; set; } = null!; + public virtual DbSet FollowRequests { get; set; } = null!; + public virtual DbSet Identities { get; set; } = null!; + public virtual DbSet Imports { get; set; } = null!; + public virtual DbSet Instances { get; set; } = null!; + public virtual DbSet Invites { get; set; } = null!; + public virtual DbSet IpBlocks { get; set; } = null!; + public virtual DbSet Lists { get; set; } = null!; + public virtual DbSet ListAccounts { get; set; } = null!; + public virtual DbSet LoginActivities { get; set; } = null!; + public virtual DbSet Markers { get; set; } = null!; + public virtual DbSet MediaAttachments { get; set; } = null!; + public virtual DbSet Mentions { get; set; } = null!; + public virtual DbSet Mutes { get; set; } = null!; + public virtual DbSet Notifications { get; set; } = null!; + public virtual DbSet OAuthAccessGrants { get; set; } = null!; + public virtual DbSet OAuthAccessTokens { get; set; } = null!; + public virtual DbSet OAuthApplications { get; set; } = null!; + public virtual DbSet OneTimeKeys { get; set; } = null!; + public virtual DbSet PgheroSpaceStats { get; set; } = null!; + public virtual DbSet Polls { get; set; } = null!; + public virtual DbSet PollVotes { get; set; } = null!; + public virtual DbSet PreviewCards { get; set; } = null!; + public virtual DbSet PreviewCardProviders { get; set; } = null!; + public virtual DbSet PreviewCardTrends { get; set; } = null!; + public virtual DbSet PreviewCardStatuses { get; set; } = null!; + public virtual DbSet Relays { get; set; } = null!; + public virtual DbSet Reports { get; set; } = null!; + public virtual DbSet ReportNotes { get; set; } = null!; + public virtual DbSet Rules { get; set; } = null!; + public virtual DbSet ScheduledStatuses { get; set; } = null!; + public virtual DbSet SessionActivations { get; set; } = null!; + public virtual DbSet Settings { get; set; } = null!; + public virtual DbSet SiteUploads { get; set; } = null!; + public virtual DbSet Statuses { get; set; } = null!; + public virtual DbSet StatusEdits { get; set; } = null!; + public virtual DbSet StatusPins { get; set; } = null!; + public virtual DbSet StatusStats { get; set; } = null!; + public virtual DbSet StatusTrends { get; set; } = null!; + public virtual DbSet StatusesTags { get; set; } = null!; + public virtual DbSet SystemKeys { get; set; } = null!; + public virtual DbSet Tags { get; set; } = null!; + public virtual DbSet TagFollows { get; set; } = null!; + public virtual DbSet Tombstones { get; set; } = null!; + public virtual DbSet UnavailableDomains { get; set; } = null!; + public virtual DbSet Users { get; set; } = null!; + public virtual DbSet UserInviteRequests { get; set; } = null!; + public virtual DbSet UserIps { get; set; } = null!; + public virtual DbSet UserRoles { get; set; } = null!; + public virtual DbSet WebPushSubscriptions { get; set; } = null!; + public virtual DbSet WebSettings { get; set; } = null!; + public virtual DbSet WebAuthnCredentials { get; set; } = null!; + public virtual DbSet Webhooks { get; set; } = null!; +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/SmilodonDbContextFactory.cs b/src/Infrastructure/Persistence/SmilodonDbContextFactory.cs new file mode 100644 index 0000000..35c8adc --- /dev/null +++ b/src/Infrastructure/Persistence/SmilodonDbContextFactory.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Design; + +namespace Smilodon.Infrastructure.Persistence; + +/// +/// A design-time factory for running migrations. +/// +/// +/// This factory is only run when preforming migrations or database updates using the EF Core CLI. +/// +public class SmilodonDbContextFactory : IDesignTimeDbContextFactory +{ + public SmilodonDbContext CreateDbContext(string[] args) + { + var optionsBuilder = new DbContextOptionsBuilder(); + + // Configure local database with snake_case naming conventions + optionsBuilder + .UseNpgsql("Host=localhost;Database=smilodon;") + .UseSnakeCaseNamingConvention(); + + // Construct the design-time DB Context below. + return new SmilodonDbContext(optionsBuilder.Options); + } +} \ No newline at end of file diff --git a/src/WebApp/Models/Actor.cs b/src/WebApp/Models/Actor.cs index 45240c3..2bafb78 100644 --- a/src/WebApp/Models/Actor.cs +++ b/src/WebApp/Models/Actor.cs @@ -15,8 +15,4 @@ public record Actor( string name, string summary, string[] icon, - PublicKey publicKey) - : BaseObject(context, type, id, name) -{ -} - + PublicKey publicKey) : BaseObject(context, type, id, name); \ No newline at end of file diff --git a/src/WebApp/Models/WebFinger.cs b/src/WebApp/Models/WebFinger.cs new file mode 100644 index 0000000..d36c6fd --- /dev/null +++ b/src/WebApp/Models/WebFinger.cs @@ -0,0 +1,6 @@ +namespace Smilodon.WebApp.Models; + +// Root myDeserializedClass = JsonConvert.DeserializeObject(myJsonResponse); +public record Link(string rel, string type, string href); + +public record WebFinger(string subject, List links); diff --git a/src/WebApp/Program.cs b/src/WebApp/Program.cs index 961145f..38e7e78 100644 --- a/src/WebApp/Program.cs +++ b/src/WebApp/Program.cs @@ -1,3 +1,5 @@ +using Microsoft.EntityFrameworkCore; +using Smilodon.Infrastructure.Persistence; using Smilodon.WebApp.Api.Admin; using Smilodon.WebApp.Api.Webfinger; @@ -7,6 +9,13 @@ builder.Services.AddControllersWithViews(); +// Add the database context to the DI container +builder.Services.AddDbContext(options => + options + .UseNpgsql("Host=localhost; Database=smilodon; User Id=smilodon; Password=smilodon;") + .UseSnakeCaseNamingConvention()); + + var app = builder.Build(); // Configure the HTTP request pipeline. diff --git a/src/WebApp/WebApp.csproj b/src/WebApp/WebApp.csproj index 068496c..4eb4a5d 100644 --- a/src/WebApp/WebApp.csproj +++ b/src/WebApp/WebApp.csproj @@ -6,6 +6,11 @@ false enable true + Smilodon.WebApp + + + +