using System;
using System.Collections.Generic;
using Iceshrimp.Backend.Core.Database.Tables;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Iceshrimp.Backend.Core.Database.Migrations
{
///
public partial class Initial : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("Npgsql:Enum:antenna_src_enum", "home,all,users,list,group,instances")
.Annotation("Npgsql:Enum:log_level_enum", "error,warning,info,success,debug")
.Annotation("Npgsql:Enum:note_visibility_enum", "public,home,followers,specified,hidden")
.Annotation("Npgsql:Enum:notification_type_enum", "follow,mention,reply,renote,quote,reaction,pollVote,pollEnded,receiveFollowRequest,followRequestAccepted,groupInvited,app")
.Annotation("Npgsql:Enum:page_visibility_enum", "public,followers,specified")
.Annotation("Npgsql:Enum:poll_notevisibility_enum", "public,home,followers,specified,hidden")
.Annotation("Npgsql:Enum:relay_status_enum", "requesting,accepted,rejected")
.Annotation("Npgsql:Enum:user_profile_ffvisibility_enum", "public,followers,private")
.Annotation("Npgsql:Enum:user_profile_mutingnotificationtypes_enum", "follow,mention,reply,renote,quote,reaction,pollVote,pollEnded,receiveFollowRequest,followRequestAccepted,groupInvited,app")
.Annotation("Npgsql:PostgresExtension:pg_trgm", ",,");
migrationBuilder.CreateTable(
name: "announcement",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
createdAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "The created date of the Announcement."),
text = table.Column(type: "character varying(8192)", maxLength: 8192, nullable: false),
title = table.Column(type: "character varying(256)", maxLength: 256, nullable: false),
imageUrl = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true),
updatedAt = table.Column(type: "timestamp with time zone", nullable: true, comment: "The updated date of the Announcement."),
showPopup = table.Column(type: "boolean", nullable: false, defaultValue: false),
isGoodNews = table.Column(type: "boolean", nullable: false, defaultValue: false)
},
constraints: table =>
{
table.PrimaryKey("PK_e0ef0550174fd1099a308fd18a0", x => x.id);
});
migrationBuilder.CreateTable(
name: "emoji",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
updatedAt = table.Column(type: "timestamp with time zone", nullable: true),
name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
host = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
originalUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: false),
uri = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
type = table.Column(type: "character varying(64)", maxLength: 64, nullable: true),
aliases = table.Column>(type: "character varying(128)[]", nullable: false, defaultValueSql: "'{}'::character varying[]"),
category = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
publicUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: false, defaultValueSql: "''::character varying"),
license = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true),
width = table.Column(type: "integer", nullable: true, comment: "Image width"),
height = table.Column(type: "integer", nullable: true, comment: "Image height")
},
constraints: table =>
{
table.PrimaryKey("PK_df74ce05e24999ee01ea0bc50a3", x => x.id);
});
migrationBuilder.CreateTable(
name: "hashtag",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
mentionedUserIds = table.Column>(type: "character varying(32)[]", nullable: false),
mentionedUsersCount = table.Column(type: "integer", nullable: false, defaultValue: 0),
mentionedLocalUserIds = table.Column>(type: "character varying(32)[]", nullable: false),
mentionedLocalUsersCount = table.Column(type: "integer", nullable: false, defaultValue: 0),
mentionedRemoteUserIds = table.Column>(type: "character varying(32)[]", nullable: false),
mentionedRemoteUsersCount = table.Column(type: "integer", nullable: false, defaultValue: 0),
attachedUserIds = table.Column>(type: "character varying(32)[]", nullable: false),
attachedUsersCount = table.Column(type: "integer", nullable: false, defaultValue: 0),
attachedLocalUserIds = table.Column>(type: "character varying(32)[]", nullable: false),
attachedLocalUsersCount = table.Column(type: "integer", nullable: false, defaultValue: 0),
attachedRemoteUserIds = table.Column>(type: "character varying(32)[]", nullable: false),
attachedRemoteUsersCount = table.Column(type: "integer", nullable: false, defaultValue: 0)
},
constraints: table =>
{
table.PrimaryKey("PK_cb36eb8af8412bfa978f1165d78", x => x.id);
});
migrationBuilder.CreateTable(
name: "instance",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
caughtAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "The caught date of the Instance."),
host = table.Column(type: "character varying(512)", maxLength: 512, nullable: false, comment: "The host of the Instance."),
usersCount = table.Column(type: "integer", nullable: false, defaultValue: 0, comment: "The count of the users of the Instance."),
notesCount = table.Column(type: "integer", nullable: false, defaultValue: 0, comment: "The count of the notes of the Instance."),
followingCount = table.Column(type: "integer", nullable: false, defaultValue: 0),
followersCount = table.Column(type: "integer", nullable: false, defaultValue: 0),
latestRequestSentAt = table.Column(type: "timestamp with time zone", nullable: true),
latestStatus = table.Column(type: "integer", nullable: true),
latestRequestReceivedAt = table.Column(type: "timestamp with time zone", nullable: true),
lastCommunicatedAt = table.Column(type: "timestamp with time zone", nullable: false),
isNotResponding = table.Column(type: "boolean", nullable: false, defaultValue: false),
softwareName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true, comment: "The software of the Instance."),
softwareVersion = table.Column(type: "character varying(64)", maxLength: 64, nullable: true),
openRegistrations = table.Column(type: "boolean", nullable: true),
name = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
description = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true),
maintainerName = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
maintainerEmail = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
infoUpdatedAt = table.Column(type: "timestamp with time zone", nullable: true),
isSuspended = table.Column(type: "boolean", nullable: false, defaultValue: false),
iconUrl = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true),
themeColor = table.Column(type: "character varying(64)", maxLength: 64, nullable: true),
faviconUrl = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_eaf60e4a0c399c9935413e06474", x => x.id);
});
migrationBuilder.CreateTable(
name: "meta",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
name = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
description = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true),
maintainerName = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
maintainerEmail = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
disableRegistration = table.Column(type: "boolean", nullable: false, defaultValue: false),
disableLocalTimeline = table.Column(type: "boolean", nullable: false, defaultValue: false),
disableGlobalTimeline = table.Column(type: "boolean", nullable: false, defaultValue: false),
langs = table.Column>(type: "character varying(64)[]", nullable: false, defaultValueSql: "'{}'::character varying[]"),
hiddenTags = table.Column>(type: "character varying(256)[]", nullable: false, defaultValueSql: "'{}'::character varying[]"),
blockedHosts = table.Column>(type: "character varying(256)[]", nullable: false, defaultValueSql: "'{}'::character varying[]"),
mascotImageUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, defaultValueSql: "'/static-assets/badges/info.png'::character varying"),
bannerUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
errorImageUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, defaultValueSql: "'/static-assets/badges/error.png'::character varying"),
iconUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
cacheRemoteFiles = table.Column(type: "boolean", nullable: false, defaultValue: false),
enableRecaptcha = table.Column(type: "boolean", nullable: false, defaultValue: false),
recaptchaSiteKey = table.Column(type: "character varying(64)", maxLength: 64, nullable: true),
recaptchaSecretKey = table.Column(type: "character varying(64)", maxLength: 64, nullable: true),
localDriveCapacityMb = table.Column(type: "integer", nullable: false, defaultValue: 1024, comment: "Drive capacity of a local user (MB)"),
remoteDriveCapacityMb = table.Column(type: "integer", nullable: false, defaultValue: 32, comment: "Drive capacity of a remote user (MB)"),
summalyProxy = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
enableEmail = table.Column(type: "boolean", nullable: false, defaultValue: false),
email = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
smtpSecure = table.Column(type: "boolean", nullable: false, defaultValue: false),
smtpHost = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
smtpPort = table.Column(type: "integer", nullable: true),
smtpUser = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true),
smtpPass = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true),
swPublicKey = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
swPrivateKey = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
enableGithubIntegration = table.Column(type: "boolean", nullable: false, defaultValue: false),
githubClientId = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
githubClientSecret = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
enableDiscordIntegration = table.Column(type: "boolean", nullable: false, defaultValue: false),
discordClientId = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
discordClientSecret = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
pinnedUsers = table.Column>(type: "character varying(256)[]", nullable: false, defaultValueSql: "'{}'::character varying[]"),
ToSUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
repositoryUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: false, defaultValueSql: "'https://iceshrimp.dev/iceshrimp/iceshrimp'::character varying"),
feedbackUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, defaultValueSql: "'https://iceshrimp.dev/iceshrimp/iceshrimp/issues/new'::character varying"),
useObjectStorage = table.Column(type: "boolean", nullable: false, defaultValue: false),
objectStorageBucket = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
objectStoragePrefix = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
objectStorageBaseUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
objectStorageEndpoint = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
objectStorageRegion = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
objectStorageAccessKey = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
objectStorageSecretKey = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
objectStoragePort = table.Column(type: "integer", nullable: true),
objectStorageUseSSL = table.Column(type: "boolean", nullable: false, defaultValue: true),
objectStorageUseProxy = table.Column(type: "boolean", nullable: false, defaultValue: true),
enableHcaptcha = table.Column(type: "boolean", nullable: false, defaultValue: false),
hcaptchaSiteKey = table.Column(type: "character varying(64)", maxLength: 64, nullable: true),
hcaptchaSecretKey = table.Column(type: "character varying(64)", maxLength: 64, nullable: true),
objectStorageSetPublicRead = table.Column(type: "boolean", nullable: false, defaultValue: false),
pinnedPages = table.Column>(type: "character varying(512)[]", nullable: false, defaultValueSql: "'{/featured,/channels,/explore,/pages,/about-iceshrimp}'::character varying[]"),
backgroundImageUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
logoImageUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
pinnedClipId = table.Column(type: "character varying(32)", maxLength: 32, nullable: true),
objectStorageS3ForcePathStyle = table.Column(type: "boolean", nullable: false, defaultValue: true),
allowedHosts = table.Column>(type: "character varying(256)[]", nullable: false, defaultValueSql: "'{}'::character varying[]"),
secureMode = table.Column(type: "boolean", nullable: false, defaultValue: true),
privateMode = table.Column(type: "boolean", nullable: false, defaultValue: false),
deeplAuthKey = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
deeplIsPro = table.Column(type: "boolean", nullable: false, defaultValue: false),
emailRequiredForSignup = table.Column(type: "boolean", nullable: false, defaultValue: false),
themeColor = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
defaultLightTheme = table.Column(type: "character varying(8192)", maxLength: 8192, nullable: true),
defaultDarkTheme = table.Column(type: "character varying(8192)", maxLength: 8192, nullable: true),
enableIpLogging = table.Column(type: "boolean", nullable: false, defaultValue: false),
enableActiveEmailValidation = table.Column(type: "boolean", nullable: false, defaultValue: true),
customMOTD = table.Column>(type: "character varying(256)[]", nullable: false, defaultValueSql: "'{}'::character varying[]"),
customSplashIcons = table.Column>(type: "character varying(256)[]", nullable: false, defaultValueSql: "'{}'::character varying[]"),
disableRecommendedTimeline = table.Column(type: "boolean", nullable: false, defaultValue: true),
recommendedInstances = table.Column>(type: "character varying(256)[]", nullable: false, defaultValueSql: "'{}'::character varying[]"),
defaultReaction = table.Column(type: "character varying(256)", maxLength: 256, nullable: false, defaultValueSql: "'⭐'::character varying"),
libreTranslateApiUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
libreTranslateApiKey = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
silencedHosts = table.Column>(type: "character varying(256)[]", nullable: false, defaultValueSql: "'{}'::character varying[]"),
experimentalFeatures = table.Column(type: "jsonb", nullable: false, defaultValueSql: "'{}'::jsonb"),
enableServerMachineStats = table.Column(type: "boolean", nullable: false, defaultValue: false),
enableIdenticonGeneration = table.Column(type: "boolean", nullable: false, defaultValue: true),
donationLink = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
autofollowedAccount = table.Column(type: "character varying(128)", maxLength: 128, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_c4c17a6c2bd7651338b60fc590b", x => x.id);
});
migrationBuilder.CreateTable(
name: "oauth_app",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
createdAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "The created date of the OAuth application"),
clientId = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "The client id of the OAuth application"),
clientSecret = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "The client secret of the OAuth application"),
name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "The name of the OAuth application"),
website = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "The website of the OAuth application"),
scopes = table.Column>(type: "character varying(64)[]", nullable: false, comment: "The scopes requested by the OAuth application"),
redirectUris = table.Column>(type: "character varying(512)[]", nullable: false, comment: "The redirect URIs of the OAuth application")
},
constraints: table =>
{
table.PrimaryKey("PK_3256b97c0a3ee2d67240805dca4", x => x.id);
});
migrationBuilder.CreateTable(
name: "registration_ticket",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
createdAt = table.Column(type: "timestamp with time zone", nullable: false),
code = table.Column(type: "character varying(64)", maxLength: 64, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_f11696b6fafcf3662d4292734f8", x => x.id);
});
migrationBuilder.CreateTable(
name: "relay",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
inbox = table.Column(type: "character varying(512)", maxLength: 512, nullable: false),
status = table.Column(type: "relay_status_enum", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_78ebc9cfddf4292633b7ba57aee", x => x.id);
});
migrationBuilder.CreateTable(
name: "used_username",
columns: table => new
{
username = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
createdAt = table.Column(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_78fd79d2d24c6ac2f4cc9a31a5d", x => x.username);
});
migrationBuilder.CreateTable(
name: "user_pending",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
createdAt = table.Column(type: "timestamp with time zone", nullable: false),
code = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
username = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
email = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
password = table.Column(type: "character varying(128)", maxLength: 128, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_d4c84e013c98ec02d19b8fbbafa", x => x.id);
});
migrationBuilder.CreateTable(
name: "abuse_user_report",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
createdAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "The created date of the AbuseUserReport."),
targetUserId = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
reporterId = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
assigneeId = table.Column(type: "character varying(32)", maxLength: 32, nullable: true),
resolved = table.Column(type: "boolean", nullable: false, defaultValue: false),
comment = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: false),
targetUserHost = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "[Denormalized]"),
reporterHost = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "[Denormalized]"),
forwarded = table.Column(type: "boolean", nullable: false, defaultValue: false)
},
constraints: table =>
{
table.PrimaryKey("PK_87873f5f5cc5c321a1306b2d18c", x => x.id);
});
migrationBuilder.CreateTable(
name: "access_token",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
createdAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "The created date of the AccessToken."),
token = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
hash = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
userId = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
appId = table.Column(type: "character varying(32)", maxLength: 32, nullable: true),
lastUsedAt = table.Column(type: "timestamp with time zone", nullable: true),
session = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
name = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
description = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
iconUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
permission = table.Column>(type: "character varying(64)[]", nullable: false, defaultValueSql: "'{}'::character varying[]"),
fetched = table.Column(type: "boolean", nullable: false, defaultValue: false)
},
constraints: table =>
{
table.PrimaryKey("PK_f20f028607b2603deabd8182d12", x => x.id);
});
migrationBuilder.CreateTable(
name: "announcement_read",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
userId = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
announcementId = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
createdAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "The created date of the AnnouncementRead.")
},
constraints: table =>
{
table.PrimaryKey("PK_4b90ad1f42681d97b2683890c5e", x => x.id);
table.ForeignKey(
name: "FK_603a7b1e7aa0533c6c88e9bfafe",
column: x => x.announcementId,
principalTable: "announcement",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "antenna",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
createdAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "The created date of the Antenna."),
userId = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "The owner ID."),
name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "The name of the Antenna."),
src = table.Column(type: "antenna_src_enum", nullable: false),
userListId = table.Column(type: "character varying(32)", maxLength: 32, nullable: true),
keywords = table.Column(type: "jsonb", nullable: false, defaultValueSql: "'[]'::jsonb"),
withFile = table.Column(type: "boolean", nullable: false),
expression = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: true),
notify = table.Column(type: "boolean", nullable: false),
caseSensitive = table.Column(type: "boolean", nullable: false, defaultValue: false),
withReplies = table.Column(type: "boolean", nullable: false, defaultValue: false),
userGroupJoiningId = table.Column(type: "character varying(32)", maxLength: 32, nullable: true),
users = table.Column>(type: "character varying(1024)[]", nullable: false, defaultValueSql: "'{}'::character varying[]"),
excludeKeywords = table.Column(type: "jsonb", nullable: false, defaultValueSql: "'[]'::jsonb"),
instances = table.Column(type: "jsonb", nullable: false, defaultValueSql: "'[]'::jsonb")
},
constraints: table =>
{
table.PrimaryKey("PK_c170b99775e1dccca947c9f2d5f", x => x.id);
});
migrationBuilder.CreateTable(
name: "app",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
createdAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "The created date of the App."),
userId = table.Column(type: "character varying(32)", maxLength: 32, nullable: true, comment: "The owner ID."),
secret = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "The secret key of the App."),
name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "The name of the App."),
description = table.Column(type: "character varying(512)", maxLength: 512, nullable: false, comment: "The description of the App."),
permission = table.Column>(type: "character varying(64)[]", nullable: false, comment: "The permission of the App."),
callbackUrl = table.Column(type: "character varying(512)", maxLength: 512, nullable: true, comment: "The callbackUrl of the App.")
},
constraints: table =>
{
table.PrimaryKey("PK_9478629fc093d229df09e560aea", x => x.id);
});
migrationBuilder.CreateTable(
name: "attestation_challenge",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
userId = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
challenge = table.Column(type: "character varying(64)", maxLength: 64, nullable: false, comment: "Hex-encoded sha256 hash of the challenge."),
createdAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "The date challenge was created for expiry purposes."),
registrationChallenge = table.Column(type: "boolean", nullable: false, defaultValue: false, comment: "Indicates that the challenge is only for registration purposes if true to prevent the challenge for being used as authentication.")
},
constraints: table =>
{
table.PrimaryKey("PK_d0ba6786e093f1bcb497572a6b5", x => new { x.id, x.userId });
});
migrationBuilder.CreateTable(
name: "auth_session",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
createdAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "The created date of the AuthSession."),
token = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
userId = table.Column(type: "character varying(32)", maxLength: 32, nullable: true),
appId = table.Column(type: "character varying(32)", maxLength: 32, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_19354ed146424a728c1112a8cbf", x => x.id);
table.ForeignKey(
name: "FK_dbe037d4bddd17b03a1dc778dee",
column: x => x.appId,
principalTable: "app",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "blocking",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
createdAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "The created date of the Blocking."),
blockeeId = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "The blockee user ID."),
blockerId = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "The blocker user ID.")
},
constraints: table =>
{
table.PrimaryKey("PK_e5d9a541cc1965ee7e048ea09dd", x => x.id);
});
migrationBuilder.CreateTable(
name: "channel",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
createdAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "The created date of the Channel."),
lastNotedAt = table.Column(type: "timestamp with time zone", nullable: true),
userId = table.Column(type: "character varying(32)", maxLength: 32, nullable: true, comment: "The owner ID."),
name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "The name of the Channel."),
description = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: true, comment: "The description of the Channel."),
bannerId = table.Column(type: "character varying(32)", maxLength: 32, nullable: true, comment: "The ID of banner Channel."),
notesCount = table.Column(type: "integer", nullable: false, defaultValue: 0, comment: "The count of notes."),
usersCount = table.Column(type: "integer", nullable: false, defaultValue: 0, comment: "The count of users.")
},
constraints: table =>
{
table.PrimaryKey("PK_590f33ee6ee7d76437acf362e39", x => x.id);
});
migrationBuilder.CreateTable(
name: "channel_following",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
createdAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "The created date of the ChannelFollowing."),
followeeId = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "The followee channel ID."),
followerId = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "The follower user ID.")
},
constraints: table =>
{
table.PrimaryKey("PK_8b104be7f7415113f2a02cd5bdd", x => x.id);
table.ForeignKey(
name: "FK_0e43068c3f92cab197c3d3cd86e",
column: x => x.followeeId,
principalTable: "channel",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "channel_note_pining",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
createdAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "The created date of the ChannelNotePining."),
channelId = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
noteId = table.Column(type: "character varying(32)", maxLength: 32, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_44f7474496bcf2e4b741681146d", x => x.id);
table.ForeignKey(
name: "FK_8125f950afd3093acb10d2db8a8",
column: x => x.channelId,
principalTable: "channel",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "clip",
columns: table => new
{
id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
createdAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "The created date of the Clip."),
userId = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "The owner ID."),
name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "The name of the Clip."),
isPublic = table.Column(type: "boolean", nullable: false, defaultValue: false),
description = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: true, comment: "The description of the Clip.")
},
constraints: table =>
{
table.PrimaryKey("PK_f0685dac8d4dd056d7255670b75", x => x.id);
});
migrationBuilder.CreateTable(
name: "clip_note",
columns: table => new
{
id = table.Column