diff --git a/packages/backend/check_connect.js b/packages/backend/check_connect.js index 8bf134a10..7c1e716b3 100644 --- a/packages/backend/check_connect.js +++ b/packages/backend/check_connect.js @@ -1,10 +1,10 @@ -import {loadConfig} from './built/config.js'; -import {createRedisConnection} from "./built/redis.js"; +import { loadConfig } from "./built/config.js"; +import { createRedisConnection } from "./built/redis.js"; const config = loadConfig(); const redis = createRedisConnection(config); -redis.on('connect', () => redis.disconnect()); -redis.on('error', (e) => { - throw e; +redis.on("connect", () => redis.disconnect()); +redis.on("error", (e) => { + throw e; }); diff --git a/packages/backend/migration/1000000000000-Init.js b/packages/backend/migration/1000000000000-Init.js index 1140be7e8..c07500e35 100644 --- a/packages/backend/migration/1000000000000-Init.js +++ b/packages/backend/migration/1000000000000-Init.js @@ -1,482 +1,1068 @@ - - export class Init1000000000000 { - async up(queryRunner) { - await queryRunner.query(`CREATE TYPE "log_level_enum" AS ENUM('error', 'warning', 'info', 'success', 'debug')`); - await queryRunner.query(`CREATE TABLE "log" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "domain" character varying(64) array NOT NULL DEFAULT '{}'::varchar[], "level" "log_level_enum" NOT NULL, "worker" character varying(8) NOT NULL, "machine" character varying(128) NOT NULL, "message" character varying(1024) NOT NULL, "data" jsonb NOT NULL DEFAULT '{}', CONSTRAINT "PK_350604cbdf991d5930d9e618fbd" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_8e4eb51a35d81b64dda28eed0a" ON "log" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_8cb40cfc8f3c28261e6f887b03" ON "log" ("domain") `); - await queryRunner.query(`CREATE INDEX "IDX_584b536b49e53ac81beb39a177" ON "log" ("level") `); - await queryRunner.query(`CREATE TABLE "drive_folder" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "name" character varying(128) NOT NULL, "userId" character varying(32), "parentId" character varying(32), CONSTRAINT "PK_7a0c089191f5ebdc214e0af808a" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_02878d441ceae15ce060b73daf" ON "drive_folder" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_f4fc06e49c0171c85f1c48060d" ON "drive_folder" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_00ceffb0cdc238b3233294f08f" ON "drive_folder" ("parentId") `); - await queryRunner.query(`CREATE TABLE "drive_file" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32), "userHost" character varying(128), "md5" character varying(32) NOT NULL, "name" character varying(256) NOT NULL, "type" character varying(128) NOT NULL, "size" integer NOT NULL, "comment" character varying(512), "properties" jsonb NOT NULL DEFAULT '{}', "storedInternal" boolean NOT NULL, "url" character varying(512) NOT NULL, "thumbnailUrl" character varying(512), "webpublicUrl" character varying(512), "accessKey" character varying(256), "thumbnailAccessKey" character varying(256), "webpublicAccessKey" character varying(256), "uri" character varying(512), "src" character varying(512), "folderId" character varying(32), "isSensitive" boolean NOT NULL DEFAULT false, "isLink" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_43ddaaaf18c9e68029b7cbb032e" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_c8dfad3b72196dd1d6b5db168a" ON "drive_file" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_860fa6f6c7df5bb887249fba22" ON "drive_file" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_92779627994ac79277f070c91e" ON "drive_file" ("userHost") `); - await queryRunner.query(`CREATE INDEX "IDX_37bb9a1b4585f8a3beb24c62d6" ON "drive_file" ("md5") `); - await queryRunner.query(`CREATE INDEX "IDX_a40b8df8c989d7db937ea27cf6" ON "drive_file" ("type") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_d85a184c2540d2deba33daf642" ON "drive_file" ("accessKey") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_e74022ce9a074b3866f70e0d27" ON "drive_file" ("thumbnailAccessKey") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_c55b2b7c284d9fef98026fc88e" ON "drive_file" ("webpublicAccessKey") `); - await queryRunner.query(`CREATE INDEX "IDX_e5848eac4940934e23dbc17581" ON "drive_file" ("uri") `); - await queryRunner.query(`CREATE INDEX "IDX_bb90d1956dafc4068c28aa7560" ON "drive_file" ("folderId") `); - await queryRunner.query(`CREATE TABLE "user" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE, "lastFetchedAt" TIMESTAMP WITH TIME ZONE, "username" character varying(128) NOT NULL, "usernameLower" character varying(128) NOT NULL, "name" character varying(128), "followersCount" integer NOT NULL DEFAULT 0, "followingCount" integer NOT NULL DEFAULT 0, "notesCount" integer NOT NULL DEFAULT 0, "avatarId" character varying(32), "bannerId" character varying(32), "tags" character varying(128) array NOT NULL DEFAULT '{}'::varchar[], "avatarUrl" character varying(512), "bannerUrl" character varying(512), "avatarColor" character varying(32), "bannerColor" character varying(32), "isSuspended" boolean NOT NULL DEFAULT false, "isSilenced" boolean NOT NULL DEFAULT false, "isLocked" boolean NOT NULL DEFAULT false, "isBot" boolean NOT NULL DEFAULT false, "isCat" boolean NOT NULL DEFAULT false, "isAdmin" boolean NOT NULL DEFAULT false, "isModerator" boolean NOT NULL DEFAULT false, "isVerified" boolean NOT NULL DEFAULT false, "emojis" character varying(128) array NOT NULL DEFAULT '{}'::varchar[], "host" character varying(128), "inbox" character varying(512), "sharedInbox" character varying(512), "featured" character varying(512), "uri" character varying(512), "token" character(16), CONSTRAINT "UQ_a854e557b1b14814750c7c7b0c9" UNIQUE ("token"), CONSTRAINT "REL_58f5c71eaab331645112cf8cfa" UNIQUE ("avatarId"), CONSTRAINT "REL_afc64b53f8db3707ceb34eb28e" UNIQUE ("bannerId"), CONSTRAINT "PK_cace4a159ff9f2512dd42373760" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_e11e649824a45d8ed01d597fd9" ON "user" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_80ca6e6ef65fb9ef34ea8c90f4" ON "user" ("updatedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_a27b942a0d6dcff90e3ee9b5e8" ON "user" ("usernameLower") `); - await queryRunner.query(`CREATE INDEX "IDX_fa99d777623947a5b05f394cae" ON "user" ("tags") `); - await queryRunner.query(`CREATE INDEX "IDX_3252a5df8d5bbd16b281f7799e" ON "user" ("host") `); - await queryRunner.query(`CREATE INDEX "IDX_be623adaa4c566baf5d29ce0c8" ON "user" ("uri") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_a854e557b1b14814750c7c7b0c" ON "user" ("token") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_5deb01ae162d1d70b80d064c27" ON "user" ("usernameLower", "host") `); - await queryRunner.query(`CREATE TABLE "app" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32), "secret" character varying(64) NOT NULL, "name" character varying(128) NOT NULL, "description" character varying(512) NOT NULL, "permission" character varying(64) array NOT NULL, "callbackUrl" character varying(512), CONSTRAINT "PK_9478629fc093d229df09e560aea" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_048a757923ed8b157e9895da53" ON "app" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_3f5b0899ef90527a3462d7c2cb" ON "app" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_f49922d511d666848f250663c4" ON "app" ("secret") `); - await queryRunner.query(`CREATE TABLE "access_token" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "token" character varying(128) NOT NULL, "hash" character varying(128) NOT NULL, "userId" character varying(32) NOT NULL, "appId" character varying(32) NOT NULL, CONSTRAINT "PK_f20f028607b2603deabd8182d12" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_70ba8f6af34bc924fc9e12adb8" ON "access_token" ("token") `); - await queryRunner.query(`CREATE INDEX "IDX_64c327441248bae40f7d92f34f" ON "access_token" ("hash") `); - await queryRunner.query(`CREATE INDEX "IDX_9949557d0e1b2c19e5344c171e" ON "access_token" ("userId") `); - await queryRunner.query(`CREATE TYPE "note_visibility_enum" AS ENUM('public', 'home', 'followers', 'specified')`); - await queryRunner.query(`CREATE TABLE "note" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "replyId" character varying(32), "renoteId" character varying(32), "text" text, "name" character varying(256), "cw" character varying(512), "appId" character varying(32), "userId" character varying(32) NOT NULL, "viaMobile" boolean NOT NULL DEFAULT false, "localOnly" boolean NOT NULL DEFAULT false, "renoteCount" smallint NOT NULL DEFAULT 0, "repliesCount" smallint NOT NULL DEFAULT 0, "reactions" jsonb NOT NULL DEFAULT '{}', "visibility" "note_visibility_enum" NOT NULL, "uri" character varying(512), "score" integer NOT NULL DEFAULT 0, "fileIds" character varying(32) array NOT NULL DEFAULT '{}'::varchar[], "attachedFileTypes" character varying(256) array NOT NULL DEFAULT '{}'::varchar[], "visibleUserIds" character varying(32) array NOT NULL DEFAULT '{}'::varchar[], "mentions" character varying(32) array NOT NULL DEFAULT '{}'::varchar[], "mentionedRemoteUsers" text NOT NULL DEFAULT '[]', "emojis" character varying(128) array NOT NULL DEFAULT '{}'::varchar[], "tags" character varying(128) array NOT NULL DEFAULT '{}'::varchar[], "hasPoll" boolean NOT NULL DEFAULT false, "geo" jsonb DEFAULT null, "userHost" character varying(128), "replyUserId" character varying(32), "replyUserHost" character varying(128), "renoteUserId" character varying(32), "renoteUserHost" character varying(128), CONSTRAINT "PK_96d0c172a4fba276b1bbed43058" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_e7c0567f5261063592f022e9b5" ON "note" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_17cb3553c700a4985dff5a30ff" ON "note" ("replyId") `); - await queryRunner.query(`CREATE INDEX "IDX_52ccc804d7c69037d558bac4c9" ON "note" ("renoteId") `); - await queryRunner.query(`CREATE INDEX "IDX_5b87d9d19127bd5d92026017a7" ON "note" ("userId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_153536c67d05e9adb24e99fc2b" ON "note" ("uri") `); - await queryRunner.query(`CREATE INDEX "IDX_51c063b6a133a9cb87145450f5" ON "note" ("fileIds") `); - await queryRunner.query(`CREATE INDEX "IDX_25dfc71b0369b003a4cd434d0b" ON "note" ("attachedFileTypes") `); - await queryRunner.query(`CREATE INDEX "IDX_796a8c03959361f97dc2be1d5c" ON "note" ("visibleUserIds") `); - await queryRunner.query(`CREATE INDEX "IDX_54ebcb6d27222913b908d56fd8" ON "note" ("mentions") `); - await queryRunner.query(`CREATE INDEX "IDX_88937d94d7443d9a99a76fa5c0" ON "note" ("tags") `); - await queryRunner.query(`CREATE INDEX "IDX_7125a826ab192eb27e11d358a5" ON "note" ("userHost") `); - await queryRunner.query(`CREATE TABLE "poll_vote" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, "choice" integer NOT NULL, CONSTRAINT "PK_fd002d371201c472490ba89c6a0" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_0fb627e1c2f753262a74f0562d" ON "poll_vote" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_66d2bd2ee31d14bcc23069a89f" ON "poll_vote" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_aecfbd5ef60374918e63ee95fa" ON "poll_vote" ("noteId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_50bd7164c5b78f1f4a42c4d21f" ON "poll_vote" ("userId", "noteId", "choice") `); - await queryRunner.query(`CREATE TABLE "note_reaction" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, "reaction" character varying(128) NOT NULL, CONSTRAINT "PK_767ec729b108799b587a3fcc9cf" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_01f4581f114e0ebd2bbb876f0b" ON "note_reaction" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_13761f64257f40c5636d0ff95e" ON "note_reaction" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_45145e4953780f3cd5656f0ea6" ON "note_reaction" ("noteId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_ad0c221b25672daf2df320a817" ON "note_reaction" ("userId", "noteId") `); - await queryRunner.query(`CREATE TABLE "note_watching" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, "noteUserId" character varying(32) NOT NULL, CONSTRAINT "PK_49286fdb23725945a74aa27d757" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_318cdf42a9cfc11f479bd802bb" ON "note_watching" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_b0134ec406e8d09a540f818288" ON "note_watching" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_03e7028ab8388a3f5e3ce2a861" ON "note_watching" ("noteId") `); - await queryRunner.query(`CREATE INDEX "IDX_44499765eec6b5489d72c4253b" ON "note_watching" ("noteUserId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_a42c93c69989ce1d09959df4cf" ON "note_watching" ("userId", "noteId") `); - await queryRunner.query(`CREATE TABLE "note_unread" ("id" character varying(32) NOT NULL, "userId" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, "noteUserId" character varying(32) NOT NULL, "isSpecified" boolean NOT NULL, CONSTRAINT "PK_1904eda61a784f57e6e51fa9c1f" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_56b0166d34ddae49d8ef7610bb" ON "note_unread" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_e637cba4dc4410218c4251260e" ON "note_unread" ("noteId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_d908433a4953cc13216cd9c274" ON "note_unread" ("userId", "noteId") `); - await queryRunner.query(`CREATE TABLE "notification" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "notifieeId" character varying(32) NOT NULL, "notifierId" character varying(32) NOT NULL, "type" character varying(32) NOT NULL, "isRead" boolean NOT NULL DEFAULT false, "noteId" character varying(32), "reaction" character varying(128), "choice" integer, CONSTRAINT "PK_705b6c7cdf9b2c2ff7ac7872cb7" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_b11a5e627c41d4dc3170f1d370" ON "notification" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_3c601b70a1066d2c8b517094cb" ON "notification" ("notifieeId") `); - await queryRunner.query(`CREATE TABLE "meta" ("id" character varying(32) NOT NULL, "name" character varying(128), "description" character varying(1024), "maintainerName" character varying(128), "maintainerEmail" character varying(128), "announcements" jsonb NOT NULL DEFAULT '[]', "disableRegistration" boolean NOT NULL DEFAULT false, "disableLocalTimeline" boolean NOT NULL DEFAULT false, "disableGlobalTimeline" boolean NOT NULL DEFAULT false, "enableEmojiReaction" boolean NOT NULL DEFAULT true, "useStarForReactionFallback" boolean NOT NULL DEFAULT false, "langs" character varying(64) array NOT NULL DEFAULT '{}'::varchar[], "hiddenTags" character varying(256) array NOT NULL DEFAULT '{}'::varchar[], "blockedHosts" character varying(256) array NOT NULL DEFAULT '{}'::varchar[], "mascotImageUrl" character varying(512) DEFAULT '/assets/ai.png', "bannerUrl" character varying(512), "errorImageUrl" character varying(512) DEFAULT 'https://xn--931a.moe/aiart/yubitun.png', "iconUrl" character varying(512), "cacheRemoteFiles" boolean NOT NULL DEFAULT true, "proxyAccount" character varying(128), "enableRecaptcha" boolean NOT NULL DEFAULT false, "recaptchaSiteKey" character varying(64), "recaptchaSecretKey" character varying(64), "localDriveCapacityMb" integer NOT NULL DEFAULT 1024, "remoteDriveCapacityMb" integer NOT NULL DEFAULT 32, "maxNoteTextLength" integer NOT NULL DEFAULT 500, "summalyProxy" character varying(128), "enableEmail" boolean NOT NULL DEFAULT false, "email" character varying(128), "smtpSecure" boolean NOT NULL DEFAULT false, "smtpHost" character varying(128), "smtpPort" integer, "smtpUser" character varying(128), "smtpPass" character varying(128), "enableServiceWorker" boolean NOT NULL DEFAULT false, "swPublicKey" character varying(128), "swPrivateKey" character varying(128), "enableTwitterIntegration" boolean NOT NULL DEFAULT false, "twitterConsumerKey" character varying(128), "twitterConsumerSecret" character varying(128), "enableGithubIntegration" boolean NOT NULL DEFAULT false, "githubClientId" character varying(128), "githubClientSecret" character varying(128), "enableDiscordIntegration" boolean NOT NULL DEFAULT false, "discordClientId" character varying(128), "discordClientSecret" character varying(128), CONSTRAINT "PK_c4c17a6c2bd7651338b60fc590b" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE TABLE "following" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "followeeId" character varying(32) NOT NULL, "followerId" character varying(32) NOT NULL, "followerHost" character varying(128), "followerInbox" character varying(512), "followerSharedInbox" character varying(512), "followeeHost" character varying(128), "followeeInbox" character varying(512), "followeeSharedInbox" character varying(512), CONSTRAINT "PK_c76c6e044bdf76ecf8bfb82a645" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_582f8fab771a9040a12961f3e7" ON "following" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_24e0042143a18157b234df186c" ON "following" ("followeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_6516c5a6f3c015b4eed39978be" ON "following" ("followerId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_307be5f1d1252e0388662acb96" ON "following" ("followerId", "followeeId") `); - await queryRunner.query(`CREATE TABLE "instance" ("id" character varying(32) NOT NULL, "caughtAt" TIMESTAMP WITH TIME ZONE NOT NULL, "host" character varying(128) NOT NULL, "system" character varying(64), "usersCount" integer NOT NULL DEFAULT 0, "notesCount" integer NOT NULL DEFAULT 0, "followingCount" integer NOT NULL DEFAULT 0, "followersCount" integer NOT NULL DEFAULT 0, "driveUsage" integer NOT NULL DEFAULT 0, "driveFiles" integer NOT NULL DEFAULT 0, "latestRequestSentAt" TIMESTAMP WITH TIME ZONE, "latestStatus" integer, "latestRequestReceivedAt" TIMESTAMP WITH TIME ZONE, "lastCommunicatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, "isNotResponding" boolean NOT NULL DEFAULT false, "isMarkedAsClosed" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_eaf60e4a0c399c9935413e06474" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_2cd3b2a6b4cf0b910b260afe08" ON "instance" ("caughtAt") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_8d5afc98982185799b160e10eb" ON "instance" ("host") `); - await queryRunner.query(`CREATE TABLE "muting" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "muteeId" character varying(32) NOT NULL, "muterId" character varying(32) NOT NULL, CONSTRAINT "PK_2e92d06c8b5c602eeb27ca9ba48" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_f86d57fbca33c7a4e6897490cc" ON "muting" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_ec96b4fed9dae517e0dbbe0675" ON "muting" ("muteeId") `); - await queryRunner.query(`CREATE INDEX "IDX_93060675b4a79a577f31d260c6" ON "muting" ("muterId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_1eb9d9824a630321a29fd3b290" ON "muting" ("muterId", "muteeId") `); - await queryRunner.query(`CREATE TABLE "sw_subscription" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "endpoint" character varying(512) NOT NULL, "auth" character varying(256) NOT NULL, "publickey" character varying(128) NOT NULL, CONSTRAINT "PK_e8f763631530051b95eb6279b91" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_97754ca6f2baff9b4abb7f853d" ON "sw_subscription" ("userId") `); - await queryRunner.query(`CREATE TABLE "blocking" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "blockeeId" character varying(32) NOT NULL, "blockerId" character varying(32) NOT NULL, CONSTRAINT "PK_e5d9a541cc1965ee7e048ea09dd" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_b9a354f7941c1e779f3b33aea6" ON "blocking" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_2cd4a2743a99671308f5417759" ON "blocking" ("blockeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_0627125f1a8a42c9a1929edb55" ON "blocking" ("blockerId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_98a1bc5cb30dfd159de056549f" ON "blocking" ("blockerId", "blockeeId") `); - await queryRunner.query(`CREATE TABLE "user_list" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "name" character varying(128) NOT NULL, CONSTRAINT "PK_87bab75775fd9b1ff822b656402" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_b7fcefbdd1c18dce86687531f9" ON "user_list" ("userId") `); - await queryRunner.query(`CREATE TABLE "user_list_joining" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "userListId" character varying(32) NOT NULL, CONSTRAINT "PK_11abb3768da1c5f8de101c9df45" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_d844bfc6f3f523a05189076efa" ON "user_list_joining" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_605472305f26818cc93d1baaa7" ON "user_list_joining" ("userListId") `); - await queryRunner.query(`CREATE TABLE "hashtag" ("id" character varying(32) NOT NULL, "name" character varying(128) NOT NULL, "mentionedUserIds" character varying(32) array NOT NULL, "mentionedUsersCount" integer NOT NULL DEFAULT 0, "mentionedLocalUserIds" character varying(32) array NOT NULL, "mentionedLocalUsersCount" integer NOT NULL DEFAULT 0, "mentionedRemoteUserIds" character varying(32) array NOT NULL, "mentionedRemoteUsersCount" integer NOT NULL DEFAULT 0, "attachedUserIds" character varying(32) array NOT NULL, "attachedUsersCount" integer NOT NULL DEFAULT 0, "attachedLocalUserIds" character varying(32) array NOT NULL, "attachedLocalUsersCount" integer NOT NULL DEFAULT 0, "attachedRemoteUserIds" character varying(32) array NOT NULL, "attachedRemoteUsersCount" integer NOT NULL DEFAULT 0, CONSTRAINT "PK_cb36eb8af8412bfa978f1165d78" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_347fec870eafea7b26c8a73bac" ON "hashtag" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_2710a55f826ee236ea1a62698f" ON "hashtag" ("mentionedUsersCount") `); - await queryRunner.query(`CREATE INDEX "IDX_0e206cec573f1edff4a3062923" ON "hashtag" ("mentionedLocalUsersCount") `); - await queryRunner.query(`CREATE INDEX "IDX_4c02d38a976c3ae132228c6fce" ON "hashtag" ("mentionedRemoteUsersCount") `); - await queryRunner.query(`CREATE INDEX "IDX_d57f9030cd3af7f63ffb1c267c" ON "hashtag" ("attachedUsersCount") `); - await queryRunner.query(`CREATE INDEX "IDX_0c44bf4f680964145f2a68a341" ON "hashtag" ("attachedLocalUsersCount") `); - await queryRunner.query(`CREATE INDEX "IDX_0b03cbcd7e6a7ce068efa8ecc2" ON "hashtag" ("attachedRemoteUsersCount") `); - await queryRunner.query(`CREATE TABLE "note_favorite" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, CONSTRAINT "PK_af0da35a60b9fa4463a62082b36" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_47f4b1892f5d6ba8efb3057d81" ON "note_favorite" ("userId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_0f4fb9ad355f3effff221ef245" ON "note_favorite" ("userId", "noteId") `); - await queryRunner.query(`CREATE TABLE "abuse_user_report" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "reporterId" character varying(32) NOT NULL, "comment" character varying(512) NOT NULL, CONSTRAINT "PK_87873f5f5cc5c321a1306b2d18c" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_db2098070b2b5a523c58181f74" ON "abuse_user_report" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_d049123c413e68ca52abe73420" ON "abuse_user_report" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_04cc96756f89d0b7f9473e8cdf" ON "abuse_user_report" ("reporterId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_5cd442c3b2e74fdd99dae20243" ON "abuse_user_report" ("userId", "reporterId") `); - await queryRunner.query(`CREATE TABLE "registration_ticket" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "code" character varying(64) NOT NULL, CONSTRAINT "PK_f11696b6fafcf3662d4292734f8" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_0ff69e8dfa9fe31bb4a4660f59" ON "registration_ticket" ("code") `); - await queryRunner.query(`CREATE TABLE "messaging_message" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "recipientId" character varying(32) NOT NULL, "text" character varying(4096), "isRead" boolean NOT NULL DEFAULT false, "fileId" character varying(32), CONSTRAINT "PK_db398fd79dc95d0eb8c30456eaa" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_e21cd3646e52ef9c94aaf17c2e" ON "messaging_message" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_5377c307783fce2b6d352e1203" ON "messaging_message" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_cac14a4e3944454a5ce7daa514" ON "messaging_message" ("recipientId") `); - await queryRunner.query(`CREATE TABLE "signin" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "ip" character varying(128) NOT NULL, "headers" jsonb NOT NULL, "success" boolean NOT NULL, CONSTRAINT "PK_9e96ddc025712616fc492b3b588" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_2c308dbdc50d94dc625670055f" ON "signin" ("userId") `); - await queryRunner.query(`CREATE TABLE "auth_session" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "token" character varying(128) NOT NULL, "userId" character varying(32), "appId" character varying(32) NOT NULL, CONSTRAINT "PK_19354ed146424a728c1112a8cbf" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_62cb09e1129f6ec024ef66e183" ON "auth_session" ("token") `); - await queryRunner.query(`CREATE TABLE "follow_request" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "followeeId" character varying(32) NOT NULL, "followerId" character varying(32) NOT NULL, "requestId" character varying(128), "followerHost" character varying(128), "followerInbox" character varying(512), "followerSharedInbox" character varying(512), "followeeHost" character varying(128), "followeeInbox" character varying(512), "followeeSharedInbox" character varying(512), CONSTRAINT "PK_53a9aa3725f7a3deb150b39dbfc" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_12c01c0d1a79f77d9f6c15fadd" ON "follow_request" ("followeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_a7fd92dd6dc519e6fb435dd108" ON "follow_request" ("followerId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_d54a512b822fac7ed52800f6b4" ON "follow_request" ("followerId", "followeeId") `); - await queryRunner.query(`CREATE TABLE "emoji" ("id" character varying(32) NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE, "name" character varying(128) NOT NULL, "host" character varying(128), "url" character varying(512) NOT NULL, "uri" character varying(512), "type" character varying(64), "aliases" character varying(128) array NOT NULL DEFAULT '{}'::varchar[], CONSTRAINT "PK_df74ce05e24999ee01ea0bc50a3" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_b37dafc86e9af007e3295c2781" ON "emoji" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_5900e907bb46516ddf2871327c" ON "emoji" ("host") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_4f4d35e1256c84ae3d1f0eab10" ON "emoji" ("name", "host") `); - await queryRunner.query(`CREATE TABLE "reversi_game" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "startedAt" TIMESTAMP WITH TIME ZONE, "user1Id" character varying(32) NOT NULL, "user2Id" character varying(32) NOT NULL, "user1Accepted" boolean NOT NULL DEFAULT false, "user2Accepted" boolean NOT NULL DEFAULT false, "black" integer, "isStarted" boolean NOT NULL DEFAULT false, "isEnded" boolean NOT NULL DEFAULT false, "winnerId" character varying(32), "surrendered" character varying(32), "logs" jsonb NOT NULL DEFAULT '[]', "map" character varying(64) array NOT NULL, "bw" character varying(32) NOT NULL, "isLlotheo" boolean NOT NULL DEFAULT false, "canPutEverywhere" boolean NOT NULL DEFAULT false, "loopedBoard" boolean NOT NULL DEFAULT false, "form1" jsonb DEFAULT null, "form2" jsonb DEFAULT null, "crc32" character varying(32), CONSTRAINT "PK_76b30eeba71b1193ad7c5311c3f" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_b46ec40746efceac604142be1c" ON "reversi_game" ("createdAt") `); - await queryRunner.query(`CREATE TABLE "reversi_matching" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "parentId" character varying(32) NOT NULL, "childId" character varying(32) NOT NULL, CONSTRAINT "PK_880bd0afbab232f21c8b9d146cf" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_b604d92d6c7aec38627f6eaf16" ON "reversi_matching" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_3b25402709dd9882048c2bbade" ON "reversi_matching" ("parentId") `); - await queryRunner.query(`CREATE INDEX "IDX_e247b23a3c9b45f89ec1299d06" ON "reversi_matching" ("childId") `); - await queryRunner.query(`CREATE TABLE "user_note_pining" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, CONSTRAINT "PK_a6a2dad4ae000abce2ea9d9b103" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_bfbc6f79ba4007b4ce5097f08d" ON "user_note_pining" ("userId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_410cd649884b501c02d6e72738" ON "user_note_pining" ("userId", "noteId") `); - await queryRunner.query(`CREATE TYPE "poll_notevisibility_enum" AS ENUM('public', 'home', 'followers', 'specified')`); - await queryRunner.query(`CREATE TABLE "poll" ("noteId" character varying(32) NOT NULL, "expiresAt" TIMESTAMP WITH TIME ZONE, "multiple" boolean NOT NULL, "choices" character varying(128) array NOT NULL DEFAULT '{}'::varchar[], "votes" integer array NOT NULL, "noteVisibility" "poll_notevisibility_enum" NOT NULL, "userId" character varying(32) NOT NULL, "userHost" character varying(128), CONSTRAINT "REL_da851e06d0dfe2ef397d8b1bf1" UNIQUE ("noteId"), CONSTRAINT "PK_da851e06d0dfe2ef397d8b1bf1b" PRIMARY KEY ("noteId"))`); - await queryRunner.query(`CREATE INDEX "IDX_0610ebcfcfb4a18441a9bcdab2" ON "poll" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_7fa20a12319c7f6dc3aed98c0a" ON "poll" ("userHost") `); - await queryRunner.query(`CREATE TABLE "user_keypair" ("userId" character varying(32) NOT NULL, "publicKey" character varying(4096) NOT NULL, "privateKey" character varying(4096) NOT NULL, CONSTRAINT "REL_f4853eb41ab722fe05f81cedeb" UNIQUE ("userId"), CONSTRAINT "PK_f4853eb41ab722fe05f81cedeb6" PRIMARY KEY ("userId"))`); - await queryRunner.query(`CREATE TABLE "user_publickey" ("userId" character varying(32) NOT NULL, "keyId" character varying(256) NOT NULL, "keyPem" character varying(4096) NOT NULL, CONSTRAINT "REL_10c146e4b39b443ede016f6736" UNIQUE ("userId"), CONSTRAINT "PK_10c146e4b39b443ede016f6736d" PRIMARY KEY ("userId"))`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_171e64971c780ebd23fae140bb" ON "user_publickey" ("keyId") `); - await queryRunner.query(`CREATE TABLE "user_profile" ("userId" character varying(32) NOT NULL, "location" character varying(128), "birthday" character(10), "description" character varying(1024), "fields" jsonb NOT NULL DEFAULT '[]', "url" character varying(512), "email" character varying(128), "emailVerifyCode" character varying(128), "emailVerified" boolean NOT NULL DEFAULT false, "twoFactorTempSecret" character varying(128), "twoFactorSecret" character varying(128), "twoFactorEnabled" boolean NOT NULL DEFAULT false, "password" character varying(128), "clientData" jsonb NOT NULL DEFAULT '{}', "autoWatch" boolean NOT NULL DEFAULT false, "autoAcceptFollowed" boolean NOT NULL DEFAULT false, "alwaysMarkNsfw" boolean NOT NULL DEFAULT false, "carefulBot" boolean NOT NULL DEFAULT false, "twitter" boolean NOT NULL DEFAULT false, "twitterAccessToken" character varying(64) DEFAULT null, "twitterAccessTokenSecret" character varying(64) DEFAULT null, "twitterUserId" character varying(64) DEFAULT null, "twitterScreenName" character varying(64) DEFAULT null, "github" boolean NOT NULL DEFAULT false, "githubAccessToken" character varying(64) DEFAULT null, "githubId" integer DEFAULT null, "githubLogin" character varying(64) DEFAULT null, "discord" boolean NOT NULL DEFAULT false, "discordAccessToken" character varying(64) DEFAULT null, "discordRefreshToken" character varying(64) DEFAULT null, "discordExpiresDate" integer DEFAULT null, "discordId" character varying(64) DEFAULT null, "discordUsername" character varying(64) DEFAULT null, "discordDiscriminator" character varying(64) DEFAULT null, "userHost" character varying(128), CONSTRAINT "REL_51cb79b5555effaf7d69ba1cff" UNIQUE ("userId"), CONSTRAINT "PK_51cb79b5555effaf7d69ba1cff9" PRIMARY KEY ("userId"))`); - await queryRunner.query(`CREATE INDEX "IDX_dce530b98e454793dac5ec2f5a" ON "user_profile" ("userHost") `); - await queryRunner.query(`CREATE TYPE "__chart__active_users_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`CREATE TABLE "__chart__active_users" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__active_users_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___local_count" bigint NOT NULL, "___remote_count" bigint NOT NULL, CONSTRAINT "PK_317237a9f733b970604a11e314f" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE TYPE "__chart__drive_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`CREATE TABLE "__chart__drive" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__drive_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___local_totalCount" bigint NOT NULL, "___local_totalSize" bigint NOT NULL, "___local_incCount" bigint NOT NULL, "___local_incSize" bigint NOT NULL, "___local_decCount" bigint NOT NULL, "___local_decSize" bigint NOT NULL, "___remote_totalCount" bigint NOT NULL, "___remote_totalSize" bigint NOT NULL, "___remote_incCount" bigint NOT NULL, "___remote_incSize" bigint NOT NULL, "___remote_decCount" bigint NOT NULL, "___remote_decSize" bigint NOT NULL, CONSTRAINT "PK_f96bc548a765cd4b3b354221ce7" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE TYPE "__chart__federation_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`CREATE TABLE "__chart__federation" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__federation_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___instance_total" bigint NOT NULL, "___instance_inc" bigint NOT NULL, "___instance_dec" bigint NOT NULL, CONSTRAINT "PK_b39dcd31a0fe1a7757e348e85fd" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE TYPE "__chart__hashtag_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`CREATE TABLE "__chart__hashtag" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__hashtag_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___local_count" bigint NOT NULL, "___remote_count" bigint NOT NULL, CONSTRAINT "PK_c32f1ea2b44a5d2f7881e37f8f9" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE TYPE "__chart__instance_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`CREATE TABLE "__chart__instance" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__instance_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___requests_failed" bigint NOT NULL, "___requests_succeeded" bigint NOT NULL, "___requests_received" bigint NOT NULL, "___notes_total" bigint NOT NULL, "___notes_inc" bigint NOT NULL, "___notes_dec" bigint NOT NULL, "___notes_diffs_normal" bigint NOT NULL, "___notes_diffs_reply" bigint NOT NULL, "___notes_diffs_renote" bigint NOT NULL, "___users_total" bigint NOT NULL, "___users_inc" bigint NOT NULL, "___users_dec" bigint NOT NULL, "___following_total" bigint NOT NULL, "___following_inc" bigint NOT NULL, "___following_dec" bigint NOT NULL, "___followers_total" bigint NOT NULL, "___followers_inc" bigint NOT NULL, "___followers_dec" bigint NOT NULL, "___drive_totalFiles" bigint NOT NULL, "___drive_totalUsage" bigint NOT NULL, "___drive_incFiles" bigint NOT NULL, "___drive_incUsage" bigint NOT NULL, "___drive_decFiles" bigint NOT NULL, "___drive_decUsage" bigint NOT NULL, CONSTRAINT "PK_1267c67c7c2d47b4903975f2c00" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE TYPE "__chart__network_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`CREATE TABLE "__chart__network" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__network_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___incomingRequests" bigint NOT NULL, "___outgoingRequests" bigint NOT NULL, "___totalTime" bigint NOT NULL, "___incomingBytes" bigint NOT NULL, "___outgoingBytes" bigint NOT NULL, CONSTRAINT "PK_bc4290c2e27fad14ef0c1ca93f3" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE TYPE "__chart__notes_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`CREATE TABLE "__chart__notes" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__notes_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___local_total" bigint NOT NULL, "___local_inc" bigint NOT NULL, "___local_dec" bigint NOT NULL, "___local_diffs_normal" bigint NOT NULL, "___local_diffs_reply" bigint NOT NULL, "___local_diffs_renote" bigint NOT NULL, "___remote_total" bigint NOT NULL, "___remote_inc" bigint NOT NULL, "___remote_dec" bigint NOT NULL, "___remote_diffs_normal" bigint NOT NULL, "___remote_diffs_reply" bigint NOT NULL, "___remote_diffs_renote" bigint NOT NULL, CONSTRAINT "PK_0aec823fa85c7f901bdb3863b14" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE TYPE "__chart__per_user_drive_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`CREATE TABLE "__chart__per_user_drive" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__per_user_drive_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___totalCount" bigint NOT NULL, "___totalSize" bigint NOT NULL, "___incCount" bigint NOT NULL, "___incSize" bigint NOT NULL, "___decCount" bigint NOT NULL, "___decSize" bigint NOT NULL, CONSTRAINT "PK_d0ef23d24d666e1a44a0cd3d208" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE TYPE "__chart__per_user_following_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`CREATE TABLE "__chart__per_user_following" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__per_user_following_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___local_followings_total" bigint NOT NULL, "___local_followings_inc" bigint NOT NULL, "___local_followings_dec" bigint NOT NULL, "___local_followers_total" bigint NOT NULL, "___local_followers_inc" bigint NOT NULL, "___local_followers_dec" bigint NOT NULL, "___remote_followings_total" bigint NOT NULL, "___remote_followings_inc" bigint NOT NULL, "___remote_followings_dec" bigint NOT NULL, "___remote_followers_total" bigint NOT NULL, "___remote_followers_inc" bigint NOT NULL, "___remote_followers_dec" bigint NOT NULL, CONSTRAINT "PK_85bb1b540363a29c2fec83bd907" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE TYPE "__chart__per_user_notes_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`CREATE TABLE "__chart__per_user_notes" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__per_user_notes_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___total" bigint NOT NULL, "___inc" bigint NOT NULL, "___dec" bigint NOT NULL, "___diffs_normal" bigint NOT NULL, "___diffs_reply" bigint NOT NULL, "___diffs_renote" bigint NOT NULL, CONSTRAINT "PK_334acf6e915af2f29edc11b8e50" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE TYPE "__chart__per_user_reaction_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`CREATE TABLE "__chart__per_user_reaction" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__per_user_reaction_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___local_count" bigint NOT NULL, "___remote_count" bigint NOT NULL, CONSTRAINT "PK_984f54dae441e65b633e8d27a7f" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE TYPE "__chart__test_grouped_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`CREATE TABLE "__chart__test_grouped" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__test_grouped_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___foo_total" bigint NOT NULL, "___foo_inc" bigint NOT NULL, "___foo_dec" bigint NOT NULL, CONSTRAINT "PK_f4a2b175d308695af30d4293272" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE TYPE "__chart__test_unique_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`CREATE TABLE "__chart__test_unique" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__test_unique_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___foo" bigint NOT NULL, CONSTRAINT "PK_409bac9c97cc612d8500012319d" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE TYPE "__chart__test_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`CREATE TABLE "__chart__test" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__test_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___foo_total" bigint NOT NULL, "___foo_inc" bigint NOT NULL, "___foo_dec" bigint NOT NULL, CONSTRAINT "PK_b4bc31dffbd1b785276a3ecfc1e" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE TYPE "__chart__users_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`CREATE TABLE "__chart__users" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__users_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___local_total" bigint NOT NULL, "___local_inc" bigint NOT NULL, "___local_dec" bigint NOT NULL, "___remote_total" bigint NOT NULL, "___remote_inc" bigint NOT NULL, "___remote_dec" bigint NOT NULL, CONSTRAINT "PK_4dfcf2c78d03524b9eb2c99d328" PRIMARY KEY ("id"))`); - await queryRunner.query(`ALTER TABLE "drive_folder" ADD CONSTRAINT "FK_f4fc06e49c0171c85f1c48060d2" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "drive_folder" ADD CONSTRAINT "FK_00ceffb0cdc238b3233294f08f2" FOREIGN KEY ("parentId") REFERENCES "drive_folder"("id") ON DELETE SET NULL ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "drive_file" ADD CONSTRAINT "FK_860fa6f6c7df5bb887249fba22e" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "drive_file" ADD CONSTRAINT "FK_bb90d1956dafc4068c28aa7560a" FOREIGN KEY ("folderId") REFERENCES "drive_folder"("id") ON DELETE SET NULL ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "user" ADD CONSTRAINT "FK_58f5c71eaab331645112cf8cfa5" FOREIGN KEY ("avatarId") REFERENCES "drive_file"("id") ON DELETE SET NULL ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "user" ADD CONSTRAINT "FK_afc64b53f8db3707ceb34eb28e2" FOREIGN KEY ("bannerId") REFERENCES "drive_file"("id") ON DELETE SET NULL ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "app" ADD CONSTRAINT "FK_3f5b0899ef90527a3462d7c2cb3" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "access_token" ADD CONSTRAINT "FK_9949557d0e1b2c19e5344c171e9" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "access_token" ADD CONSTRAINT "FK_a3ff16c90cc87a82a0b5959e560" FOREIGN KEY ("appId") REFERENCES "app"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "note" ADD CONSTRAINT "FK_17cb3553c700a4985dff5a30ff5" FOREIGN KEY ("replyId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "note" ADD CONSTRAINT "FK_52ccc804d7c69037d558bac4c96" FOREIGN KEY ("renoteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "note" ADD CONSTRAINT "FK_ec5c201576192ba8904c345c5cc" FOREIGN KEY ("appId") REFERENCES "app"("id") ON DELETE SET NULL ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "note" ADD CONSTRAINT "FK_5b87d9d19127bd5d92026017a7b" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "poll_vote" ADD CONSTRAINT "FK_66d2bd2ee31d14bcc23069a89f8" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "poll_vote" ADD CONSTRAINT "FK_aecfbd5ef60374918e63ee95fa7" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "note_reaction" ADD CONSTRAINT "FK_13761f64257f40c5636d0ff95ee" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "note_reaction" ADD CONSTRAINT "FK_45145e4953780f3cd5656f0ea6a" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "note_watching" ADD CONSTRAINT "FK_b0134ec406e8d09a540f8182888" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "note_watching" ADD CONSTRAINT "FK_03e7028ab8388a3f5e3ce2a8619" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "note_unread" ADD CONSTRAINT "FK_56b0166d34ddae49d8ef7610bb9" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "note_unread" ADD CONSTRAINT "FK_e637cba4dc4410218c4251260e4" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "notification" ADD CONSTRAINT "FK_3c601b70a1066d2c8b517094cb9" FOREIGN KEY ("notifieeId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "notification" ADD CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710" FOREIGN KEY ("notifierId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "notification" ADD CONSTRAINT "FK_769cb6b73a1efe22ddf733ac453" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "following" ADD CONSTRAINT "FK_24e0042143a18157b234df186c3" FOREIGN KEY ("followeeId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "following" ADD CONSTRAINT "FK_6516c5a6f3c015b4eed39978be5" FOREIGN KEY ("followerId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "muting" ADD CONSTRAINT "FK_ec96b4fed9dae517e0dbbe0675c" FOREIGN KEY ("muteeId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "muting" ADD CONSTRAINT "FK_93060675b4a79a577f31d260c67" FOREIGN KEY ("muterId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "sw_subscription" ADD CONSTRAINT "FK_97754ca6f2baff9b4abb7f853dd" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "blocking" ADD CONSTRAINT "FK_2cd4a2743a99671308f5417759e" FOREIGN KEY ("blockeeId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "blocking" ADD CONSTRAINT "FK_0627125f1a8a42c9a1929edb552" FOREIGN KEY ("blockerId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "user_list" ADD CONSTRAINT "FK_b7fcefbdd1c18dce86687531f99" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "user_list_joining" ADD CONSTRAINT "FK_d844bfc6f3f523a05189076efaa" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "user_list_joining" ADD CONSTRAINT "FK_605472305f26818cc93d1baaa74" FOREIGN KEY ("userListId") REFERENCES "user_list"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "note_favorite" ADD CONSTRAINT "FK_47f4b1892f5d6ba8efb3057d81a" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "note_favorite" ADD CONSTRAINT "FK_0e00498f180193423c992bc4370" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "abuse_user_report" ADD CONSTRAINT "FK_d049123c413e68ca52abe734203" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "abuse_user_report" ADD CONSTRAINT "FK_04cc96756f89d0b7f9473e8cdf3" FOREIGN KEY ("reporterId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "messaging_message" ADD CONSTRAINT "FK_5377c307783fce2b6d352e1203b" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "messaging_message" ADD CONSTRAINT "FK_cac14a4e3944454a5ce7daa5142" FOREIGN KEY ("recipientId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "messaging_message" ADD CONSTRAINT "FK_535def119223ac05ad3fa9ef64b" FOREIGN KEY ("fileId") REFERENCES "drive_file"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "signin" ADD CONSTRAINT "FK_2c308dbdc50d94dc625670055f7" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "auth_session" ADD CONSTRAINT "FK_c072b729d71697f959bde66ade0" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "auth_session" ADD CONSTRAINT "FK_dbe037d4bddd17b03a1dc778dee" FOREIGN KEY ("appId") REFERENCES "app"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "follow_request" ADD CONSTRAINT "FK_12c01c0d1a79f77d9f6c15fadd2" FOREIGN KEY ("followeeId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "follow_request" ADD CONSTRAINT "FK_a7fd92dd6dc519e6fb435dd108f" FOREIGN KEY ("followerId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "reversi_game" ADD CONSTRAINT "FK_f7467510c60a45ce5aca6292743" FOREIGN KEY ("user1Id") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "reversi_game" ADD CONSTRAINT "FK_6649a4e8c5d5cf32fb03b5da9f6" FOREIGN KEY ("user2Id") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "reversi_matching" ADD CONSTRAINT "FK_3b25402709dd9882048c2bbade0" FOREIGN KEY ("parentId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "reversi_matching" ADD CONSTRAINT "FK_e247b23a3c9b45f89ec1299d066" FOREIGN KEY ("childId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "user_note_pining" ADD CONSTRAINT "FK_bfbc6f79ba4007b4ce5097f08d6" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "user_note_pining" ADD CONSTRAINT "FK_68881008f7c3588ad7ecae471cf" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "poll" ADD CONSTRAINT "FK_da851e06d0dfe2ef397d8b1bf1b" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "user_keypair" ADD CONSTRAINT "FK_f4853eb41ab722fe05f81cedeb6" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "user_publickey" ADD CONSTRAINT "FK_10c146e4b39b443ede016f6736d" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "user_profile" ADD CONSTRAINT "FK_51cb79b5555effaf7d69ba1cff9" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" DROP CONSTRAINT "FK_51cb79b5555effaf7d69ba1cff9"`); - await queryRunner.query(`ALTER TABLE "user_publickey" DROP CONSTRAINT "FK_10c146e4b39b443ede016f6736d"`); - await queryRunner.query(`ALTER TABLE "user_keypair" DROP CONSTRAINT "FK_f4853eb41ab722fe05f81cedeb6"`); - await queryRunner.query(`ALTER TABLE "poll" DROP CONSTRAINT "FK_da851e06d0dfe2ef397d8b1bf1b"`); - await queryRunner.query(`ALTER TABLE "user_note_pining" DROP CONSTRAINT "FK_68881008f7c3588ad7ecae471cf"`); - await queryRunner.query(`ALTER TABLE "user_note_pining" DROP CONSTRAINT "FK_bfbc6f79ba4007b4ce5097f08d6"`); - await queryRunner.query(`ALTER TABLE "reversi_matching" DROP CONSTRAINT "FK_e247b23a3c9b45f89ec1299d066"`); - await queryRunner.query(`ALTER TABLE "reversi_matching" DROP CONSTRAINT "FK_3b25402709dd9882048c2bbade0"`); - await queryRunner.query(`ALTER TABLE "reversi_game" DROP CONSTRAINT "FK_6649a4e8c5d5cf32fb03b5da9f6"`); - await queryRunner.query(`ALTER TABLE "reversi_game" DROP CONSTRAINT "FK_f7467510c60a45ce5aca6292743"`); - await queryRunner.query(`ALTER TABLE "follow_request" DROP CONSTRAINT "FK_a7fd92dd6dc519e6fb435dd108f"`); - await queryRunner.query(`ALTER TABLE "follow_request" DROP CONSTRAINT "FK_12c01c0d1a79f77d9f6c15fadd2"`); - await queryRunner.query(`ALTER TABLE "auth_session" DROP CONSTRAINT "FK_dbe037d4bddd17b03a1dc778dee"`); - await queryRunner.query(`ALTER TABLE "auth_session" DROP CONSTRAINT "FK_c072b729d71697f959bde66ade0"`); - await queryRunner.query(`ALTER TABLE "signin" DROP CONSTRAINT "FK_2c308dbdc50d94dc625670055f7"`); - await queryRunner.query(`ALTER TABLE "messaging_message" DROP CONSTRAINT "FK_535def119223ac05ad3fa9ef64b"`); - await queryRunner.query(`ALTER TABLE "messaging_message" DROP CONSTRAINT "FK_cac14a4e3944454a5ce7daa5142"`); - await queryRunner.query(`ALTER TABLE "messaging_message" DROP CONSTRAINT "FK_5377c307783fce2b6d352e1203b"`); - await queryRunner.query(`ALTER TABLE "abuse_user_report" DROP CONSTRAINT "FK_04cc96756f89d0b7f9473e8cdf3"`); - await queryRunner.query(`ALTER TABLE "abuse_user_report" DROP CONSTRAINT "FK_d049123c413e68ca52abe734203"`); - await queryRunner.query(`ALTER TABLE "note_favorite" DROP CONSTRAINT "FK_0e00498f180193423c992bc4370"`); - await queryRunner.query(`ALTER TABLE "note_favorite" DROP CONSTRAINT "FK_47f4b1892f5d6ba8efb3057d81a"`); - await queryRunner.query(`ALTER TABLE "user_list_joining" DROP CONSTRAINT "FK_605472305f26818cc93d1baaa74"`); - await queryRunner.query(`ALTER TABLE "user_list_joining" DROP CONSTRAINT "FK_d844bfc6f3f523a05189076efaa"`); - await queryRunner.query(`ALTER TABLE "user_list" DROP CONSTRAINT "FK_b7fcefbdd1c18dce86687531f99"`); - await queryRunner.query(`ALTER TABLE "blocking" DROP CONSTRAINT "FK_0627125f1a8a42c9a1929edb552"`); - await queryRunner.query(`ALTER TABLE "blocking" DROP CONSTRAINT "FK_2cd4a2743a99671308f5417759e"`); - await queryRunner.query(`ALTER TABLE "sw_subscription" DROP CONSTRAINT "FK_97754ca6f2baff9b4abb7f853dd"`); - await queryRunner.query(`ALTER TABLE "muting" DROP CONSTRAINT "FK_93060675b4a79a577f31d260c67"`); - await queryRunner.query(`ALTER TABLE "muting" DROP CONSTRAINT "FK_ec96b4fed9dae517e0dbbe0675c"`); - await queryRunner.query(`ALTER TABLE "following" DROP CONSTRAINT "FK_6516c5a6f3c015b4eed39978be5"`); - await queryRunner.query(`ALTER TABLE "following" DROP CONSTRAINT "FK_24e0042143a18157b234df186c3"`); - await queryRunner.query(`ALTER TABLE "notification" DROP CONSTRAINT "FK_769cb6b73a1efe22ddf733ac453"`); - await queryRunner.query(`ALTER TABLE "notification" DROP CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710"`); - await queryRunner.query(`ALTER TABLE "notification" DROP CONSTRAINT "FK_3c601b70a1066d2c8b517094cb9"`); - await queryRunner.query(`ALTER TABLE "note_unread" DROP CONSTRAINT "FK_e637cba4dc4410218c4251260e4"`); - await queryRunner.query(`ALTER TABLE "note_unread" DROP CONSTRAINT "FK_56b0166d34ddae49d8ef7610bb9"`); - await queryRunner.query(`ALTER TABLE "note_watching" DROP CONSTRAINT "FK_03e7028ab8388a3f5e3ce2a8619"`); - await queryRunner.query(`ALTER TABLE "note_watching" DROP CONSTRAINT "FK_b0134ec406e8d09a540f8182888"`); - await queryRunner.query(`ALTER TABLE "note_reaction" DROP CONSTRAINT "FK_45145e4953780f3cd5656f0ea6a"`); - await queryRunner.query(`ALTER TABLE "note_reaction" DROP CONSTRAINT "FK_13761f64257f40c5636d0ff95ee"`); - await queryRunner.query(`ALTER TABLE "poll_vote" DROP CONSTRAINT "FK_aecfbd5ef60374918e63ee95fa7"`); - await queryRunner.query(`ALTER TABLE "poll_vote" DROP CONSTRAINT "FK_66d2bd2ee31d14bcc23069a89f8"`); - await queryRunner.query(`ALTER TABLE "note" DROP CONSTRAINT "FK_5b87d9d19127bd5d92026017a7b"`); - await queryRunner.query(`ALTER TABLE "note" DROP CONSTRAINT "FK_ec5c201576192ba8904c345c5cc"`); - await queryRunner.query(`ALTER TABLE "note" DROP CONSTRAINT "FK_52ccc804d7c69037d558bac4c96"`); - await queryRunner.query(`ALTER TABLE "note" DROP CONSTRAINT "FK_17cb3553c700a4985dff5a30ff5"`); - await queryRunner.query(`ALTER TABLE "access_token" DROP CONSTRAINT "FK_a3ff16c90cc87a82a0b5959e560"`); - await queryRunner.query(`ALTER TABLE "access_token" DROP CONSTRAINT "FK_9949557d0e1b2c19e5344c171e9"`); - await queryRunner.query(`ALTER TABLE "app" DROP CONSTRAINT "FK_3f5b0899ef90527a3462d7c2cb3"`); - await queryRunner.query(`ALTER TABLE "user" DROP CONSTRAINT "FK_afc64b53f8db3707ceb34eb28e2"`); - await queryRunner.query(`ALTER TABLE "user" DROP CONSTRAINT "FK_58f5c71eaab331645112cf8cfa5"`); - await queryRunner.query(`ALTER TABLE "drive_file" DROP CONSTRAINT "FK_bb90d1956dafc4068c28aa7560a"`); - await queryRunner.query(`ALTER TABLE "drive_file" DROP CONSTRAINT "FK_860fa6f6c7df5bb887249fba22e"`); - await queryRunner.query(`ALTER TABLE "drive_folder" DROP CONSTRAINT "FK_00ceffb0cdc238b3233294f08f2"`); - await queryRunner.query(`ALTER TABLE "drive_folder" DROP CONSTRAINT "FK_f4fc06e49c0171c85f1c48060d2"`); - await queryRunner.query(`DROP TABLE "__chart__users"`); - await queryRunner.query(`DROP TYPE "__chart__users_span_enum"`); - await queryRunner.query(`DROP TABLE "__chart__test"`); - await queryRunner.query(`DROP TYPE "__chart__test_span_enum"`); - await queryRunner.query(`DROP TABLE "__chart__test_unique"`); - await queryRunner.query(`DROP TYPE "__chart__test_unique_span_enum"`); - await queryRunner.query(`DROP TABLE "__chart__test_grouped"`); - await queryRunner.query(`DROP TYPE "__chart__test_grouped_span_enum"`); - await queryRunner.query(`DROP TABLE "__chart__per_user_reaction"`); - await queryRunner.query(`DROP TYPE "__chart__per_user_reaction_span_enum"`); - await queryRunner.query(`DROP TABLE "__chart__per_user_notes"`); - await queryRunner.query(`DROP TYPE "__chart__per_user_notes_span_enum"`); - await queryRunner.query(`DROP TABLE "__chart__per_user_following"`); - await queryRunner.query(`DROP TYPE "__chart__per_user_following_span_enum"`); - await queryRunner.query(`DROP TABLE "__chart__per_user_drive"`); - await queryRunner.query(`DROP TYPE "__chart__per_user_drive_span_enum"`); - await queryRunner.query(`DROP TABLE "__chart__notes"`); - await queryRunner.query(`DROP TYPE "__chart__notes_span_enum"`); - await queryRunner.query(`DROP TABLE "__chart__network"`); - await queryRunner.query(`DROP TYPE "__chart__network_span_enum"`); - await queryRunner.query(`DROP TABLE "__chart__instance"`); - await queryRunner.query(`DROP TYPE "__chart__instance_span_enum"`); - await queryRunner.query(`DROP TABLE "__chart__hashtag"`); - await queryRunner.query(`DROP TYPE "__chart__hashtag_span_enum"`); - await queryRunner.query(`DROP TABLE "__chart__federation"`); - await queryRunner.query(`DROP TYPE "__chart__federation_span_enum"`); - await queryRunner.query(`DROP TABLE "__chart__drive"`); - await queryRunner.query(`DROP TYPE "__chart__drive_span_enum"`); - await queryRunner.query(`DROP TABLE "__chart__active_users"`); - await queryRunner.query(`DROP TYPE "__chart__active_users_span_enum"`); - await queryRunner.query(`DROP INDEX "IDX_dce530b98e454793dac5ec2f5a"`); - await queryRunner.query(`DROP TABLE "user_profile"`); - await queryRunner.query(`DROP INDEX "IDX_171e64971c780ebd23fae140bb"`); - await queryRunner.query(`DROP TABLE "user_publickey"`); - await queryRunner.query(`DROP TABLE "user_keypair"`); - await queryRunner.query(`DROP INDEX "IDX_7fa20a12319c7f6dc3aed98c0a"`); - await queryRunner.query(`DROP INDEX "IDX_0610ebcfcfb4a18441a9bcdab2"`); - await queryRunner.query(`DROP TABLE "poll"`); - await queryRunner.query(`DROP TYPE "poll_notevisibility_enum"`); - await queryRunner.query(`DROP INDEX "IDX_410cd649884b501c02d6e72738"`); - await queryRunner.query(`DROP INDEX "IDX_bfbc6f79ba4007b4ce5097f08d"`); - await queryRunner.query(`DROP TABLE "user_note_pining"`); - await queryRunner.query(`DROP INDEX "IDX_e247b23a3c9b45f89ec1299d06"`); - await queryRunner.query(`DROP INDEX "IDX_3b25402709dd9882048c2bbade"`); - await queryRunner.query(`DROP INDEX "IDX_b604d92d6c7aec38627f6eaf16"`); - await queryRunner.query(`DROP TABLE "reversi_matching"`); - await queryRunner.query(`DROP INDEX "IDX_b46ec40746efceac604142be1c"`); - await queryRunner.query(`DROP TABLE "reversi_game"`); - await queryRunner.query(`DROP INDEX "IDX_4f4d35e1256c84ae3d1f0eab10"`); - await queryRunner.query(`DROP INDEX "IDX_5900e907bb46516ddf2871327c"`); - await queryRunner.query(`DROP INDEX "IDX_b37dafc86e9af007e3295c2781"`); - await queryRunner.query(`DROP TABLE "emoji"`); - await queryRunner.query(`DROP INDEX "IDX_d54a512b822fac7ed52800f6b4"`); - await queryRunner.query(`DROP INDEX "IDX_a7fd92dd6dc519e6fb435dd108"`); - await queryRunner.query(`DROP INDEX "IDX_12c01c0d1a79f77d9f6c15fadd"`); - await queryRunner.query(`DROP TABLE "follow_request"`); - await queryRunner.query(`DROP INDEX "IDX_62cb09e1129f6ec024ef66e183"`); - await queryRunner.query(`DROP TABLE "auth_session"`); - await queryRunner.query(`DROP INDEX "IDX_2c308dbdc50d94dc625670055f"`); - await queryRunner.query(`DROP TABLE "signin"`); - await queryRunner.query(`DROP INDEX "IDX_cac14a4e3944454a5ce7daa514"`); - await queryRunner.query(`DROP INDEX "IDX_5377c307783fce2b6d352e1203"`); - await queryRunner.query(`DROP INDEX "IDX_e21cd3646e52ef9c94aaf17c2e"`); - await queryRunner.query(`DROP TABLE "messaging_message"`); - await queryRunner.query(`DROP INDEX "IDX_0ff69e8dfa9fe31bb4a4660f59"`); - await queryRunner.query(`DROP TABLE "registration_ticket"`); - await queryRunner.query(`DROP INDEX "IDX_5cd442c3b2e74fdd99dae20243"`); - await queryRunner.query(`DROP INDEX "IDX_04cc96756f89d0b7f9473e8cdf"`); - await queryRunner.query(`DROP INDEX "IDX_d049123c413e68ca52abe73420"`); - await queryRunner.query(`DROP INDEX "IDX_db2098070b2b5a523c58181f74"`); - await queryRunner.query(`DROP TABLE "abuse_user_report"`); - await queryRunner.query(`DROP INDEX "IDX_0f4fb9ad355f3effff221ef245"`); - await queryRunner.query(`DROP INDEX "IDX_47f4b1892f5d6ba8efb3057d81"`); - await queryRunner.query(`DROP TABLE "note_favorite"`); - await queryRunner.query(`DROP INDEX "IDX_0b03cbcd7e6a7ce068efa8ecc2"`); - await queryRunner.query(`DROP INDEX "IDX_0c44bf4f680964145f2a68a341"`); - await queryRunner.query(`DROP INDEX "IDX_d57f9030cd3af7f63ffb1c267c"`); - await queryRunner.query(`DROP INDEX "IDX_4c02d38a976c3ae132228c6fce"`); - await queryRunner.query(`DROP INDEX "IDX_0e206cec573f1edff4a3062923"`); - await queryRunner.query(`DROP INDEX "IDX_2710a55f826ee236ea1a62698f"`); - await queryRunner.query(`DROP INDEX "IDX_347fec870eafea7b26c8a73bac"`); - await queryRunner.query(`DROP TABLE "hashtag"`); - await queryRunner.query(`DROP INDEX "IDX_605472305f26818cc93d1baaa7"`); - await queryRunner.query(`DROP INDEX "IDX_d844bfc6f3f523a05189076efa"`); - await queryRunner.query(`DROP TABLE "user_list_joining"`); - await queryRunner.query(`DROP INDEX "IDX_b7fcefbdd1c18dce86687531f9"`); - await queryRunner.query(`DROP TABLE "user_list"`); - await queryRunner.query(`DROP INDEX "IDX_98a1bc5cb30dfd159de056549f"`); - await queryRunner.query(`DROP INDEX "IDX_0627125f1a8a42c9a1929edb55"`); - await queryRunner.query(`DROP INDEX "IDX_2cd4a2743a99671308f5417759"`); - await queryRunner.query(`DROP INDEX "IDX_b9a354f7941c1e779f3b33aea6"`); - await queryRunner.query(`DROP TABLE "blocking"`); - await queryRunner.query(`DROP INDEX "IDX_97754ca6f2baff9b4abb7f853d"`); - await queryRunner.query(`DROP TABLE "sw_subscription"`); - await queryRunner.query(`DROP INDEX "IDX_1eb9d9824a630321a29fd3b290"`); - await queryRunner.query(`DROP INDEX "IDX_93060675b4a79a577f31d260c6"`); - await queryRunner.query(`DROP INDEX "IDX_ec96b4fed9dae517e0dbbe0675"`); - await queryRunner.query(`DROP INDEX "IDX_f86d57fbca33c7a4e6897490cc"`); - await queryRunner.query(`DROP TABLE "muting"`); - await queryRunner.query(`DROP INDEX "IDX_8d5afc98982185799b160e10eb"`); - await queryRunner.query(`DROP INDEX "IDX_2cd3b2a6b4cf0b910b260afe08"`); - await queryRunner.query(`DROP TABLE "instance"`); - await queryRunner.query(`DROP INDEX "IDX_307be5f1d1252e0388662acb96"`); - await queryRunner.query(`DROP INDEX "IDX_6516c5a6f3c015b4eed39978be"`); - await queryRunner.query(`DROP INDEX "IDX_24e0042143a18157b234df186c"`); - await queryRunner.query(`DROP INDEX "IDX_582f8fab771a9040a12961f3e7"`); - await queryRunner.query(`DROP TABLE "following"`); - await queryRunner.query(`DROP TABLE "meta"`); - await queryRunner.query(`DROP INDEX "IDX_3c601b70a1066d2c8b517094cb"`); - await queryRunner.query(`DROP INDEX "IDX_b11a5e627c41d4dc3170f1d370"`); - await queryRunner.query(`DROP TABLE "notification"`); - await queryRunner.query(`DROP INDEX "IDX_d908433a4953cc13216cd9c274"`); - await queryRunner.query(`DROP INDEX "IDX_e637cba4dc4410218c4251260e"`); - await queryRunner.query(`DROP INDEX "IDX_56b0166d34ddae49d8ef7610bb"`); - await queryRunner.query(`DROP TABLE "note_unread"`); - await queryRunner.query(`DROP INDEX "IDX_a42c93c69989ce1d09959df4cf"`); - await queryRunner.query(`DROP INDEX "IDX_44499765eec6b5489d72c4253b"`); - await queryRunner.query(`DROP INDEX "IDX_03e7028ab8388a3f5e3ce2a861"`); - await queryRunner.query(`DROP INDEX "IDX_b0134ec406e8d09a540f818288"`); - await queryRunner.query(`DROP INDEX "IDX_318cdf42a9cfc11f479bd802bb"`); - await queryRunner.query(`DROP TABLE "note_watching"`); - await queryRunner.query(`DROP INDEX "IDX_ad0c221b25672daf2df320a817"`); - await queryRunner.query(`DROP INDEX "IDX_45145e4953780f3cd5656f0ea6"`); - await queryRunner.query(`DROP INDEX "IDX_13761f64257f40c5636d0ff95e"`); - await queryRunner.query(`DROP INDEX "IDX_01f4581f114e0ebd2bbb876f0b"`); - await queryRunner.query(`DROP TABLE "note_reaction"`); - await queryRunner.query(`DROP INDEX "IDX_50bd7164c5b78f1f4a42c4d21f"`); - await queryRunner.query(`DROP INDEX "IDX_aecfbd5ef60374918e63ee95fa"`); - await queryRunner.query(`DROP INDEX "IDX_66d2bd2ee31d14bcc23069a89f"`); - await queryRunner.query(`DROP INDEX "IDX_0fb627e1c2f753262a74f0562d"`); - await queryRunner.query(`DROP TABLE "poll_vote"`); - await queryRunner.query(`DROP INDEX "IDX_7125a826ab192eb27e11d358a5"`); - await queryRunner.query(`DROP INDEX "IDX_88937d94d7443d9a99a76fa5c0"`); - await queryRunner.query(`DROP INDEX "IDX_54ebcb6d27222913b908d56fd8"`); - await queryRunner.query(`DROP INDEX "IDX_796a8c03959361f97dc2be1d5c"`); - await queryRunner.query(`DROP INDEX "IDX_25dfc71b0369b003a4cd434d0b"`); - await queryRunner.query(`DROP INDEX "IDX_51c063b6a133a9cb87145450f5"`); - await queryRunner.query(`DROP INDEX "IDX_153536c67d05e9adb24e99fc2b"`); - await queryRunner.query(`DROP INDEX "IDX_5b87d9d19127bd5d92026017a7"`); - await queryRunner.query(`DROP INDEX "IDX_52ccc804d7c69037d558bac4c9"`); - await queryRunner.query(`DROP INDEX "IDX_17cb3553c700a4985dff5a30ff"`); - await queryRunner.query(`DROP INDEX "IDX_e7c0567f5261063592f022e9b5"`); - await queryRunner.query(`DROP TABLE "note"`); - await queryRunner.query(`DROP TYPE "note_visibility_enum"`); - await queryRunner.query(`DROP INDEX "IDX_9949557d0e1b2c19e5344c171e"`); - await queryRunner.query(`DROP INDEX "IDX_64c327441248bae40f7d92f34f"`); - await queryRunner.query(`DROP INDEX "IDX_70ba8f6af34bc924fc9e12adb8"`); - await queryRunner.query(`DROP TABLE "access_token"`); - await queryRunner.query(`DROP INDEX "IDX_f49922d511d666848f250663c4"`); - await queryRunner.query(`DROP INDEX "IDX_3f5b0899ef90527a3462d7c2cb"`); - await queryRunner.query(`DROP INDEX "IDX_048a757923ed8b157e9895da53"`); - await queryRunner.query(`DROP TABLE "app"`); - await queryRunner.query(`DROP INDEX "IDX_5deb01ae162d1d70b80d064c27"`); - await queryRunner.query(`DROP INDEX "IDX_a854e557b1b14814750c7c7b0c"`); - await queryRunner.query(`DROP INDEX "IDX_be623adaa4c566baf5d29ce0c8"`); - await queryRunner.query(`DROP INDEX "IDX_3252a5df8d5bbd16b281f7799e"`); - await queryRunner.query(`DROP INDEX "IDX_fa99d777623947a5b05f394cae"`); - await queryRunner.query(`DROP INDEX "IDX_a27b942a0d6dcff90e3ee9b5e8"`); - await queryRunner.query(`DROP INDEX "IDX_80ca6e6ef65fb9ef34ea8c90f4"`); - await queryRunner.query(`DROP INDEX "IDX_e11e649824a45d8ed01d597fd9"`); - await queryRunner.query(`DROP TABLE "user"`); - await queryRunner.query(`DROP INDEX "IDX_bb90d1956dafc4068c28aa7560"`); - await queryRunner.query(`DROP INDEX "IDX_e5848eac4940934e23dbc17581"`); - await queryRunner.query(`DROP INDEX "IDX_c55b2b7c284d9fef98026fc88e"`); - await queryRunner.query(`DROP INDEX "IDX_e74022ce9a074b3866f70e0d27"`); - await queryRunner.query(`DROP INDEX "IDX_d85a184c2540d2deba33daf642"`); - await queryRunner.query(`DROP INDEX "IDX_a40b8df8c989d7db937ea27cf6"`); - await queryRunner.query(`DROP INDEX "IDX_37bb9a1b4585f8a3beb24c62d6"`); - await queryRunner.query(`DROP INDEX "IDX_92779627994ac79277f070c91e"`); - await queryRunner.query(`DROP INDEX "IDX_860fa6f6c7df5bb887249fba22"`); - await queryRunner.query(`DROP INDEX "IDX_c8dfad3b72196dd1d6b5db168a"`); - await queryRunner.query(`DROP TABLE "drive_file"`); - await queryRunner.query(`DROP INDEX "IDX_00ceffb0cdc238b3233294f08f"`); - await queryRunner.query(`DROP INDEX "IDX_f4fc06e49c0171c85f1c48060d"`); - await queryRunner.query(`DROP INDEX "IDX_02878d441ceae15ce060b73daf"`); - await queryRunner.query(`DROP TABLE "drive_folder"`); - await queryRunner.query(`DROP INDEX "IDX_584b536b49e53ac81beb39a177"`); - await queryRunner.query(`DROP INDEX "IDX_8cb40cfc8f3c28261e6f887b03"`); - await queryRunner.query(`DROP INDEX "IDX_8e4eb51a35d81b64dda28eed0a"`); - await queryRunner.query(`DROP TABLE "log"`); - await queryRunner.query(`DROP TYPE "log_level_enum"`); - } + async up(queryRunner) { + await queryRunner.query( + `CREATE TYPE "log_level_enum" AS ENUM('error', 'warning', 'info', 'success', 'debug')`, + ); + await queryRunner.query( + `CREATE TABLE "log" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "domain" character varying(64) array NOT NULL DEFAULT '{}'::varchar[], "level" "log_level_enum" NOT NULL, "worker" character varying(8) NOT NULL, "machine" character varying(128) NOT NULL, "message" character varying(1024) NOT NULL, "data" jsonb NOT NULL DEFAULT '{}', CONSTRAINT "PK_350604cbdf991d5930d9e618fbd" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_8e4eb51a35d81b64dda28eed0a" ON "log" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_8cb40cfc8f3c28261e6f887b03" ON "log" ("domain") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_584b536b49e53ac81beb39a177" ON "log" ("level") `, + ); + await queryRunner.query( + `CREATE TABLE "drive_folder" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "name" character varying(128) NOT NULL, "userId" character varying(32), "parentId" character varying(32), CONSTRAINT "PK_7a0c089191f5ebdc214e0af808a" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_02878d441ceae15ce060b73daf" ON "drive_folder" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f4fc06e49c0171c85f1c48060d" ON "drive_folder" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_00ceffb0cdc238b3233294f08f" ON "drive_folder" ("parentId") `, + ); + await queryRunner.query( + `CREATE TABLE "drive_file" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32), "userHost" character varying(128), "md5" character varying(32) NOT NULL, "name" character varying(256) NOT NULL, "type" character varying(128) NOT NULL, "size" integer NOT NULL, "comment" character varying(512), "properties" jsonb NOT NULL DEFAULT '{}', "storedInternal" boolean NOT NULL, "url" character varying(512) NOT NULL, "thumbnailUrl" character varying(512), "webpublicUrl" character varying(512), "accessKey" character varying(256), "thumbnailAccessKey" character varying(256), "webpublicAccessKey" character varying(256), "uri" character varying(512), "src" character varying(512), "folderId" character varying(32), "isSensitive" boolean NOT NULL DEFAULT false, "isLink" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_43ddaaaf18c9e68029b7cbb032e" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_c8dfad3b72196dd1d6b5db168a" ON "drive_file" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_860fa6f6c7df5bb887249fba22" ON "drive_file" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_92779627994ac79277f070c91e" ON "drive_file" ("userHost") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_37bb9a1b4585f8a3beb24c62d6" ON "drive_file" ("md5") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_a40b8df8c989d7db937ea27cf6" ON "drive_file" ("type") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_d85a184c2540d2deba33daf642" ON "drive_file" ("accessKey") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_e74022ce9a074b3866f70e0d27" ON "drive_file" ("thumbnailAccessKey") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_c55b2b7c284d9fef98026fc88e" ON "drive_file" ("webpublicAccessKey") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_e5848eac4940934e23dbc17581" ON "drive_file" ("uri") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_bb90d1956dafc4068c28aa7560" ON "drive_file" ("folderId") `, + ); + await queryRunner.query( + `CREATE TABLE "user" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE, "lastFetchedAt" TIMESTAMP WITH TIME ZONE, "username" character varying(128) NOT NULL, "usernameLower" character varying(128) NOT NULL, "name" character varying(128), "followersCount" integer NOT NULL DEFAULT 0, "followingCount" integer NOT NULL DEFAULT 0, "notesCount" integer NOT NULL DEFAULT 0, "avatarId" character varying(32), "bannerId" character varying(32), "tags" character varying(128) array NOT NULL DEFAULT '{}'::varchar[], "avatarUrl" character varying(512), "bannerUrl" character varying(512), "avatarColor" character varying(32), "bannerColor" character varying(32), "isSuspended" boolean NOT NULL DEFAULT false, "isSilenced" boolean NOT NULL DEFAULT false, "isLocked" boolean NOT NULL DEFAULT false, "isBot" boolean NOT NULL DEFAULT false, "isCat" boolean NOT NULL DEFAULT false, "isAdmin" boolean NOT NULL DEFAULT false, "isModerator" boolean NOT NULL DEFAULT false, "isVerified" boolean NOT NULL DEFAULT false, "emojis" character varying(128) array NOT NULL DEFAULT '{}'::varchar[], "host" character varying(128), "inbox" character varying(512), "sharedInbox" character varying(512), "featured" character varying(512), "uri" character varying(512), "token" character(16), CONSTRAINT "UQ_a854e557b1b14814750c7c7b0c9" UNIQUE ("token"), CONSTRAINT "REL_58f5c71eaab331645112cf8cfa" UNIQUE ("avatarId"), CONSTRAINT "REL_afc64b53f8db3707ceb34eb28e" UNIQUE ("bannerId"), CONSTRAINT "PK_cace4a159ff9f2512dd42373760" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_e11e649824a45d8ed01d597fd9" ON "user" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_80ca6e6ef65fb9ef34ea8c90f4" ON "user" ("updatedAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_a27b942a0d6dcff90e3ee9b5e8" ON "user" ("usernameLower") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_fa99d777623947a5b05f394cae" ON "user" ("tags") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_3252a5df8d5bbd16b281f7799e" ON "user" ("host") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_be623adaa4c566baf5d29ce0c8" ON "user" ("uri") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_a854e557b1b14814750c7c7b0c" ON "user" ("token") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_5deb01ae162d1d70b80d064c27" ON "user" ("usernameLower", "host") `, + ); + await queryRunner.query( + `CREATE TABLE "app" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32), "secret" character varying(64) NOT NULL, "name" character varying(128) NOT NULL, "description" character varying(512) NOT NULL, "permission" character varying(64) array NOT NULL, "callbackUrl" character varying(512), CONSTRAINT "PK_9478629fc093d229df09e560aea" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_048a757923ed8b157e9895da53" ON "app" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_3f5b0899ef90527a3462d7c2cb" ON "app" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f49922d511d666848f250663c4" ON "app" ("secret") `, + ); + await queryRunner.query( + `CREATE TABLE "access_token" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "token" character varying(128) NOT NULL, "hash" character varying(128) NOT NULL, "userId" character varying(32) NOT NULL, "appId" character varying(32) NOT NULL, CONSTRAINT "PK_f20f028607b2603deabd8182d12" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_70ba8f6af34bc924fc9e12adb8" ON "access_token" ("token") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_64c327441248bae40f7d92f34f" ON "access_token" ("hash") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_9949557d0e1b2c19e5344c171e" ON "access_token" ("userId") `, + ); + await queryRunner.query( + `CREATE TYPE "note_visibility_enum" AS ENUM('public', 'home', 'followers', 'specified')`, + ); + await queryRunner.query( + `CREATE TABLE "note" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "replyId" character varying(32), "renoteId" character varying(32), "text" text, "name" character varying(256), "cw" character varying(512), "appId" character varying(32), "userId" character varying(32) NOT NULL, "viaMobile" boolean NOT NULL DEFAULT false, "localOnly" boolean NOT NULL DEFAULT false, "renoteCount" smallint NOT NULL DEFAULT 0, "repliesCount" smallint NOT NULL DEFAULT 0, "reactions" jsonb NOT NULL DEFAULT '{}', "visibility" "note_visibility_enum" NOT NULL, "uri" character varying(512), "score" integer NOT NULL DEFAULT 0, "fileIds" character varying(32) array NOT NULL DEFAULT '{}'::varchar[], "attachedFileTypes" character varying(256) array NOT NULL DEFAULT '{}'::varchar[], "visibleUserIds" character varying(32) array NOT NULL DEFAULT '{}'::varchar[], "mentions" character varying(32) array NOT NULL DEFAULT '{}'::varchar[], "mentionedRemoteUsers" text NOT NULL DEFAULT '[]', "emojis" character varying(128) array NOT NULL DEFAULT '{}'::varchar[], "tags" character varying(128) array NOT NULL DEFAULT '{}'::varchar[], "hasPoll" boolean NOT NULL DEFAULT false, "geo" jsonb DEFAULT null, "userHost" character varying(128), "replyUserId" character varying(32), "replyUserHost" character varying(128), "renoteUserId" character varying(32), "renoteUserHost" character varying(128), CONSTRAINT "PK_96d0c172a4fba276b1bbed43058" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_e7c0567f5261063592f022e9b5" ON "note" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_17cb3553c700a4985dff5a30ff" ON "note" ("replyId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_52ccc804d7c69037d558bac4c9" ON "note" ("renoteId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_5b87d9d19127bd5d92026017a7" ON "note" ("userId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_153536c67d05e9adb24e99fc2b" ON "note" ("uri") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_51c063b6a133a9cb87145450f5" ON "note" ("fileIds") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_25dfc71b0369b003a4cd434d0b" ON "note" ("attachedFileTypes") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_796a8c03959361f97dc2be1d5c" ON "note" ("visibleUserIds") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_54ebcb6d27222913b908d56fd8" ON "note" ("mentions") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_88937d94d7443d9a99a76fa5c0" ON "note" ("tags") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_7125a826ab192eb27e11d358a5" ON "note" ("userHost") `, + ); + await queryRunner.query( + `CREATE TABLE "poll_vote" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, "choice" integer NOT NULL, CONSTRAINT "PK_fd002d371201c472490ba89c6a0" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0fb627e1c2f753262a74f0562d" ON "poll_vote" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_66d2bd2ee31d14bcc23069a89f" ON "poll_vote" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_aecfbd5ef60374918e63ee95fa" ON "poll_vote" ("noteId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_50bd7164c5b78f1f4a42c4d21f" ON "poll_vote" ("userId", "noteId", "choice") `, + ); + await queryRunner.query( + `CREATE TABLE "note_reaction" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, "reaction" character varying(128) NOT NULL, CONSTRAINT "PK_767ec729b108799b587a3fcc9cf" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_01f4581f114e0ebd2bbb876f0b" ON "note_reaction" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_13761f64257f40c5636d0ff95e" ON "note_reaction" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_45145e4953780f3cd5656f0ea6" ON "note_reaction" ("noteId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_ad0c221b25672daf2df320a817" ON "note_reaction" ("userId", "noteId") `, + ); + await queryRunner.query( + `CREATE TABLE "note_watching" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, "noteUserId" character varying(32) NOT NULL, CONSTRAINT "PK_49286fdb23725945a74aa27d757" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_318cdf42a9cfc11f479bd802bb" ON "note_watching" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_b0134ec406e8d09a540f818288" ON "note_watching" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_03e7028ab8388a3f5e3ce2a861" ON "note_watching" ("noteId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_44499765eec6b5489d72c4253b" ON "note_watching" ("noteUserId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_a42c93c69989ce1d09959df4cf" ON "note_watching" ("userId", "noteId") `, + ); + await queryRunner.query( + `CREATE TABLE "note_unread" ("id" character varying(32) NOT NULL, "userId" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, "noteUserId" character varying(32) NOT NULL, "isSpecified" boolean NOT NULL, CONSTRAINT "PK_1904eda61a784f57e6e51fa9c1f" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_56b0166d34ddae49d8ef7610bb" ON "note_unread" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_e637cba4dc4410218c4251260e" ON "note_unread" ("noteId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_d908433a4953cc13216cd9c274" ON "note_unread" ("userId", "noteId") `, + ); + await queryRunner.query( + `CREATE TABLE "notification" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "notifieeId" character varying(32) NOT NULL, "notifierId" character varying(32) NOT NULL, "type" character varying(32) NOT NULL, "isRead" boolean NOT NULL DEFAULT false, "noteId" character varying(32), "reaction" character varying(128), "choice" integer, CONSTRAINT "PK_705b6c7cdf9b2c2ff7ac7872cb7" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_b11a5e627c41d4dc3170f1d370" ON "notification" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_3c601b70a1066d2c8b517094cb" ON "notification" ("notifieeId") `, + ); + await queryRunner.query( + `CREATE TABLE "meta" ("id" character varying(32) NOT NULL, "name" character varying(128), "description" character varying(1024), "maintainerName" character varying(128), "maintainerEmail" character varying(128), "announcements" jsonb NOT NULL DEFAULT '[]', "disableRegistration" boolean NOT NULL DEFAULT false, "disableLocalTimeline" boolean NOT NULL DEFAULT false, "disableGlobalTimeline" boolean NOT NULL DEFAULT false, "enableEmojiReaction" boolean NOT NULL DEFAULT true, "useStarForReactionFallback" boolean NOT NULL DEFAULT false, "langs" character varying(64) array NOT NULL DEFAULT '{}'::varchar[], "hiddenTags" character varying(256) array NOT NULL DEFAULT '{}'::varchar[], "blockedHosts" character varying(256) array NOT NULL DEFAULT '{}'::varchar[], "mascotImageUrl" character varying(512) DEFAULT '/assets/ai.png', "bannerUrl" character varying(512), "errorImageUrl" character varying(512) DEFAULT 'https://xn--931a.moe/aiart/yubitun.png', "iconUrl" character varying(512), "cacheRemoteFiles" boolean NOT NULL DEFAULT true, "proxyAccount" character varying(128), "enableRecaptcha" boolean NOT NULL DEFAULT false, "recaptchaSiteKey" character varying(64), "recaptchaSecretKey" character varying(64), "localDriveCapacityMb" integer NOT NULL DEFAULT 1024, "remoteDriveCapacityMb" integer NOT NULL DEFAULT 32, "maxNoteTextLength" integer NOT NULL DEFAULT 500, "summalyProxy" character varying(128), "enableEmail" boolean NOT NULL DEFAULT false, "email" character varying(128), "smtpSecure" boolean NOT NULL DEFAULT false, "smtpHost" character varying(128), "smtpPort" integer, "smtpUser" character varying(128), "smtpPass" character varying(128), "enableServiceWorker" boolean NOT NULL DEFAULT false, "swPublicKey" character varying(128), "swPrivateKey" character varying(128), "enableTwitterIntegration" boolean NOT NULL DEFAULT false, "twitterConsumerKey" character varying(128), "twitterConsumerSecret" character varying(128), "enableGithubIntegration" boolean NOT NULL DEFAULT false, "githubClientId" character varying(128), "githubClientSecret" character varying(128), "enableDiscordIntegration" boolean NOT NULL DEFAULT false, "discordClientId" character varying(128), "discordClientSecret" character varying(128), CONSTRAINT "PK_c4c17a6c2bd7651338b60fc590b" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TABLE "following" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "followeeId" character varying(32) NOT NULL, "followerId" character varying(32) NOT NULL, "followerHost" character varying(128), "followerInbox" character varying(512), "followerSharedInbox" character varying(512), "followeeHost" character varying(128), "followeeInbox" character varying(512), "followeeSharedInbox" character varying(512), CONSTRAINT "PK_c76c6e044bdf76ecf8bfb82a645" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_582f8fab771a9040a12961f3e7" ON "following" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_24e0042143a18157b234df186c" ON "following" ("followeeId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_6516c5a6f3c015b4eed39978be" ON "following" ("followerId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_307be5f1d1252e0388662acb96" ON "following" ("followerId", "followeeId") `, + ); + await queryRunner.query( + `CREATE TABLE "instance" ("id" character varying(32) NOT NULL, "caughtAt" TIMESTAMP WITH TIME ZONE NOT NULL, "host" character varying(128) NOT NULL, "system" character varying(64), "usersCount" integer NOT NULL DEFAULT 0, "notesCount" integer NOT NULL DEFAULT 0, "followingCount" integer NOT NULL DEFAULT 0, "followersCount" integer NOT NULL DEFAULT 0, "driveUsage" integer NOT NULL DEFAULT 0, "driveFiles" integer NOT NULL DEFAULT 0, "latestRequestSentAt" TIMESTAMP WITH TIME ZONE, "latestStatus" integer, "latestRequestReceivedAt" TIMESTAMP WITH TIME ZONE, "lastCommunicatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, "isNotResponding" boolean NOT NULL DEFAULT false, "isMarkedAsClosed" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_eaf60e4a0c399c9935413e06474" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_2cd3b2a6b4cf0b910b260afe08" ON "instance" ("caughtAt") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_8d5afc98982185799b160e10eb" ON "instance" ("host") `, + ); + await queryRunner.query( + `CREATE TABLE "muting" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "muteeId" character varying(32) NOT NULL, "muterId" character varying(32) NOT NULL, CONSTRAINT "PK_2e92d06c8b5c602eeb27ca9ba48" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f86d57fbca33c7a4e6897490cc" ON "muting" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_ec96b4fed9dae517e0dbbe0675" ON "muting" ("muteeId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_93060675b4a79a577f31d260c6" ON "muting" ("muterId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_1eb9d9824a630321a29fd3b290" ON "muting" ("muterId", "muteeId") `, + ); + await queryRunner.query( + `CREATE TABLE "sw_subscription" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "endpoint" character varying(512) NOT NULL, "auth" character varying(256) NOT NULL, "publickey" character varying(128) NOT NULL, CONSTRAINT "PK_e8f763631530051b95eb6279b91" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_97754ca6f2baff9b4abb7f853d" ON "sw_subscription" ("userId") `, + ); + await queryRunner.query( + `CREATE TABLE "blocking" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "blockeeId" character varying(32) NOT NULL, "blockerId" character varying(32) NOT NULL, CONSTRAINT "PK_e5d9a541cc1965ee7e048ea09dd" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_b9a354f7941c1e779f3b33aea6" ON "blocking" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_2cd4a2743a99671308f5417759" ON "blocking" ("blockeeId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0627125f1a8a42c9a1929edb55" ON "blocking" ("blockerId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_98a1bc5cb30dfd159de056549f" ON "blocking" ("blockerId", "blockeeId") `, + ); + await queryRunner.query( + `CREATE TABLE "user_list" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "name" character varying(128) NOT NULL, CONSTRAINT "PK_87bab75775fd9b1ff822b656402" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_b7fcefbdd1c18dce86687531f9" ON "user_list" ("userId") `, + ); + await queryRunner.query( + `CREATE TABLE "user_list_joining" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "userListId" character varying(32) NOT NULL, CONSTRAINT "PK_11abb3768da1c5f8de101c9df45" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_d844bfc6f3f523a05189076efa" ON "user_list_joining" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_605472305f26818cc93d1baaa7" ON "user_list_joining" ("userListId") `, + ); + await queryRunner.query( + `CREATE TABLE "hashtag" ("id" character varying(32) NOT NULL, "name" character varying(128) NOT NULL, "mentionedUserIds" character varying(32) array NOT NULL, "mentionedUsersCount" integer NOT NULL DEFAULT 0, "mentionedLocalUserIds" character varying(32) array NOT NULL, "mentionedLocalUsersCount" integer NOT NULL DEFAULT 0, "mentionedRemoteUserIds" character varying(32) array NOT NULL, "mentionedRemoteUsersCount" integer NOT NULL DEFAULT 0, "attachedUserIds" character varying(32) array NOT NULL, "attachedUsersCount" integer NOT NULL DEFAULT 0, "attachedLocalUserIds" character varying(32) array NOT NULL, "attachedLocalUsersCount" integer NOT NULL DEFAULT 0, "attachedRemoteUserIds" character varying(32) array NOT NULL, "attachedRemoteUsersCount" integer NOT NULL DEFAULT 0, CONSTRAINT "PK_cb36eb8af8412bfa978f1165d78" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_347fec870eafea7b26c8a73bac" ON "hashtag" ("name") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_2710a55f826ee236ea1a62698f" ON "hashtag" ("mentionedUsersCount") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0e206cec573f1edff4a3062923" ON "hashtag" ("mentionedLocalUsersCount") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_4c02d38a976c3ae132228c6fce" ON "hashtag" ("mentionedRemoteUsersCount") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_d57f9030cd3af7f63ffb1c267c" ON "hashtag" ("attachedUsersCount") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0c44bf4f680964145f2a68a341" ON "hashtag" ("attachedLocalUsersCount") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0b03cbcd7e6a7ce068efa8ecc2" ON "hashtag" ("attachedRemoteUsersCount") `, + ); + await queryRunner.query( + `CREATE TABLE "note_favorite" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, CONSTRAINT "PK_af0da35a60b9fa4463a62082b36" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_47f4b1892f5d6ba8efb3057d81" ON "note_favorite" ("userId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_0f4fb9ad355f3effff221ef245" ON "note_favorite" ("userId", "noteId") `, + ); + await queryRunner.query( + `CREATE TABLE "abuse_user_report" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "reporterId" character varying(32) NOT NULL, "comment" character varying(512) NOT NULL, CONSTRAINT "PK_87873f5f5cc5c321a1306b2d18c" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_db2098070b2b5a523c58181f74" ON "abuse_user_report" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_d049123c413e68ca52abe73420" ON "abuse_user_report" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_04cc96756f89d0b7f9473e8cdf" ON "abuse_user_report" ("reporterId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_5cd442c3b2e74fdd99dae20243" ON "abuse_user_report" ("userId", "reporterId") `, + ); + await queryRunner.query( + `CREATE TABLE "registration_ticket" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "code" character varying(64) NOT NULL, CONSTRAINT "PK_f11696b6fafcf3662d4292734f8" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_0ff69e8dfa9fe31bb4a4660f59" ON "registration_ticket" ("code") `, + ); + await queryRunner.query( + `CREATE TABLE "messaging_message" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "recipientId" character varying(32) NOT NULL, "text" character varying(4096), "isRead" boolean NOT NULL DEFAULT false, "fileId" character varying(32), CONSTRAINT "PK_db398fd79dc95d0eb8c30456eaa" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_e21cd3646e52ef9c94aaf17c2e" ON "messaging_message" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_5377c307783fce2b6d352e1203" ON "messaging_message" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_cac14a4e3944454a5ce7daa514" ON "messaging_message" ("recipientId") `, + ); + await queryRunner.query( + `CREATE TABLE "signin" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "ip" character varying(128) NOT NULL, "headers" jsonb NOT NULL, "success" boolean NOT NULL, CONSTRAINT "PK_9e96ddc025712616fc492b3b588" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_2c308dbdc50d94dc625670055f" ON "signin" ("userId") `, + ); + await queryRunner.query( + `CREATE TABLE "auth_session" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "token" character varying(128) NOT NULL, "userId" character varying(32), "appId" character varying(32) NOT NULL, CONSTRAINT "PK_19354ed146424a728c1112a8cbf" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_62cb09e1129f6ec024ef66e183" ON "auth_session" ("token") `, + ); + await queryRunner.query( + `CREATE TABLE "follow_request" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "followeeId" character varying(32) NOT NULL, "followerId" character varying(32) NOT NULL, "requestId" character varying(128), "followerHost" character varying(128), "followerInbox" character varying(512), "followerSharedInbox" character varying(512), "followeeHost" character varying(128), "followeeInbox" character varying(512), "followeeSharedInbox" character varying(512), CONSTRAINT "PK_53a9aa3725f7a3deb150b39dbfc" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_12c01c0d1a79f77d9f6c15fadd" ON "follow_request" ("followeeId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_a7fd92dd6dc519e6fb435dd108" ON "follow_request" ("followerId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_d54a512b822fac7ed52800f6b4" ON "follow_request" ("followerId", "followeeId") `, + ); + await queryRunner.query( + `CREATE TABLE "emoji" ("id" character varying(32) NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE, "name" character varying(128) NOT NULL, "host" character varying(128), "url" character varying(512) NOT NULL, "uri" character varying(512), "type" character varying(64), "aliases" character varying(128) array NOT NULL DEFAULT '{}'::varchar[], CONSTRAINT "PK_df74ce05e24999ee01ea0bc50a3" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_b37dafc86e9af007e3295c2781" ON "emoji" ("name") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_5900e907bb46516ddf2871327c" ON "emoji" ("host") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_4f4d35e1256c84ae3d1f0eab10" ON "emoji" ("name", "host") `, + ); + await queryRunner.query( + `CREATE TABLE "reversi_game" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "startedAt" TIMESTAMP WITH TIME ZONE, "user1Id" character varying(32) NOT NULL, "user2Id" character varying(32) NOT NULL, "user1Accepted" boolean NOT NULL DEFAULT false, "user2Accepted" boolean NOT NULL DEFAULT false, "black" integer, "isStarted" boolean NOT NULL DEFAULT false, "isEnded" boolean NOT NULL DEFAULT false, "winnerId" character varying(32), "surrendered" character varying(32), "logs" jsonb NOT NULL DEFAULT '[]', "map" character varying(64) array NOT NULL, "bw" character varying(32) NOT NULL, "isLlotheo" boolean NOT NULL DEFAULT false, "canPutEverywhere" boolean NOT NULL DEFAULT false, "loopedBoard" boolean NOT NULL DEFAULT false, "form1" jsonb DEFAULT null, "form2" jsonb DEFAULT null, "crc32" character varying(32), CONSTRAINT "PK_76b30eeba71b1193ad7c5311c3f" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_b46ec40746efceac604142be1c" ON "reversi_game" ("createdAt") `, + ); + await queryRunner.query( + `CREATE TABLE "reversi_matching" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "parentId" character varying(32) NOT NULL, "childId" character varying(32) NOT NULL, CONSTRAINT "PK_880bd0afbab232f21c8b9d146cf" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_b604d92d6c7aec38627f6eaf16" ON "reversi_matching" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_3b25402709dd9882048c2bbade" ON "reversi_matching" ("parentId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_e247b23a3c9b45f89ec1299d06" ON "reversi_matching" ("childId") `, + ); + await queryRunner.query( + `CREATE TABLE "user_note_pining" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, CONSTRAINT "PK_a6a2dad4ae000abce2ea9d9b103" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_bfbc6f79ba4007b4ce5097f08d" ON "user_note_pining" ("userId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_410cd649884b501c02d6e72738" ON "user_note_pining" ("userId", "noteId") `, + ); + await queryRunner.query( + `CREATE TYPE "poll_notevisibility_enum" AS ENUM('public', 'home', 'followers', 'specified')`, + ); + await queryRunner.query( + `CREATE TABLE "poll" ("noteId" character varying(32) NOT NULL, "expiresAt" TIMESTAMP WITH TIME ZONE, "multiple" boolean NOT NULL, "choices" character varying(128) array NOT NULL DEFAULT '{}'::varchar[], "votes" integer array NOT NULL, "noteVisibility" "poll_notevisibility_enum" NOT NULL, "userId" character varying(32) NOT NULL, "userHost" character varying(128), CONSTRAINT "REL_da851e06d0dfe2ef397d8b1bf1" UNIQUE ("noteId"), CONSTRAINT "PK_da851e06d0dfe2ef397d8b1bf1b" PRIMARY KEY ("noteId"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0610ebcfcfb4a18441a9bcdab2" ON "poll" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_7fa20a12319c7f6dc3aed98c0a" ON "poll" ("userHost") `, + ); + await queryRunner.query( + `CREATE TABLE "user_keypair" ("userId" character varying(32) NOT NULL, "publicKey" character varying(4096) NOT NULL, "privateKey" character varying(4096) NOT NULL, CONSTRAINT "REL_f4853eb41ab722fe05f81cedeb" UNIQUE ("userId"), CONSTRAINT "PK_f4853eb41ab722fe05f81cedeb6" PRIMARY KEY ("userId"))`, + ); + await queryRunner.query( + `CREATE TABLE "user_publickey" ("userId" character varying(32) NOT NULL, "keyId" character varying(256) NOT NULL, "keyPem" character varying(4096) NOT NULL, CONSTRAINT "REL_10c146e4b39b443ede016f6736" UNIQUE ("userId"), CONSTRAINT "PK_10c146e4b39b443ede016f6736d" PRIMARY KEY ("userId"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_171e64971c780ebd23fae140bb" ON "user_publickey" ("keyId") `, + ); + await queryRunner.query( + `CREATE TABLE "user_profile" ("userId" character varying(32) NOT NULL, "location" character varying(128), "birthday" character(10), "description" character varying(1024), "fields" jsonb NOT NULL DEFAULT '[]', "url" character varying(512), "email" character varying(128), "emailVerifyCode" character varying(128), "emailVerified" boolean NOT NULL DEFAULT false, "twoFactorTempSecret" character varying(128), "twoFactorSecret" character varying(128), "twoFactorEnabled" boolean NOT NULL DEFAULT false, "password" character varying(128), "clientData" jsonb NOT NULL DEFAULT '{}', "autoWatch" boolean NOT NULL DEFAULT false, "autoAcceptFollowed" boolean NOT NULL DEFAULT false, "alwaysMarkNsfw" boolean NOT NULL DEFAULT false, "carefulBot" boolean NOT NULL DEFAULT false, "twitter" boolean NOT NULL DEFAULT false, "twitterAccessToken" character varying(64) DEFAULT null, "twitterAccessTokenSecret" character varying(64) DEFAULT null, "twitterUserId" character varying(64) DEFAULT null, "twitterScreenName" character varying(64) DEFAULT null, "github" boolean NOT NULL DEFAULT false, "githubAccessToken" character varying(64) DEFAULT null, "githubId" integer DEFAULT null, "githubLogin" character varying(64) DEFAULT null, "discord" boolean NOT NULL DEFAULT false, "discordAccessToken" character varying(64) DEFAULT null, "discordRefreshToken" character varying(64) DEFAULT null, "discordExpiresDate" integer DEFAULT null, "discordId" character varying(64) DEFAULT null, "discordUsername" character varying(64) DEFAULT null, "discordDiscriminator" character varying(64) DEFAULT null, "userHost" character varying(128), CONSTRAINT "REL_51cb79b5555effaf7d69ba1cff" UNIQUE ("userId"), CONSTRAINT "PK_51cb79b5555effaf7d69ba1cff9" PRIMARY KEY ("userId"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_dce530b98e454793dac5ec2f5a" ON "user_profile" ("userHost") `, + ); + await queryRunner.query( + `CREATE TYPE "__chart__active_users_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `CREATE TABLE "__chart__active_users" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__active_users_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___local_count" bigint NOT NULL, "___remote_count" bigint NOT NULL, CONSTRAINT "PK_317237a9f733b970604a11e314f" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TYPE "__chart__drive_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `CREATE TABLE "__chart__drive" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__drive_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___local_totalCount" bigint NOT NULL, "___local_totalSize" bigint NOT NULL, "___local_incCount" bigint NOT NULL, "___local_incSize" bigint NOT NULL, "___local_decCount" bigint NOT NULL, "___local_decSize" bigint NOT NULL, "___remote_totalCount" bigint NOT NULL, "___remote_totalSize" bigint NOT NULL, "___remote_incCount" bigint NOT NULL, "___remote_incSize" bigint NOT NULL, "___remote_decCount" bigint NOT NULL, "___remote_decSize" bigint NOT NULL, CONSTRAINT "PK_f96bc548a765cd4b3b354221ce7" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TYPE "__chart__federation_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `CREATE TABLE "__chart__federation" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__federation_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___instance_total" bigint NOT NULL, "___instance_inc" bigint NOT NULL, "___instance_dec" bigint NOT NULL, CONSTRAINT "PK_b39dcd31a0fe1a7757e348e85fd" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TYPE "__chart__hashtag_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `CREATE TABLE "__chart__hashtag" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__hashtag_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___local_count" bigint NOT NULL, "___remote_count" bigint NOT NULL, CONSTRAINT "PK_c32f1ea2b44a5d2f7881e37f8f9" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TYPE "__chart__instance_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `CREATE TABLE "__chart__instance" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__instance_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___requests_failed" bigint NOT NULL, "___requests_succeeded" bigint NOT NULL, "___requests_received" bigint NOT NULL, "___notes_total" bigint NOT NULL, "___notes_inc" bigint NOT NULL, "___notes_dec" bigint NOT NULL, "___notes_diffs_normal" bigint NOT NULL, "___notes_diffs_reply" bigint NOT NULL, "___notes_diffs_renote" bigint NOT NULL, "___users_total" bigint NOT NULL, "___users_inc" bigint NOT NULL, "___users_dec" bigint NOT NULL, "___following_total" bigint NOT NULL, "___following_inc" bigint NOT NULL, "___following_dec" bigint NOT NULL, "___followers_total" bigint NOT NULL, "___followers_inc" bigint NOT NULL, "___followers_dec" bigint NOT NULL, "___drive_totalFiles" bigint NOT NULL, "___drive_totalUsage" bigint NOT NULL, "___drive_incFiles" bigint NOT NULL, "___drive_incUsage" bigint NOT NULL, "___drive_decFiles" bigint NOT NULL, "___drive_decUsage" bigint NOT NULL, CONSTRAINT "PK_1267c67c7c2d47b4903975f2c00" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TYPE "__chart__network_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `CREATE TABLE "__chart__network" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__network_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___incomingRequests" bigint NOT NULL, "___outgoingRequests" bigint NOT NULL, "___totalTime" bigint NOT NULL, "___incomingBytes" bigint NOT NULL, "___outgoingBytes" bigint NOT NULL, CONSTRAINT "PK_bc4290c2e27fad14ef0c1ca93f3" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TYPE "__chart__notes_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `CREATE TABLE "__chart__notes" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__notes_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___local_total" bigint NOT NULL, "___local_inc" bigint NOT NULL, "___local_dec" bigint NOT NULL, "___local_diffs_normal" bigint NOT NULL, "___local_diffs_reply" bigint NOT NULL, "___local_diffs_renote" bigint NOT NULL, "___remote_total" bigint NOT NULL, "___remote_inc" bigint NOT NULL, "___remote_dec" bigint NOT NULL, "___remote_diffs_normal" bigint NOT NULL, "___remote_diffs_reply" bigint NOT NULL, "___remote_diffs_renote" bigint NOT NULL, CONSTRAINT "PK_0aec823fa85c7f901bdb3863b14" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TYPE "__chart__per_user_drive_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `CREATE TABLE "__chart__per_user_drive" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__per_user_drive_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___totalCount" bigint NOT NULL, "___totalSize" bigint NOT NULL, "___incCount" bigint NOT NULL, "___incSize" bigint NOT NULL, "___decCount" bigint NOT NULL, "___decSize" bigint NOT NULL, CONSTRAINT "PK_d0ef23d24d666e1a44a0cd3d208" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TYPE "__chart__per_user_following_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `CREATE TABLE "__chart__per_user_following" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__per_user_following_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___local_followings_total" bigint NOT NULL, "___local_followings_inc" bigint NOT NULL, "___local_followings_dec" bigint NOT NULL, "___local_followers_total" bigint NOT NULL, "___local_followers_inc" bigint NOT NULL, "___local_followers_dec" bigint NOT NULL, "___remote_followings_total" bigint NOT NULL, "___remote_followings_inc" bigint NOT NULL, "___remote_followings_dec" bigint NOT NULL, "___remote_followers_total" bigint NOT NULL, "___remote_followers_inc" bigint NOT NULL, "___remote_followers_dec" bigint NOT NULL, CONSTRAINT "PK_85bb1b540363a29c2fec83bd907" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TYPE "__chart__per_user_notes_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `CREATE TABLE "__chart__per_user_notes" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__per_user_notes_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___total" bigint NOT NULL, "___inc" bigint NOT NULL, "___dec" bigint NOT NULL, "___diffs_normal" bigint NOT NULL, "___diffs_reply" bigint NOT NULL, "___diffs_renote" bigint NOT NULL, CONSTRAINT "PK_334acf6e915af2f29edc11b8e50" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TYPE "__chart__per_user_reaction_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `CREATE TABLE "__chart__per_user_reaction" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__per_user_reaction_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___local_count" bigint NOT NULL, "___remote_count" bigint NOT NULL, CONSTRAINT "PK_984f54dae441e65b633e8d27a7f" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TYPE "__chart__test_grouped_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `CREATE TABLE "__chart__test_grouped" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__test_grouped_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___foo_total" bigint NOT NULL, "___foo_inc" bigint NOT NULL, "___foo_dec" bigint NOT NULL, CONSTRAINT "PK_f4a2b175d308695af30d4293272" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TYPE "__chart__test_unique_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `CREATE TABLE "__chart__test_unique" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__test_unique_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___foo" bigint NOT NULL, CONSTRAINT "PK_409bac9c97cc612d8500012319d" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TYPE "__chart__test_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `CREATE TABLE "__chart__test" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__test_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___foo_total" bigint NOT NULL, "___foo_inc" bigint NOT NULL, "___foo_dec" bigint NOT NULL, CONSTRAINT "PK_b4bc31dffbd1b785276a3ecfc1e" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TYPE "__chart__users_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `CREATE TABLE "__chart__users" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128), "span" "__chart__users_span_enum" NOT NULL, "unique" jsonb NOT NULL DEFAULT '{}', "___local_total" bigint NOT NULL, "___local_inc" bigint NOT NULL, "___local_dec" bigint NOT NULL, "___remote_total" bigint NOT NULL, "___remote_inc" bigint NOT NULL, "___remote_dec" bigint NOT NULL, CONSTRAINT "PK_4dfcf2c78d03524b9eb2c99d328" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `ALTER TABLE "drive_folder" ADD CONSTRAINT "FK_f4fc06e49c0171c85f1c48060d2" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "drive_folder" ADD CONSTRAINT "FK_00ceffb0cdc238b3233294f08f2" FOREIGN KEY ("parentId") REFERENCES "drive_folder"("id") ON DELETE SET NULL ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "drive_file" ADD CONSTRAINT "FK_860fa6f6c7df5bb887249fba22e" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "drive_file" ADD CONSTRAINT "FK_bb90d1956dafc4068c28aa7560a" FOREIGN KEY ("folderId") REFERENCES "drive_folder"("id") ON DELETE SET NULL ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "user" ADD CONSTRAINT "FK_58f5c71eaab331645112cf8cfa5" FOREIGN KEY ("avatarId") REFERENCES "drive_file"("id") ON DELETE SET NULL ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "user" ADD CONSTRAINT "FK_afc64b53f8db3707ceb34eb28e2" FOREIGN KEY ("bannerId") REFERENCES "drive_file"("id") ON DELETE SET NULL ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "app" ADD CONSTRAINT "FK_3f5b0899ef90527a3462d7c2cb3" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "access_token" ADD CONSTRAINT "FK_9949557d0e1b2c19e5344c171e9" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "access_token" ADD CONSTRAINT "FK_a3ff16c90cc87a82a0b5959e560" FOREIGN KEY ("appId") REFERENCES "app"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "note" ADD CONSTRAINT "FK_17cb3553c700a4985dff5a30ff5" FOREIGN KEY ("replyId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "note" ADD CONSTRAINT "FK_52ccc804d7c69037d558bac4c96" FOREIGN KEY ("renoteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "note" ADD CONSTRAINT "FK_ec5c201576192ba8904c345c5cc" FOREIGN KEY ("appId") REFERENCES "app"("id") ON DELETE SET NULL ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "note" ADD CONSTRAINT "FK_5b87d9d19127bd5d92026017a7b" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "poll_vote" ADD CONSTRAINT "FK_66d2bd2ee31d14bcc23069a89f8" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "poll_vote" ADD CONSTRAINT "FK_aecfbd5ef60374918e63ee95fa7" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "note_reaction" ADD CONSTRAINT "FK_13761f64257f40c5636d0ff95ee" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "note_reaction" ADD CONSTRAINT "FK_45145e4953780f3cd5656f0ea6a" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "note_watching" ADD CONSTRAINT "FK_b0134ec406e8d09a540f8182888" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "note_watching" ADD CONSTRAINT "FK_03e7028ab8388a3f5e3ce2a8619" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "note_unread" ADD CONSTRAINT "FK_56b0166d34ddae49d8ef7610bb9" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "note_unread" ADD CONSTRAINT "FK_e637cba4dc4410218c4251260e4" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "notification" ADD CONSTRAINT "FK_3c601b70a1066d2c8b517094cb9" FOREIGN KEY ("notifieeId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "notification" ADD CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710" FOREIGN KEY ("notifierId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "notification" ADD CONSTRAINT "FK_769cb6b73a1efe22ddf733ac453" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "following" ADD CONSTRAINT "FK_24e0042143a18157b234df186c3" FOREIGN KEY ("followeeId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "following" ADD CONSTRAINT "FK_6516c5a6f3c015b4eed39978be5" FOREIGN KEY ("followerId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "muting" ADD CONSTRAINT "FK_ec96b4fed9dae517e0dbbe0675c" FOREIGN KEY ("muteeId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "muting" ADD CONSTRAINT "FK_93060675b4a79a577f31d260c67" FOREIGN KEY ("muterId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "sw_subscription" ADD CONSTRAINT "FK_97754ca6f2baff9b4abb7f853dd" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "blocking" ADD CONSTRAINT "FK_2cd4a2743a99671308f5417759e" FOREIGN KEY ("blockeeId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "blocking" ADD CONSTRAINT "FK_0627125f1a8a42c9a1929edb552" FOREIGN KEY ("blockerId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "user_list" ADD CONSTRAINT "FK_b7fcefbdd1c18dce86687531f99" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "user_list_joining" ADD CONSTRAINT "FK_d844bfc6f3f523a05189076efaa" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "user_list_joining" ADD CONSTRAINT "FK_605472305f26818cc93d1baaa74" FOREIGN KEY ("userListId") REFERENCES "user_list"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "note_favorite" ADD CONSTRAINT "FK_47f4b1892f5d6ba8efb3057d81a" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "note_favorite" ADD CONSTRAINT "FK_0e00498f180193423c992bc4370" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" ADD CONSTRAINT "FK_d049123c413e68ca52abe734203" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" ADD CONSTRAINT "FK_04cc96756f89d0b7f9473e8cdf3" FOREIGN KEY ("reporterId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "messaging_message" ADD CONSTRAINT "FK_5377c307783fce2b6d352e1203b" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "messaging_message" ADD CONSTRAINT "FK_cac14a4e3944454a5ce7daa5142" FOREIGN KEY ("recipientId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "messaging_message" ADD CONSTRAINT "FK_535def119223ac05ad3fa9ef64b" FOREIGN KEY ("fileId") REFERENCES "drive_file"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "signin" ADD CONSTRAINT "FK_2c308dbdc50d94dc625670055f7" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "auth_session" ADD CONSTRAINT "FK_c072b729d71697f959bde66ade0" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "auth_session" ADD CONSTRAINT "FK_dbe037d4bddd17b03a1dc778dee" FOREIGN KEY ("appId") REFERENCES "app"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "follow_request" ADD CONSTRAINT "FK_12c01c0d1a79f77d9f6c15fadd2" FOREIGN KEY ("followeeId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "follow_request" ADD CONSTRAINT "FK_a7fd92dd6dc519e6fb435dd108f" FOREIGN KEY ("followerId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "reversi_game" ADD CONSTRAINT "FK_f7467510c60a45ce5aca6292743" FOREIGN KEY ("user1Id") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "reversi_game" ADD CONSTRAINT "FK_6649a4e8c5d5cf32fb03b5da9f6" FOREIGN KEY ("user2Id") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "reversi_matching" ADD CONSTRAINT "FK_3b25402709dd9882048c2bbade0" FOREIGN KEY ("parentId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "reversi_matching" ADD CONSTRAINT "FK_e247b23a3c9b45f89ec1299d066" FOREIGN KEY ("childId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "user_note_pining" ADD CONSTRAINT "FK_bfbc6f79ba4007b4ce5097f08d6" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "user_note_pining" ADD CONSTRAINT "FK_68881008f7c3588ad7ecae471cf" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "poll" ADD CONSTRAINT "FK_da851e06d0dfe2ef397d8b1bf1b" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "user_keypair" ADD CONSTRAINT "FK_f4853eb41ab722fe05f81cedeb6" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "user_publickey" ADD CONSTRAINT "FK_10c146e4b39b443ede016f6736d" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD CONSTRAINT "FK_51cb79b5555effaf7d69ba1cff9" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" DROP CONSTRAINT "FK_51cb79b5555effaf7d69ba1cff9"`, + ); + await queryRunner.query( + `ALTER TABLE "user_publickey" DROP CONSTRAINT "FK_10c146e4b39b443ede016f6736d"`, + ); + await queryRunner.query( + `ALTER TABLE "user_keypair" DROP CONSTRAINT "FK_f4853eb41ab722fe05f81cedeb6"`, + ); + await queryRunner.query( + `ALTER TABLE "poll" DROP CONSTRAINT "FK_da851e06d0dfe2ef397d8b1bf1b"`, + ); + await queryRunner.query( + `ALTER TABLE "user_note_pining" DROP CONSTRAINT "FK_68881008f7c3588ad7ecae471cf"`, + ); + await queryRunner.query( + `ALTER TABLE "user_note_pining" DROP CONSTRAINT "FK_bfbc6f79ba4007b4ce5097f08d6"`, + ); + await queryRunner.query( + `ALTER TABLE "reversi_matching" DROP CONSTRAINT "FK_e247b23a3c9b45f89ec1299d066"`, + ); + await queryRunner.query( + `ALTER TABLE "reversi_matching" DROP CONSTRAINT "FK_3b25402709dd9882048c2bbade0"`, + ); + await queryRunner.query( + `ALTER TABLE "reversi_game" DROP CONSTRAINT "FK_6649a4e8c5d5cf32fb03b5da9f6"`, + ); + await queryRunner.query( + `ALTER TABLE "reversi_game" DROP CONSTRAINT "FK_f7467510c60a45ce5aca6292743"`, + ); + await queryRunner.query( + `ALTER TABLE "follow_request" DROP CONSTRAINT "FK_a7fd92dd6dc519e6fb435dd108f"`, + ); + await queryRunner.query( + `ALTER TABLE "follow_request" DROP CONSTRAINT "FK_12c01c0d1a79f77d9f6c15fadd2"`, + ); + await queryRunner.query( + `ALTER TABLE "auth_session" DROP CONSTRAINT "FK_dbe037d4bddd17b03a1dc778dee"`, + ); + await queryRunner.query( + `ALTER TABLE "auth_session" DROP CONSTRAINT "FK_c072b729d71697f959bde66ade0"`, + ); + await queryRunner.query( + `ALTER TABLE "signin" DROP CONSTRAINT "FK_2c308dbdc50d94dc625670055f7"`, + ); + await queryRunner.query( + `ALTER TABLE "messaging_message" DROP CONSTRAINT "FK_535def119223ac05ad3fa9ef64b"`, + ); + await queryRunner.query( + `ALTER TABLE "messaging_message" DROP CONSTRAINT "FK_cac14a4e3944454a5ce7daa5142"`, + ); + await queryRunner.query( + `ALTER TABLE "messaging_message" DROP CONSTRAINT "FK_5377c307783fce2b6d352e1203b"`, + ); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" DROP CONSTRAINT "FK_04cc96756f89d0b7f9473e8cdf3"`, + ); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" DROP CONSTRAINT "FK_d049123c413e68ca52abe734203"`, + ); + await queryRunner.query( + `ALTER TABLE "note_favorite" DROP CONSTRAINT "FK_0e00498f180193423c992bc4370"`, + ); + await queryRunner.query( + `ALTER TABLE "note_favorite" DROP CONSTRAINT "FK_47f4b1892f5d6ba8efb3057d81a"`, + ); + await queryRunner.query( + `ALTER TABLE "user_list_joining" DROP CONSTRAINT "FK_605472305f26818cc93d1baaa74"`, + ); + await queryRunner.query( + `ALTER TABLE "user_list_joining" DROP CONSTRAINT "FK_d844bfc6f3f523a05189076efaa"`, + ); + await queryRunner.query( + `ALTER TABLE "user_list" DROP CONSTRAINT "FK_b7fcefbdd1c18dce86687531f99"`, + ); + await queryRunner.query( + `ALTER TABLE "blocking" DROP CONSTRAINT "FK_0627125f1a8a42c9a1929edb552"`, + ); + await queryRunner.query( + `ALTER TABLE "blocking" DROP CONSTRAINT "FK_2cd4a2743a99671308f5417759e"`, + ); + await queryRunner.query( + `ALTER TABLE "sw_subscription" DROP CONSTRAINT "FK_97754ca6f2baff9b4abb7f853dd"`, + ); + await queryRunner.query( + `ALTER TABLE "muting" DROP CONSTRAINT "FK_93060675b4a79a577f31d260c67"`, + ); + await queryRunner.query( + `ALTER TABLE "muting" DROP CONSTRAINT "FK_ec96b4fed9dae517e0dbbe0675c"`, + ); + await queryRunner.query( + `ALTER TABLE "following" DROP CONSTRAINT "FK_6516c5a6f3c015b4eed39978be5"`, + ); + await queryRunner.query( + `ALTER TABLE "following" DROP CONSTRAINT "FK_24e0042143a18157b234df186c3"`, + ); + await queryRunner.query( + `ALTER TABLE "notification" DROP CONSTRAINT "FK_769cb6b73a1efe22ddf733ac453"`, + ); + await queryRunner.query( + `ALTER TABLE "notification" DROP CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710"`, + ); + await queryRunner.query( + `ALTER TABLE "notification" DROP CONSTRAINT "FK_3c601b70a1066d2c8b517094cb9"`, + ); + await queryRunner.query( + `ALTER TABLE "note_unread" DROP CONSTRAINT "FK_e637cba4dc4410218c4251260e4"`, + ); + await queryRunner.query( + `ALTER TABLE "note_unread" DROP CONSTRAINT "FK_56b0166d34ddae49d8ef7610bb9"`, + ); + await queryRunner.query( + `ALTER TABLE "note_watching" DROP CONSTRAINT "FK_03e7028ab8388a3f5e3ce2a8619"`, + ); + await queryRunner.query( + `ALTER TABLE "note_watching" DROP CONSTRAINT "FK_b0134ec406e8d09a540f8182888"`, + ); + await queryRunner.query( + `ALTER TABLE "note_reaction" DROP CONSTRAINT "FK_45145e4953780f3cd5656f0ea6a"`, + ); + await queryRunner.query( + `ALTER TABLE "note_reaction" DROP CONSTRAINT "FK_13761f64257f40c5636d0ff95ee"`, + ); + await queryRunner.query( + `ALTER TABLE "poll_vote" DROP CONSTRAINT "FK_aecfbd5ef60374918e63ee95fa7"`, + ); + await queryRunner.query( + `ALTER TABLE "poll_vote" DROP CONSTRAINT "FK_66d2bd2ee31d14bcc23069a89f8"`, + ); + await queryRunner.query( + `ALTER TABLE "note" DROP CONSTRAINT "FK_5b87d9d19127bd5d92026017a7b"`, + ); + await queryRunner.query( + `ALTER TABLE "note" DROP CONSTRAINT "FK_ec5c201576192ba8904c345c5cc"`, + ); + await queryRunner.query( + `ALTER TABLE "note" DROP CONSTRAINT "FK_52ccc804d7c69037d558bac4c96"`, + ); + await queryRunner.query( + `ALTER TABLE "note" DROP CONSTRAINT "FK_17cb3553c700a4985dff5a30ff5"`, + ); + await queryRunner.query( + `ALTER TABLE "access_token" DROP CONSTRAINT "FK_a3ff16c90cc87a82a0b5959e560"`, + ); + await queryRunner.query( + `ALTER TABLE "access_token" DROP CONSTRAINT "FK_9949557d0e1b2c19e5344c171e9"`, + ); + await queryRunner.query( + `ALTER TABLE "app" DROP CONSTRAINT "FK_3f5b0899ef90527a3462d7c2cb3"`, + ); + await queryRunner.query( + `ALTER TABLE "user" DROP CONSTRAINT "FK_afc64b53f8db3707ceb34eb28e2"`, + ); + await queryRunner.query( + `ALTER TABLE "user" DROP CONSTRAINT "FK_58f5c71eaab331645112cf8cfa5"`, + ); + await queryRunner.query( + `ALTER TABLE "drive_file" DROP CONSTRAINT "FK_bb90d1956dafc4068c28aa7560a"`, + ); + await queryRunner.query( + `ALTER TABLE "drive_file" DROP CONSTRAINT "FK_860fa6f6c7df5bb887249fba22e"`, + ); + await queryRunner.query( + `ALTER TABLE "drive_folder" DROP CONSTRAINT "FK_00ceffb0cdc238b3233294f08f2"`, + ); + await queryRunner.query( + `ALTER TABLE "drive_folder" DROP CONSTRAINT "FK_f4fc06e49c0171c85f1c48060d2"`, + ); + await queryRunner.query(`DROP TABLE "__chart__users"`); + await queryRunner.query(`DROP TYPE "__chart__users_span_enum"`); + await queryRunner.query(`DROP TABLE "__chart__test"`); + await queryRunner.query(`DROP TYPE "__chart__test_span_enum"`); + await queryRunner.query(`DROP TABLE "__chart__test_unique"`); + await queryRunner.query(`DROP TYPE "__chart__test_unique_span_enum"`); + await queryRunner.query(`DROP TABLE "__chart__test_grouped"`); + await queryRunner.query(`DROP TYPE "__chart__test_grouped_span_enum"`); + await queryRunner.query(`DROP TABLE "__chart__per_user_reaction"`); + await queryRunner.query(`DROP TYPE "__chart__per_user_reaction_span_enum"`); + await queryRunner.query(`DROP TABLE "__chart__per_user_notes"`); + await queryRunner.query(`DROP TYPE "__chart__per_user_notes_span_enum"`); + await queryRunner.query(`DROP TABLE "__chart__per_user_following"`); + await queryRunner.query( + `DROP TYPE "__chart__per_user_following_span_enum"`, + ); + await queryRunner.query(`DROP TABLE "__chart__per_user_drive"`); + await queryRunner.query(`DROP TYPE "__chart__per_user_drive_span_enum"`); + await queryRunner.query(`DROP TABLE "__chart__notes"`); + await queryRunner.query(`DROP TYPE "__chart__notes_span_enum"`); + await queryRunner.query(`DROP TABLE "__chart__network"`); + await queryRunner.query(`DROP TYPE "__chart__network_span_enum"`); + await queryRunner.query(`DROP TABLE "__chart__instance"`); + await queryRunner.query(`DROP TYPE "__chart__instance_span_enum"`); + await queryRunner.query(`DROP TABLE "__chart__hashtag"`); + await queryRunner.query(`DROP TYPE "__chart__hashtag_span_enum"`); + await queryRunner.query(`DROP TABLE "__chart__federation"`); + await queryRunner.query(`DROP TYPE "__chart__federation_span_enum"`); + await queryRunner.query(`DROP TABLE "__chart__drive"`); + await queryRunner.query(`DROP TYPE "__chart__drive_span_enum"`); + await queryRunner.query(`DROP TABLE "__chart__active_users"`); + await queryRunner.query(`DROP TYPE "__chart__active_users_span_enum"`); + await queryRunner.query(`DROP INDEX "IDX_dce530b98e454793dac5ec2f5a"`); + await queryRunner.query(`DROP TABLE "user_profile"`); + await queryRunner.query(`DROP INDEX "IDX_171e64971c780ebd23fae140bb"`); + await queryRunner.query(`DROP TABLE "user_publickey"`); + await queryRunner.query(`DROP TABLE "user_keypair"`); + await queryRunner.query(`DROP INDEX "IDX_7fa20a12319c7f6dc3aed98c0a"`); + await queryRunner.query(`DROP INDEX "IDX_0610ebcfcfb4a18441a9bcdab2"`); + await queryRunner.query(`DROP TABLE "poll"`); + await queryRunner.query(`DROP TYPE "poll_notevisibility_enum"`); + await queryRunner.query(`DROP INDEX "IDX_410cd649884b501c02d6e72738"`); + await queryRunner.query(`DROP INDEX "IDX_bfbc6f79ba4007b4ce5097f08d"`); + await queryRunner.query(`DROP TABLE "user_note_pining"`); + await queryRunner.query(`DROP INDEX "IDX_e247b23a3c9b45f89ec1299d06"`); + await queryRunner.query(`DROP INDEX "IDX_3b25402709dd9882048c2bbade"`); + await queryRunner.query(`DROP INDEX "IDX_b604d92d6c7aec38627f6eaf16"`); + await queryRunner.query(`DROP TABLE "reversi_matching"`); + await queryRunner.query(`DROP INDEX "IDX_b46ec40746efceac604142be1c"`); + await queryRunner.query(`DROP TABLE "reversi_game"`); + await queryRunner.query(`DROP INDEX "IDX_4f4d35e1256c84ae3d1f0eab10"`); + await queryRunner.query(`DROP INDEX "IDX_5900e907bb46516ddf2871327c"`); + await queryRunner.query(`DROP INDEX "IDX_b37dafc86e9af007e3295c2781"`); + await queryRunner.query(`DROP TABLE "emoji"`); + await queryRunner.query(`DROP INDEX "IDX_d54a512b822fac7ed52800f6b4"`); + await queryRunner.query(`DROP INDEX "IDX_a7fd92dd6dc519e6fb435dd108"`); + await queryRunner.query(`DROP INDEX "IDX_12c01c0d1a79f77d9f6c15fadd"`); + await queryRunner.query(`DROP TABLE "follow_request"`); + await queryRunner.query(`DROP INDEX "IDX_62cb09e1129f6ec024ef66e183"`); + await queryRunner.query(`DROP TABLE "auth_session"`); + await queryRunner.query(`DROP INDEX "IDX_2c308dbdc50d94dc625670055f"`); + await queryRunner.query(`DROP TABLE "signin"`); + await queryRunner.query(`DROP INDEX "IDX_cac14a4e3944454a5ce7daa514"`); + await queryRunner.query(`DROP INDEX "IDX_5377c307783fce2b6d352e1203"`); + await queryRunner.query(`DROP INDEX "IDX_e21cd3646e52ef9c94aaf17c2e"`); + await queryRunner.query(`DROP TABLE "messaging_message"`); + await queryRunner.query(`DROP INDEX "IDX_0ff69e8dfa9fe31bb4a4660f59"`); + await queryRunner.query(`DROP TABLE "registration_ticket"`); + await queryRunner.query(`DROP INDEX "IDX_5cd442c3b2e74fdd99dae20243"`); + await queryRunner.query(`DROP INDEX "IDX_04cc96756f89d0b7f9473e8cdf"`); + await queryRunner.query(`DROP INDEX "IDX_d049123c413e68ca52abe73420"`); + await queryRunner.query(`DROP INDEX "IDX_db2098070b2b5a523c58181f74"`); + await queryRunner.query(`DROP TABLE "abuse_user_report"`); + await queryRunner.query(`DROP INDEX "IDX_0f4fb9ad355f3effff221ef245"`); + await queryRunner.query(`DROP INDEX "IDX_47f4b1892f5d6ba8efb3057d81"`); + await queryRunner.query(`DROP TABLE "note_favorite"`); + await queryRunner.query(`DROP INDEX "IDX_0b03cbcd7e6a7ce068efa8ecc2"`); + await queryRunner.query(`DROP INDEX "IDX_0c44bf4f680964145f2a68a341"`); + await queryRunner.query(`DROP INDEX "IDX_d57f9030cd3af7f63ffb1c267c"`); + await queryRunner.query(`DROP INDEX "IDX_4c02d38a976c3ae132228c6fce"`); + await queryRunner.query(`DROP INDEX "IDX_0e206cec573f1edff4a3062923"`); + await queryRunner.query(`DROP INDEX "IDX_2710a55f826ee236ea1a62698f"`); + await queryRunner.query(`DROP INDEX "IDX_347fec870eafea7b26c8a73bac"`); + await queryRunner.query(`DROP TABLE "hashtag"`); + await queryRunner.query(`DROP INDEX "IDX_605472305f26818cc93d1baaa7"`); + await queryRunner.query(`DROP INDEX "IDX_d844bfc6f3f523a05189076efa"`); + await queryRunner.query(`DROP TABLE "user_list_joining"`); + await queryRunner.query(`DROP INDEX "IDX_b7fcefbdd1c18dce86687531f9"`); + await queryRunner.query(`DROP TABLE "user_list"`); + await queryRunner.query(`DROP INDEX "IDX_98a1bc5cb30dfd159de056549f"`); + await queryRunner.query(`DROP INDEX "IDX_0627125f1a8a42c9a1929edb55"`); + await queryRunner.query(`DROP INDEX "IDX_2cd4a2743a99671308f5417759"`); + await queryRunner.query(`DROP INDEX "IDX_b9a354f7941c1e779f3b33aea6"`); + await queryRunner.query(`DROP TABLE "blocking"`); + await queryRunner.query(`DROP INDEX "IDX_97754ca6f2baff9b4abb7f853d"`); + await queryRunner.query(`DROP TABLE "sw_subscription"`); + await queryRunner.query(`DROP INDEX "IDX_1eb9d9824a630321a29fd3b290"`); + await queryRunner.query(`DROP INDEX "IDX_93060675b4a79a577f31d260c6"`); + await queryRunner.query(`DROP INDEX "IDX_ec96b4fed9dae517e0dbbe0675"`); + await queryRunner.query(`DROP INDEX "IDX_f86d57fbca33c7a4e6897490cc"`); + await queryRunner.query(`DROP TABLE "muting"`); + await queryRunner.query(`DROP INDEX "IDX_8d5afc98982185799b160e10eb"`); + await queryRunner.query(`DROP INDEX "IDX_2cd3b2a6b4cf0b910b260afe08"`); + await queryRunner.query(`DROP TABLE "instance"`); + await queryRunner.query(`DROP INDEX "IDX_307be5f1d1252e0388662acb96"`); + await queryRunner.query(`DROP INDEX "IDX_6516c5a6f3c015b4eed39978be"`); + await queryRunner.query(`DROP INDEX "IDX_24e0042143a18157b234df186c"`); + await queryRunner.query(`DROP INDEX "IDX_582f8fab771a9040a12961f3e7"`); + await queryRunner.query(`DROP TABLE "following"`); + await queryRunner.query(`DROP TABLE "meta"`); + await queryRunner.query(`DROP INDEX "IDX_3c601b70a1066d2c8b517094cb"`); + await queryRunner.query(`DROP INDEX "IDX_b11a5e627c41d4dc3170f1d370"`); + await queryRunner.query(`DROP TABLE "notification"`); + await queryRunner.query(`DROP INDEX "IDX_d908433a4953cc13216cd9c274"`); + await queryRunner.query(`DROP INDEX "IDX_e637cba4dc4410218c4251260e"`); + await queryRunner.query(`DROP INDEX "IDX_56b0166d34ddae49d8ef7610bb"`); + await queryRunner.query(`DROP TABLE "note_unread"`); + await queryRunner.query(`DROP INDEX "IDX_a42c93c69989ce1d09959df4cf"`); + await queryRunner.query(`DROP INDEX "IDX_44499765eec6b5489d72c4253b"`); + await queryRunner.query(`DROP INDEX "IDX_03e7028ab8388a3f5e3ce2a861"`); + await queryRunner.query(`DROP INDEX "IDX_b0134ec406e8d09a540f818288"`); + await queryRunner.query(`DROP INDEX "IDX_318cdf42a9cfc11f479bd802bb"`); + await queryRunner.query(`DROP TABLE "note_watching"`); + await queryRunner.query(`DROP INDEX "IDX_ad0c221b25672daf2df320a817"`); + await queryRunner.query(`DROP INDEX "IDX_45145e4953780f3cd5656f0ea6"`); + await queryRunner.query(`DROP INDEX "IDX_13761f64257f40c5636d0ff95e"`); + await queryRunner.query(`DROP INDEX "IDX_01f4581f114e0ebd2bbb876f0b"`); + await queryRunner.query(`DROP TABLE "note_reaction"`); + await queryRunner.query(`DROP INDEX "IDX_50bd7164c5b78f1f4a42c4d21f"`); + await queryRunner.query(`DROP INDEX "IDX_aecfbd5ef60374918e63ee95fa"`); + await queryRunner.query(`DROP INDEX "IDX_66d2bd2ee31d14bcc23069a89f"`); + await queryRunner.query(`DROP INDEX "IDX_0fb627e1c2f753262a74f0562d"`); + await queryRunner.query(`DROP TABLE "poll_vote"`); + await queryRunner.query(`DROP INDEX "IDX_7125a826ab192eb27e11d358a5"`); + await queryRunner.query(`DROP INDEX "IDX_88937d94d7443d9a99a76fa5c0"`); + await queryRunner.query(`DROP INDEX "IDX_54ebcb6d27222913b908d56fd8"`); + await queryRunner.query(`DROP INDEX "IDX_796a8c03959361f97dc2be1d5c"`); + await queryRunner.query(`DROP INDEX "IDX_25dfc71b0369b003a4cd434d0b"`); + await queryRunner.query(`DROP INDEX "IDX_51c063b6a133a9cb87145450f5"`); + await queryRunner.query(`DROP INDEX "IDX_153536c67d05e9adb24e99fc2b"`); + await queryRunner.query(`DROP INDEX "IDX_5b87d9d19127bd5d92026017a7"`); + await queryRunner.query(`DROP INDEX "IDX_52ccc804d7c69037d558bac4c9"`); + await queryRunner.query(`DROP INDEX "IDX_17cb3553c700a4985dff5a30ff"`); + await queryRunner.query(`DROP INDEX "IDX_e7c0567f5261063592f022e9b5"`); + await queryRunner.query(`DROP TABLE "note"`); + await queryRunner.query(`DROP TYPE "note_visibility_enum"`); + await queryRunner.query(`DROP INDEX "IDX_9949557d0e1b2c19e5344c171e"`); + await queryRunner.query(`DROP INDEX "IDX_64c327441248bae40f7d92f34f"`); + await queryRunner.query(`DROP INDEX "IDX_70ba8f6af34bc924fc9e12adb8"`); + await queryRunner.query(`DROP TABLE "access_token"`); + await queryRunner.query(`DROP INDEX "IDX_f49922d511d666848f250663c4"`); + await queryRunner.query(`DROP INDEX "IDX_3f5b0899ef90527a3462d7c2cb"`); + await queryRunner.query(`DROP INDEX "IDX_048a757923ed8b157e9895da53"`); + await queryRunner.query(`DROP TABLE "app"`); + await queryRunner.query(`DROP INDEX "IDX_5deb01ae162d1d70b80d064c27"`); + await queryRunner.query(`DROP INDEX "IDX_a854e557b1b14814750c7c7b0c"`); + await queryRunner.query(`DROP INDEX "IDX_be623adaa4c566baf5d29ce0c8"`); + await queryRunner.query(`DROP INDEX "IDX_3252a5df8d5bbd16b281f7799e"`); + await queryRunner.query(`DROP INDEX "IDX_fa99d777623947a5b05f394cae"`); + await queryRunner.query(`DROP INDEX "IDX_a27b942a0d6dcff90e3ee9b5e8"`); + await queryRunner.query(`DROP INDEX "IDX_80ca6e6ef65fb9ef34ea8c90f4"`); + await queryRunner.query(`DROP INDEX "IDX_e11e649824a45d8ed01d597fd9"`); + await queryRunner.query(`DROP TABLE "user"`); + await queryRunner.query(`DROP INDEX "IDX_bb90d1956dafc4068c28aa7560"`); + await queryRunner.query(`DROP INDEX "IDX_e5848eac4940934e23dbc17581"`); + await queryRunner.query(`DROP INDEX "IDX_c55b2b7c284d9fef98026fc88e"`); + await queryRunner.query(`DROP INDEX "IDX_e74022ce9a074b3866f70e0d27"`); + await queryRunner.query(`DROP INDEX "IDX_d85a184c2540d2deba33daf642"`); + await queryRunner.query(`DROP INDEX "IDX_a40b8df8c989d7db937ea27cf6"`); + await queryRunner.query(`DROP INDEX "IDX_37bb9a1b4585f8a3beb24c62d6"`); + await queryRunner.query(`DROP INDEX "IDX_92779627994ac79277f070c91e"`); + await queryRunner.query(`DROP INDEX "IDX_860fa6f6c7df5bb887249fba22"`); + await queryRunner.query(`DROP INDEX "IDX_c8dfad3b72196dd1d6b5db168a"`); + await queryRunner.query(`DROP TABLE "drive_file"`); + await queryRunner.query(`DROP INDEX "IDX_00ceffb0cdc238b3233294f08f"`); + await queryRunner.query(`DROP INDEX "IDX_f4fc06e49c0171c85f1c48060d"`); + await queryRunner.query(`DROP INDEX "IDX_02878d441ceae15ce060b73daf"`); + await queryRunner.query(`DROP TABLE "drive_folder"`); + await queryRunner.query(`DROP INDEX "IDX_584b536b49e53ac81beb39a177"`); + await queryRunner.query(`DROP INDEX "IDX_8cb40cfc8f3c28261e6f887b03"`); + await queryRunner.query(`DROP INDEX "IDX_8e4eb51a35d81b64dda28eed0a"`); + await queryRunner.query(`DROP TABLE "log"`); + await queryRunner.query(`DROP TYPE "log_level_enum"`); + } } diff --git a/packages/backend/migration/1556348509290-Pages.js b/packages/backend/migration/1556348509290-Pages.js index 50caa2ce9..696b2acbe 100644 --- a/packages/backend/migration/1556348509290-Pages.js +++ b/packages/backend/migration/1556348509290-Pages.js @@ -1,28 +1,50 @@ - - export class Pages1556348509290 { - async up(queryRunner) { - await queryRunner.query(`CREATE TYPE "page_visibility_enum" AS ENUM('public', 'followers', 'specified')`); - await queryRunner.query(`CREATE TABLE "page" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, "title" character varying(256) NOT NULL, "name" character varying(256) NOT NULL, "summary" character varying(256), "alignCenter" boolean NOT NULL, "font" character varying(32) NOT NULL, "userId" character varying(32) NOT NULL, "eyeCatchingImageId" character varying(32), "content" jsonb NOT NULL DEFAULT '[]', "variables" jsonb NOT NULL DEFAULT '[]', "visibility" "page_visibility_enum" NOT NULL, "visibleUserIds" character varying(32) array NOT NULL DEFAULT '{}'::varchar[], CONSTRAINT "PK_742f4117e065c5b6ad21b37ba1f" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_fbb4297c927a9b85e9cefa2eb1" ON "page" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_af639b066dfbca78b01a920f8a" ON "page" ("updatedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_b82c19c08afb292de4600d99e4" ON "page" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_ae1d917992dd0c9d9bbdad06c4" ON "page" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_90148bbc2bf0854428786bfc15" ON "page" ("visibleUserIds") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_2133ef8317e4bdb839c0dcbf13" ON "page" ("userId", "name") `); - await queryRunner.query(`ALTER TABLE "page" ADD CONSTRAINT "FK_ae1d917992dd0c9d9bbdad06c4a" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "page" ADD CONSTRAINT "FK_3126dd7c502c9e4d7597ef7ef10" FOREIGN KEY ("eyeCatchingImageId") REFERENCES "drive_file"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "page" DROP CONSTRAINT "FK_3126dd7c502c9e4d7597ef7ef10"`); - await queryRunner.query(`ALTER TABLE "page" DROP CONSTRAINT "FK_ae1d917992dd0c9d9bbdad06c4a"`); - await queryRunner.query(`DROP INDEX "IDX_2133ef8317e4bdb839c0dcbf13"`); - await queryRunner.query(`DROP INDEX "IDX_90148bbc2bf0854428786bfc15"`); - await queryRunner.query(`DROP INDEX "IDX_ae1d917992dd0c9d9bbdad06c4"`); - await queryRunner.query(`DROP INDEX "IDX_b82c19c08afb292de4600d99e4"`); - await queryRunner.query(`DROP INDEX "IDX_af639b066dfbca78b01a920f8a"`); - await queryRunner.query(`DROP INDEX "IDX_fbb4297c927a9b85e9cefa2eb1"`); - await queryRunner.query(`DROP TABLE "page"`); - await queryRunner.query(`DROP TYPE "page_visibility_enum"`); - } + async up(queryRunner) { + await queryRunner.query( + `CREATE TYPE "page_visibility_enum" AS ENUM('public', 'followers', 'specified')`, + ); + await queryRunner.query( + `CREATE TABLE "page" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, "title" character varying(256) NOT NULL, "name" character varying(256) NOT NULL, "summary" character varying(256), "alignCenter" boolean NOT NULL, "font" character varying(32) NOT NULL, "userId" character varying(32) NOT NULL, "eyeCatchingImageId" character varying(32), "content" jsonb NOT NULL DEFAULT '[]', "variables" jsonb NOT NULL DEFAULT '[]', "visibility" "page_visibility_enum" NOT NULL, "visibleUserIds" character varying(32) array NOT NULL DEFAULT '{}'::varchar[], CONSTRAINT "PK_742f4117e065c5b6ad21b37ba1f" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_fbb4297c927a9b85e9cefa2eb1" ON "page" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_af639b066dfbca78b01a920f8a" ON "page" ("updatedAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_b82c19c08afb292de4600d99e4" ON "page" ("name") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_ae1d917992dd0c9d9bbdad06c4" ON "page" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_90148bbc2bf0854428786bfc15" ON "page" ("visibleUserIds") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_2133ef8317e4bdb839c0dcbf13" ON "page" ("userId", "name") `, + ); + await queryRunner.query( + `ALTER TABLE "page" ADD CONSTRAINT "FK_ae1d917992dd0c9d9bbdad06c4a" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "page" ADD CONSTRAINT "FK_3126dd7c502c9e4d7597ef7ef10" FOREIGN KEY ("eyeCatchingImageId") REFERENCES "drive_file"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "page" DROP CONSTRAINT "FK_3126dd7c502c9e4d7597ef7ef10"`, + ); + await queryRunner.query( + `ALTER TABLE "page" DROP CONSTRAINT "FK_ae1d917992dd0c9d9bbdad06c4a"`, + ); + await queryRunner.query(`DROP INDEX "IDX_2133ef8317e4bdb839c0dcbf13"`); + await queryRunner.query(`DROP INDEX "IDX_90148bbc2bf0854428786bfc15"`); + await queryRunner.query(`DROP INDEX "IDX_ae1d917992dd0c9d9bbdad06c4"`); + await queryRunner.query(`DROP INDEX "IDX_b82c19c08afb292de4600d99e4"`); + await queryRunner.query(`DROP INDEX "IDX_af639b066dfbca78b01a920f8a"`); + await queryRunner.query(`DROP INDEX "IDX_fbb4297c927a9b85e9cefa2eb1"`); + await queryRunner.query(`DROP TABLE "page"`); + await queryRunner.query(`DROP TYPE "page_visibility_enum"`); + } } diff --git a/packages/backend/migration/1556746559567-UserProfile.js b/packages/backend/migration/1556746559567-UserProfile.js index 50a9d1a8b..d229ec519 100644 --- a/packages/backend/migration/1556746559567-UserProfile.js +++ b/packages/backend/migration/1556746559567-UserProfile.js @@ -1,13 +1,21 @@ - - export class UserProfile1556746559567 { - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "githubId" TYPE VARCHAR(64) USING "githubId"::VARCHAR(64)`); - await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "discordExpiresDate" TYPE VARCHAR(64) USING "discordExpiresDate"::VARCHAR(64)`); - } - async down(queryRunner) { - await queryRunner.query(`UPDATE "user_profile" SET github = FALSE, discord = FALSE`); - await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "githubId" TYPE INTEGER USING NULL`); - await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "discordExpiresDate" TYPE INTEGER USING NULL`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" ALTER COLUMN "githubId" TYPE VARCHAR(64) USING "githubId"::VARCHAR(64)`, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ALTER COLUMN "discordExpiresDate" TYPE VARCHAR(64) USING "discordExpiresDate"::VARCHAR(64)`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `UPDATE "user_profile" SET github = FALSE, discord = FALSE`, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ALTER COLUMN "githubId" TYPE INTEGER USING NULL`, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ALTER COLUMN "discordExpiresDate" TYPE INTEGER USING NULL`, + ); + } } diff --git a/packages/backend/migration/1557476068003-PinnedUsers.js b/packages/backend/migration/1557476068003-PinnedUsers.js index d9cce2543..6f348836a 100644 --- a/packages/backend/migration/1557476068003-PinnedUsers.js +++ b/packages/backend/migration/1557476068003-PinnedUsers.js @@ -1,10 +1,10 @@ - - export class PinnedUsers1557476068003 { - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "pinnedUsers" character varying(256) array NOT NULL DEFAULT '{}'::varchar[]`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "pinnedUsers"`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "pinnedUsers" character varying(256) array NOT NULL DEFAULT '{}'::varchar[]`, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "pinnedUsers"`); + } } diff --git a/packages/backend/migration/1557761316509-AddSomeUrls.js b/packages/backend/migration/1557761316509-AddSomeUrls.js index ab8736f7c..0734e14e9 100644 --- a/packages/backend/migration/1557761316509-AddSomeUrls.js +++ b/packages/backend/migration/1557761316509-AddSomeUrls.js @@ -1,14 +1,18 @@ - - export class AddSomeUrls1557761316509 { - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "ToSUrl" character varying(512)`); - await queryRunner.query(`ALTER TABLE "meta" ADD "repositoryUrl" character varying(512) NOT NULL DEFAULT 'https://github.com/misskey-dev/misskey'`); - await queryRunner.query(`ALTER TABLE "meta" ADD "feedbackUrl" character varying(512) DEFAULT 'https://github.com/misskey-dev/misskey/issues/new'`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "feedbackUrl"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "repositoryUrl"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "ToSUrl"`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "ToSUrl" character varying(512)`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "repositoryUrl" character varying(512) NOT NULL DEFAULT 'https://github.com/misskey-dev/misskey'`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "feedbackUrl" character varying(512) DEFAULT 'https://github.com/misskey-dev/misskey/issues/new'`, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "feedbackUrl"`); + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "repositoryUrl"`); + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "ToSUrl"`); + } } diff --git a/packages/backend/migration/1557932705754-ObjectStorageSetting.js b/packages/backend/migration/1557932705754-ObjectStorageSetting.js index 19a0b9d5c..5fcc98fe1 100644 --- a/packages/backend/migration/1557932705754-ObjectStorageSetting.js +++ b/packages/backend/migration/1557932705754-ObjectStorageSetting.js @@ -1,28 +1,66 @@ - - export class ObjectStorageSetting1557932705754 { - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "useObjectStorage" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`ALTER TABLE "meta" ADD "objectStorageBucket" character varying(512)`); - await queryRunner.query(`ALTER TABLE "meta" ADD "objectStoragePrefix" character varying(512)`); - await queryRunner.query(`ALTER TABLE "meta" ADD "objectStorageBaseUrl" character varying(512)`); - await queryRunner.query(`ALTER TABLE "meta" ADD "objectStorageEndpoint" character varying(512)`); - await queryRunner.query(`ALTER TABLE "meta" ADD "objectStorageRegion" character varying(512)`); - await queryRunner.query(`ALTER TABLE "meta" ADD "objectStorageAccessKey" character varying(512)`); - await queryRunner.query(`ALTER TABLE "meta" ADD "objectStorageSecretKey" character varying(512)`); - await queryRunner.query(`ALTER TABLE "meta" ADD "objectStoragePort" integer`); - await queryRunner.query(`ALTER TABLE "meta" ADD "objectStorageUseSSL" boolean NOT NULL DEFAULT true`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "objectStorageUseSSL"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "objectStoragePort"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "objectStorageSecretKey"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "objectStorageAccessKey"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "objectStorageRegion"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "objectStorageEndpoint"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "objectStorageBaseUrl"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "objectStoragePrefix"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "objectStorageBucket"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "useObjectStorage"`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "useObjectStorage" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "objectStorageBucket" character varying(512)`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "objectStoragePrefix" character varying(512)`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "objectStorageBaseUrl" character varying(512)`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "objectStorageEndpoint" character varying(512)`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "objectStorageRegion" character varying(512)`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "objectStorageAccessKey" character varying(512)`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "objectStorageSecretKey" character varying(512)`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "objectStoragePort" integer`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "objectStorageUseSSL" boolean NOT NULL DEFAULT true`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "objectStorageUseSSL"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "objectStoragePort"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "objectStorageSecretKey"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "objectStorageAccessKey"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "objectStorageRegion"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "objectStorageEndpoint"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "objectStorageBaseUrl"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "objectStoragePrefix"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "objectStorageBucket"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "useObjectStorage"`, + ); + } } diff --git a/packages/backend/migration/1558072954435-PageLike.js b/packages/backend/migration/1558072954435-PageLike.js index 31b08418a..e919e02dd 100644 --- a/packages/backend/migration/1558072954435-PageLike.js +++ b/packages/backend/migration/1558072954435-PageLike.js @@ -1,20 +1,34 @@ - - export class PageLike1558072954435 { - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "page_like" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "pageId" character varying(32) NOT NULL, CONSTRAINT "PK_813f034843af992d3ae0f43c64c" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_0e61efab7f88dbb79c9166dbb4" ON "page_like" ("userId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_4ce6fb9c70529b4c8ac46c9bfa" ON "page_like" ("userId", "pageId") `); - await queryRunner.query(`ALTER TABLE "page" ADD "likedCount" integer NOT NULL DEFAULT 0`); - await queryRunner.query(`ALTER TABLE "page_like" ADD CONSTRAINT "FK_0e61efab7f88dbb79c9166dbb48" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "page_like" ADD CONSTRAINT "FK_cf8782626dced3176038176a847" FOREIGN KEY ("pageId") REFERENCES "page"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "page_like" DROP CONSTRAINT "FK_cf8782626dced3176038176a847"`); - await queryRunner.query(`ALTER TABLE "page_like" DROP CONSTRAINT "FK_0e61efab7f88dbb79c9166dbb48"`); - await queryRunner.query(`ALTER TABLE "page" DROP COLUMN "likedCount"`); - await queryRunner.query(`DROP INDEX "IDX_4ce6fb9c70529b4c8ac46c9bfa"`); - await queryRunner.query(`DROP INDEX "IDX_0e61efab7f88dbb79c9166dbb4"`); - await queryRunner.query(`DROP TABLE "page_like"`); - } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "page_like" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "pageId" character varying(32) NOT NULL, CONSTRAINT "PK_813f034843af992d3ae0f43c64c" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0e61efab7f88dbb79c9166dbb4" ON "page_like" ("userId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_4ce6fb9c70529b4c8ac46c9bfa" ON "page_like" ("userId", "pageId") `, + ); + await queryRunner.query( + `ALTER TABLE "page" ADD "likedCount" integer NOT NULL DEFAULT 0`, + ); + await queryRunner.query( + `ALTER TABLE "page_like" ADD CONSTRAINT "FK_0e61efab7f88dbb79c9166dbb48" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "page_like" ADD CONSTRAINT "FK_cf8782626dced3176038176a847" FOREIGN KEY ("pageId") REFERENCES "page"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "page_like" DROP CONSTRAINT "FK_cf8782626dced3176038176a847"`, + ); + await queryRunner.query( + `ALTER TABLE "page_like" DROP CONSTRAINT "FK_0e61efab7f88dbb79c9166dbb48"`, + ); + await queryRunner.query(`ALTER TABLE "page" DROP COLUMN "likedCount"`); + await queryRunner.query(`DROP INDEX "IDX_4ce6fb9c70529b4c8ac46c9bfa"`); + await queryRunner.query(`DROP INDEX "IDX_0e61efab7f88dbb79c9166dbb4"`); + await queryRunner.query(`DROP TABLE "page_like"`); + } } diff --git a/packages/backend/migration/1558103093633-UserGroup.js b/packages/backend/migration/1558103093633-UserGroup.js index b670b31c3..dc581a24e 100644 --- a/packages/backend/migration/1558103093633-UserGroup.js +++ b/packages/backend/migration/1558103093633-UserGroup.js @@ -1,38 +1,82 @@ - - export class UserGroup1558103093633 { - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "user_group" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "name" character varying(256) NOT NULL, "userId" character varying(32) NOT NULL, "isPrivate" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_3c29fba6fe013ec8724378ce7c9" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_20e30aa35180e317e133d75316" ON "user_group" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_3d6b372788ab01be58853003c9" ON "user_group" ("userId") `); - await queryRunner.query(`CREATE TABLE "user_group_joining" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "userGroupId" character varying(32) NOT NULL, CONSTRAINT "PK_15f2425885253c5507e1599cfe7" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_f3a1b4bd0c7cabba958a0c0b23" ON "user_group_joining" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_67dc758bc0566985d1b3d39986" ON "user_group_joining" ("userGroupId") `); - await queryRunner.query(`ALTER TABLE "messaging_message" ADD "groupId" character varying(32)`); - await queryRunner.query(`ALTER TABLE "messaging_message" ADD "reads" character varying(32) array NOT NULL DEFAULT '{}'::varchar[]`); - await queryRunner.query(`ALTER TABLE "messaging_message" ALTER COLUMN "recipientId" DROP NOT NULL`); - await queryRunner.query(`COMMENT ON COLUMN "messaging_message"."recipientId" IS 'The recipient user ID.'`); - await queryRunner.query(`CREATE INDEX "IDX_2c4be03b446884f9e9c502135b" ON "messaging_message" ("groupId") `); - await queryRunner.query(`ALTER TABLE "messaging_message" ADD CONSTRAINT "FK_2c4be03b446884f9e9c502135be" FOREIGN KEY ("groupId") REFERENCES "user_group"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "user_group" ADD CONSTRAINT "FK_3d6b372788ab01be58853003c93" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "user_group_joining" ADD CONSTRAINT "FK_f3a1b4bd0c7cabba958a0c0b231" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "user_group_joining" ADD CONSTRAINT "FK_67dc758bc0566985d1b3d399865" FOREIGN KEY ("userGroupId") REFERENCES "user_group"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_group_joining" DROP CONSTRAINT "FK_67dc758bc0566985d1b3d399865"`); - await queryRunner.query(`ALTER TABLE "user_group_joining" DROP CONSTRAINT "FK_f3a1b4bd0c7cabba958a0c0b231"`); - await queryRunner.query(`ALTER TABLE "user_group" DROP CONSTRAINT "FK_3d6b372788ab01be58853003c93"`); - await queryRunner.query(`ALTER TABLE "messaging_message" DROP CONSTRAINT "FK_2c4be03b446884f9e9c502135be"`); - await queryRunner.query(`DROP INDEX "IDX_2c4be03b446884f9e9c502135b"`); - await queryRunner.query(`COMMENT ON COLUMN "messaging_message"."recipientId" IS ''`); - await queryRunner.query(`ALTER TABLE "messaging_message" ALTER COLUMN "recipientId" SET NOT NULL`); - await queryRunner.query(`ALTER TABLE "messaging_message" DROP COLUMN "reads"`); - await queryRunner.query(`ALTER TABLE "messaging_message" DROP COLUMN "groupId"`); - await queryRunner.query(`DROP INDEX "IDX_67dc758bc0566985d1b3d39986"`); - await queryRunner.query(`DROP INDEX "IDX_f3a1b4bd0c7cabba958a0c0b23"`); - await queryRunner.query(`DROP TABLE "user_group_joining"`); - await queryRunner.query(`DROP INDEX "IDX_3d6b372788ab01be58853003c9"`); - await queryRunner.query(`DROP INDEX "IDX_20e30aa35180e317e133d75316"`); - await queryRunner.query(`DROP TABLE "user_group"`); - } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "user_group" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "name" character varying(256) NOT NULL, "userId" character varying(32) NOT NULL, "isPrivate" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_3c29fba6fe013ec8724378ce7c9" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_20e30aa35180e317e133d75316" ON "user_group" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_3d6b372788ab01be58853003c9" ON "user_group" ("userId") `, + ); + await queryRunner.query( + `CREATE TABLE "user_group_joining" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "userGroupId" character varying(32) NOT NULL, CONSTRAINT "PK_15f2425885253c5507e1599cfe7" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f3a1b4bd0c7cabba958a0c0b23" ON "user_group_joining" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_67dc758bc0566985d1b3d39986" ON "user_group_joining" ("userGroupId") `, + ); + await queryRunner.query( + `ALTER TABLE "messaging_message" ADD "groupId" character varying(32)`, + ); + await queryRunner.query( + `ALTER TABLE "messaging_message" ADD "reads" character varying(32) array NOT NULL DEFAULT '{}'::varchar[]`, + ); + await queryRunner.query( + `ALTER TABLE "messaging_message" ALTER COLUMN "recipientId" DROP NOT NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "messaging_message"."recipientId" IS 'The recipient user ID.'`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_2c4be03b446884f9e9c502135b" ON "messaging_message" ("groupId") `, + ); + await queryRunner.query( + `ALTER TABLE "messaging_message" ADD CONSTRAINT "FK_2c4be03b446884f9e9c502135be" FOREIGN KEY ("groupId") REFERENCES "user_group"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "user_group" ADD CONSTRAINT "FK_3d6b372788ab01be58853003c93" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "user_group_joining" ADD CONSTRAINT "FK_f3a1b4bd0c7cabba958a0c0b231" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "user_group_joining" ADD CONSTRAINT "FK_67dc758bc0566985d1b3d399865" FOREIGN KEY ("userGroupId") REFERENCES "user_group"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_group_joining" DROP CONSTRAINT "FK_67dc758bc0566985d1b3d399865"`, + ); + await queryRunner.query( + `ALTER TABLE "user_group_joining" DROP CONSTRAINT "FK_f3a1b4bd0c7cabba958a0c0b231"`, + ); + await queryRunner.query( + `ALTER TABLE "user_group" DROP CONSTRAINT "FK_3d6b372788ab01be58853003c93"`, + ); + await queryRunner.query( + `ALTER TABLE "messaging_message" DROP CONSTRAINT "FK_2c4be03b446884f9e9c502135be"`, + ); + await queryRunner.query(`DROP INDEX "IDX_2c4be03b446884f9e9c502135b"`); + await queryRunner.query( + `COMMENT ON COLUMN "messaging_message"."recipientId" IS ''`, + ); + await queryRunner.query( + `ALTER TABLE "messaging_message" ALTER COLUMN "recipientId" SET NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "messaging_message" DROP COLUMN "reads"`, + ); + await queryRunner.query( + `ALTER TABLE "messaging_message" DROP COLUMN "groupId"`, + ); + await queryRunner.query(`DROP INDEX "IDX_67dc758bc0566985d1b3d39986"`); + await queryRunner.query(`DROP INDEX "IDX_f3a1b4bd0c7cabba958a0c0b23"`); + await queryRunner.query(`DROP TABLE "user_group_joining"`); + await queryRunner.query(`DROP INDEX "IDX_3d6b372788ab01be58853003c9"`); + await queryRunner.query(`DROP INDEX "IDX_20e30aa35180e317e133d75316"`); + await queryRunner.query(`DROP TABLE "user_group"`); + } } diff --git a/packages/backend/migration/1558257926829-UserGroupInvite.js b/packages/backend/migration/1558257926829-UserGroupInvite.js index e48bd3a7f..ed137fdb2 100644 --- a/packages/backend/migration/1558257926829-UserGroupInvite.js +++ b/packages/backend/migration/1558257926829-UserGroupInvite.js @@ -1,22 +1,38 @@ - - export class UserGroupInvite1558257926829 { - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "user_group_invite" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "userGroupId" character varying(32) NOT NULL, CONSTRAINT "PK_3893884af0d3a5f4d01e7921a97" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_1039988afa3bf991185b277fe0" ON "user_group_invite" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_e10924607d058004304611a436" ON "user_group_invite" ("userGroupId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_78787741f9010886796f2320a4" ON "user_group_invite" ("userId", "userGroupId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_d9ecaed8c6dc43f3592c229282" ON "user_group_joining" ("userId", "userGroupId") `); - await queryRunner.query(`ALTER TABLE "user_group_invite" ADD CONSTRAINT "FK_1039988afa3bf991185b277fe03" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "user_group_invite" ADD CONSTRAINT "FK_e10924607d058004304611a436a" FOREIGN KEY ("userGroupId") REFERENCES "user_group"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_group_invite" DROP CONSTRAINT "FK_e10924607d058004304611a436a"`); - await queryRunner.query(`ALTER TABLE "user_group_invite" DROP CONSTRAINT "FK_1039988afa3bf991185b277fe03"`); - await queryRunner.query(`DROP INDEX "IDX_d9ecaed8c6dc43f3592c229282"`); - await queryRunner.query(`DROP INDEX "IDX_78787741f9010886796f2320a4"`); - await queryRunner.query(`DROP INDEX "IDX_e10924607d058004304611a436"`); - await queryRunner.query(`DROP INDEX "IDX_1039988afa3bf991185b277fe0"`); - await queryRunner.query(`DROP TABLE "user_group_invite"`); - } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "user_group_invite" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "userGroupId" character varying(32) NOT NULL, CONSTRAINT "PK_3893884af0d3a5f4d01e7921a97" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_1039988afa3bf991185b277fe0" ON "user_group_invite" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_e10924607d058004304611a436" ON "user_group_invite" ("userGroupId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_78787741f9010886796f2320a4" ON "user_group_invite" ("userId", "userGroupId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_d9ecaed8c6dc43f3592c229282" ON "user_group_joining" ("userId", "userGroupId") `, + ); + await queryRunner.query( + `ALTER TABLE "user_group_invite" ADD CONSTRAINT "FK_1039988afa3bf991185b277fe03" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "user_group_invite" ADD CONSTRAINT "FK_e10924607d058004304611a436a" FOREIGN KEY ("userGroupId") REFERENCES "user_group"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_group_invite" DROP CONSTRAINT "FK_e10924607d058004304611a436a"`, + ); + await queryRunner.query( + `ALTER TABLE "user_group_invite" DROP CONSTRAINT "FK_1039988afa3bf991185b277fe03"`, + ); + await queryRunner.query(`DROP INDEX "IDX_d9ecaed8c6dc43f3592c229282"`); + await queryRunner.query(`DROP INDEX "IDX_78787741f9010886796f2320a4"`); + await queryRunner.query(`DROP INDEX "IDX_e10924607d058004304611a436"`); + await queryRunner.query(`DROP INDEX "IDX_1039988afa3bf991185b277fe0"`); + await queryRunner.query(`DROP TABLE "user_group_invite"`); + } } diff --git a/packages/backend/migration/1558266512381-UserListJoining.js b/packages/backend/migration/1558266512381-UserListJoining.js index 3398aed13..3597e51f7 100644 --- a/packages/backend/migration/1558266512381-UserListJoining.js +++ b/packages/backend/migration/1558266512381-UserListJoining.js @@ -1,10 +1,10 @@ - - export class UserListJoining1558266512381 { - async up(queryRunner) { - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_90f7da835e4c10aca6853621e1" ON "user_list_joining" ("userId", "userListId") `); - } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "IDX_90f7da835e4c10aca6853621e1"`); - } + async up(queryRunner) { + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_90f7da835e4c10aca6853621e1" ON "user_list_joining" ("userId", "userListId") `, + ); + } + async down(queryRunner) { + await queryRunner.query(`DROP INDEX "IDX_90f7da835e4c10aca6853621e1"`); + } } diff --git a/packages/backend/migration/1561706992953-webauthn.js b/packages/backend/migration/1561706992953-webauthn.js index b007ffef1..f860d2c11 100644 --- a/packages/backend/migration/1561706992953-webauthn.js +++ b/packages/backend/migration/1561706992953-webauthn.js @@ -1,26 +1,48 @@ - - export class webauthn1561706992953 { - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "attestation_challenge" ("id" character varying(32) NOT NULL, "userId" character varying(32) NOT NULL, "challenge" character varying(64) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "registrationChallenge" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_d0ba6786e093f1bcb497572a6b5" PRIMARY KEY ("id", "userId"))`); - await queryRunner.query(`CREATE INDEX "IDX_f1a461a618fa1755692d0e0d59" ON "attestation_challenge" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_47efb914aed1f72dd39a306c7b" ON "attestation_challenge" ("challenge") `); - await queryRunner.query(`CREATE TABLE "user_security_key" ("id" character varying NOT NULL, "userId" character varying(32) NOT NULL, "publicKey" character varying NOT NULL, "lastUsed" TIMESTAMP WITH TIME ZONE NOT NULL, "name" character varying(30) NOT NULL, CONSTRAINT "PK_3e508571121ab39c5f85d10c166" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_ff9ca3b5f3ee3d0681367a9b44" ON "user_security_key" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_0d7718e562dcedd0aa5cf2c9f7" ON "user_security_key" ("publicKey") `); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "securityKeysAvailable" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`ALTER TABLE "attestation_challenge" ADD CONSTRAINT "FK_f1a461a618fa1755692d0e0d592" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "user_security_key" ADD CONSTRAINT "FK_ff9ca3b5f3ee3d0681367a9b447" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_security_key" DROP CONSTRAINT "FK_ff9ca3b5f3ee3d0681367a9b447"`); - await queryRunner.query(`ALTER TABLE "attestation_challenge" DROP CONSTRAINT "FK_f1a461a618fa1755692d0e0d592"`); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "securityKeysAvailable"`); - await queryRunner.query(`DROP INDEX "IDX_0d7718e562dcedd0aa5cf2c9f7"`); - await queryRunner.query(`DROP INDEX "IDX_ff9ca3b5f3ee3d0681367a9b44"`); - await queryRunner.query(`DROP TABLE "user_security_key"`); - await queryRunner.query(`DROP INDEX "IDX_47efb914aed1f72dd39a306c7b"`); - await queryRunner.query(`DROP INDEX "IDX_f1a461a618fa1755692d0e0d59"`); - await queryRunner.query(`DROP TABLE "attestation_challenge"`); - } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "attestation_challenge" ("id" character varying(32) NOT NULL, "userId" character varying(32) NOT NULL, "challenge" character varying(64) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "registrationChallenge" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_d0ba6786e093f1bcb497572a6b5" PRIMARY KEY ("id", "userId"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f1a461a618fa1755692d0e0d59" ON "attestation_challenge" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_47efb914aed1f72dd39a306c7b" ON "attestation_challenge" ("challenge") `, + ); + await queryRunner.query( + `CREATE TABLE "user_security_key" ("id" character varying NOT NULL, "userId" character varying(32) NOT NULL, "publicKey" character varying NOT NULL, "lastUsed" TIMESTAMP WITH TIME ZONE NOT NULL, "name" character varying(30) NOT NULL, CONSTRAINT "PK_3e508571121ab39c5f85d10c166" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_ff9ca3b5f3ee3d0681367a9b44" ON "user_security_key" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0d7718e562dcedd0aa5cf2c9f7" ON "user_security_key" ("publicKey") `, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "securityKeysAvailable" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `ALTER TABLE "attestation_challenge" ADD CONSTRAINT "FK_f1a461a618fa1755692d0e0d592" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "user_security_key" ADD CONSTRAINT "FK_ff9ca3b5f3ee3d0681367a9b447" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_security_key" DROP CONSTRAINT "FK_ff9ca3b5f3ee3d0681367a9b447"`, + ); + await queryRunner.query( + `ALTER TABLE "attestation_challenge" DROP CONSTRAINT "FK_f1a461a618fa1755692d0e0d592"`, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "securityKeysAvailable"`, + ); + await queryRunner.query(`DROP INDEX "IDX_0d7718e562dcedd0aa5cf2c9f7"`); + await queryRunner.query(`DROP INDEX "IDX_ff9ca3b5f3ee3d0681367a9b44"`); + await queryRunner.query(`DROP TABLE "user_security_key"`); + await queryRunner.query(`DROP INDEX "IDX_47efb914aed1f72dd39a306c7b"`); + await queryRunner.query(`DROP INDEX "IDX_f1a461a618fa1755692d0e0d59"`); + await queryRunner.query(`DROP TABLE "attestation_challenge"`); + } } diff --git a/packages/backend/migration/1561873850023-ChartIndexes.js b/packages/backend/migration/1561873850023-ChartIndexes.js index 3ce53567f..ba46da1e4 100644 --- a/packages/backend/migration/1561873850023-ChartIndexes.js +++ b/packages/backend/migration/1561873850023-ChartIndexes.js @@ -1,198 +1,376 @@ - - export class ChartIndexes1561873850023 { - async up(queryRunner) { - await queryRunner.query(`CREATE INDEX "IDX_0ad37b7ef50f4ddc84363d7ccc" ON "__chart__active_users" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_15e91a03aeeac9dbccdf43fc06" ON "__chart__active_users" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_00ed5f86db1f7efafb1978bf21" ON "__chart__active_users" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_20f57cc8f142c131340ee16742" ON "__chart__active_users" ("span", "date") `); - await queryRunner.query(`CREATE INDEX "IDX_9a3ed15a30ab7e3a37702e6e08" ON "__chart__active_users" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_c26e2c1cbb6e911e0554b27416" ON "__chart__active_users" ("span", "date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_13565815f618a1ff53886c5b28" ON "__chart__drive" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_3fa0d0f17ca72e3dc80999a032" ON "__chart__drive" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_7a170f67425e62a8fabb76c872" ON "__chart__drive" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_6e1df243476e20cbf86572ecc0" ON "__chart__drive" ("span", "date") `); - await queryRunner.query(`CREATE INDEX "IDX_3313d7288855ec105b5bbf6c21" ON "__chart__drive" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_06690fc959f1c9fdaf21928222" ON "__chart__drive" ("span", "date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_36cb699c49580d4e6c2e6159f9" ON "__chart__federation" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_e447064455928cf627590ef527" ON "__chart__federation" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_76e87c7bfc5d925fcbba405d84" ON "__chart__federation" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_2d416e6af791a82e338c79d480" ON "__chart__federation" ("span", "date") `); - await queryRunner.query(`CREATE INDEX "IDX_dd907becf76104e4b656659e6b" ON "__chart__federation" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_e9cd07672b37d8966cf3709283" ON "__chart__federation" ("span", "date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_07747a1038c05f532a718fe1de" ON "__chart__hashtag" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_fcc181fb8283009c61cc4083ef" ON "__chart__hashtag" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_99a7d2faaef84a6f728d714ad6" ON "__chart__hashtag" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_49975586f50ed7b800fdd88fbd" ON "__chart__hashtag" ("span", "date") `); - await queryRunner.query(`CREATE INDEX "IDX_25a97c02003338124b2b75fdbc" ON "__chart__hashtag" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_6d6f156ceefc6bc5f273a0e370" ON "__chart__hashtag" ("span", "date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_6b8f34a1a64b06014b6fb66824" ON "__chart__instance" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_c12f0af4a66cdd30c2287ce8aa" ON "__chart__instance" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_da8a46ba84ca1d8bb5a29bfb63" ON "__chart__instance" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_d0a4f79af5a97b08f37b547197" ON "__chart__instance" ("span", "date") `); - await queryRunner.query(`CREATE INDEX "IDX_39ee857ab2f23493037c6b6631" ON "__chart__instance" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_f5448d9633cff74208d850aabe" ON "__chart__instance" ("span", "date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_a1efd3e0048a5f2793a47360dc" ON "__chart__network" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_f8dd01baeded2ffa833e0a610a" ON "__chart__network" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_7b5da130992ec9df96712d4290" ON "__chart__network" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_08fac0eb3b11f04c200c0b40dd" ON "__chart__network" ("span", "date") `); - await queryRunner.query(`CREATE INDEX "IDX_0a905b992fecd2b5c3fb98759e" ON "__chart__network" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_9ff6944f01acb756fdc92d7563" ON "__chart__network" ("span", "date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_42eb716a37d381cdf566192b2b" ON "__chart__notes" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_e69096589f11e3baa98ddd64d0" ON "__chart__notes" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_7036f2957151588b813185c794" ON "__chart__notes" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_0c9a159c5082cbeef3ca6706b5" ON "__chart__notes" ("span", "date") `); - await queryRunner.query(`CREATE INDEX "IDX_f09d543e3acb16c5976bdb31fa" ON "__chart__notes" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_924fc196c80ca24bae01dd37e4" ON "__chart__notes" ("span", "date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_5f86db6492274e07c1a3cdf286" ON "__chart__per_user_drive" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_328f259961e60c4fa0bfcf55ca" ON "__chart__per_user_drive" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_e496ca8096d28f6b9b509264dc" ON "__chart__per_user_drive" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_42ea9381f0fda8dfe0fa1c8b53" ON "__chart__per_user_drive" ("span", "date") `); - await queryRunner.query(`CREATE INDEX "IDX_30bf67687f483ace115c5ca642" ON "__chart__per_user_drive" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_f2aeafde2ae6fbad38e857631b" ON "__chart__per_user_drive" ("span", "date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_7af07790712aa3438ff6773f3b" ON "__chart__per_user_following" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_f92dd6d03f8d994f29987f6214" ON "__chart__per_user_following" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_4b3593098b6edc9c5afe36b18b" ON "__chart__per_user_following" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_57b5458d0d3d6d1e7f13d4e57f" ON "__chart__per_user_following" ("span", "date") `); - await queryRunner.query(`CREATE INDEX "IDX_b77d4dd9562c3a899d9a286fcd" ON "__chart__per_user_following" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_4db3b84c7be0d3464714f3e0b1" ON "__chart__per_user_following" ("span", "date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_84234bd1abb873f07329681c83" ON "__chart__per_user_notes" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_8d2cbbc8114d90d19b44d626b6" ON "__chart__per_user_notes" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_55bf20f366979f2436de99206b" ON "__chart__per_user_notes" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_046feeb12e9ef5f783f409866a" ON "__chart__per_user_notes" ("span", "date") `); - await queryRunner.query(`CREATE INDEX "IDX_5048e9daccbbbc6d567bb142d3" ON "__chart__per_user_notes" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_f68a5ab958f9f5fa17a32ac23b" ON "__chart__per_user_notes" ("span", "date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_f7bf4c62059764c2c2bb40fdab" ON "__chart__per_user_reaction" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_65633a106bce43fc7c5c30a5c7" ON "__chart__per_user_reaction" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_8cf3156fd7a6b15c43459c6e3b" ON "__chart__per_user_reaction" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_edeb73c09c3143a81bcb34d569" ON "__chart__per_user_reaction" ("span", "date") `); - await queryRunner.query(`CREATE INDEX "IDX_229a41ad465f9205f1f5703291" ON "__chart__per_user_reaction" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_e316f01a6d24eb31db27f88262" ON "__chart__per_user_reaction" ("span", "date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_0c641990ecf47d2545df4edb75" ON "__chart__test_grouped" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_2be7ec6cebddc14dc11e206686" ON "__chart__test_grouped" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_234dff3c0b56a6150b95431ab9" ON "__chart__test_grouped" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_a5133470f4825902e170328ca5" ON "__chart__test_grouped" ("span", "date") `); - await queryRunner.query(`CREATE INDEX "IDX_b14489029e4b3aaf4bba5fb524" ON "__chart__test_grouped" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_84e661abb7bd1e51b690d4b017" ON "__chart__test_grouped" ("span", "date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_437bab3c6061d90f6bb65fd2cc" ON "__chart__test_unique" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_5c73bf61da4f6e6f15bae88ed1" ON "__chart__test_unique" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_bbfa573a8181018851ed0b6357" ON "__chart__test_unique" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_d70c86baedc68326be11f9c0ce" ON "__chart__test_unique" ("span", "date") `); - await queryRunner.query(`CREATE INDEX "IDX_a0cd75442dd10d0643a17c4a49" ON "__chart__test_unique" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_66e1e1ecd2f29e57778af35b59" ON "__chart__test_unique" ("span", "date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_b070a906db04b44c67c6c2144d" ON "__chart__test" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_92255988735563f0fe4aba1f05" ON "__chart__test" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_d41cce6aee1a50bfc062038f9b" ON "__chart__test" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_c5870993e25c3d5771f91f5003" ON "__chart__test" ("span", "date") `); - await queryRunner.query(`CREATE INDEX "IDX_a319e5dbf47e8a17497623beae" ON "__chart__test" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_f170de677ea75ad4533de2723e" ON "__chart__test" ("span", "date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_845254b3eaf708ae8a6cac3026" ON "__chart__users" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_7c184198ecf66a8d3ecb253ab3" ON "__chart__users" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_ed9b95919c672a13008e9487ee" ON "__chart__users" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_f091abb24193d50c653c6b77fc" ON "__chart__users" ("span", "date") `); - await queryRunner.query(`CREATE INDEX "IDX_337e9599f278bd7537fe30876f" ON "__chart__users" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_a770a57c70e668cc61590c9161" ON "__chart__users" ("span", "date", "group") `); - } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "IDX_a770a57c70e668cc61590c9161"`); - await queryRunner.query(`DROP INDEX "IDX_337e9599f278bd7537fe30876f"`); - await queryRunner.query(`DROP INDEX "IDX_f091abb24193d50c653c6b77fc"`); - await queryRunner.query(`DROP INDEX "IDX_ed9b95919c672a13008e9487ee"`); - await queryRunner.query(`DROP INDEX "IDX_7c184198ecf66a8d3ecb253ab3"`); - await queryRunner.query(`DROP INDEX "IDX_845254b3eaf708ae8a6cac3026"`); - await queryRunner.query(`DROP INDEX "IDX_f170de677ea75ad4533de2723e"`); - await queryRunner.query(`DROP INDEX "IDX_a319e5dbf47e8a17497623beae"`); - await queryRunner.query(`DROP INDEX "IDX_c5870993e25c3d5771f91f5003"`); - await queryRunner.query(`DROP INDEX "IDX_d41cce6aee1a50bfc062038f9b"`); - await queryRunner.query(`DROP INDEX "IDX_92255988735563f0fe4aba1f05"`); - await queryRunner.query(`DROP INDEX "IDX_b070a906db04b44c67c6c2144d"`); - await queryRunner.query(`DROP INDEX "IDX_66e1e1ecd2f29e57778af35b59"`); - await queryRunner.query(`DROP INDEX "IDX_a0cd75442dd10d0643a17c4a49"`); - await queryRunner.query(`DROP INDEX "IDX_d70c86baedc68326be11f9c0ce"`); - await queryRunner.query(`DROP INDEX "IDX_bbfa573a8181018851ed0b6357"`); - await queryRunner.query(`DROP INDEX "IDX_5c73bf61da4f6e6f15bae88ed1"`); - await queryRunner.query(`DROP INDEX "IDX_437bab3c6061d90f6bb65fd2cc"`); - await queryRunner.query(`DROP INDEX "IDX_84e661abb7bd1e51b690d4b017"`); - await queryRunner.query(`DROP INDEX "IDX_b14489029e4b3aaf4bba5fb524"`); - await queryRunner.query(`DROP INDEX "IDX_a5133470f4825902e170328ca5"`); - await queryRunner.query(`DROP INDEX "IDX_234dff3c0b56a6150b95431ab9"`); - await queryRunner.query(`DROP INDEX "IDX_2be7ec6cebddc14dc11e206686"`); - await queryRunner.query(`DROP INDEX "IDX_0c641990ecf47d2545df4edb75"`); - await queryRunner.query(`DROP INDEX "IDX_e316f01a6d24eb31db27f88262"`); - await queryRunner.query(`DROP INDEX "IDX_229a41ad465f9205f1f5703291"`); - await queryRunner.query(`DROP INDEX "IDX_edeb73c09c3143a81bcb34d569"`); - await queryRunner.query(`DROP INDEX "IDX_8cf3156fd7a6b15c43459c6e3b"`); - await queryRunner.query(`DROP INDEX "IDX_65633a106bce43fc7c5c30a5c7"`); - await queryRunner.query(`DROP INDEX "IDX_f7bf4c62059764c2c2bb40fdab"`); - await queryRunner.query(`DROP INDEX "IDX_f68a5ab958f9f5fa17a32ac23b"`); - await queryRunner.query(`DROP INDEX "IDX_5048e9daccbbbc6d567bb142d3"`); - await queryRunner.query(`DROP INDEX "IDX_046feeb12e9ef5f783f409866a"`); - await queryRunner.query(`DROP INDEX "IDX_55bf20f366979f2436de99206b"`); - await queryRunner.query(`DROP INDEX "IDX_8d2cbbc8114d90d19b44d626b6"`); - await queryRunner.query(`DROP INDEX "IDX_84234bd1abb873f07329681c83"`); - await queryRunner.query(`DROP INDEX "IDX_4db3b84c7be0d3464714f3e0b1"`); - await queryRunner.query(`DROP INDEX "IDX_b77d4dd9562c3a899d9a286fcd"`); - await queryRunner.query(`DROP INDEX "IDX_57b5458d0d3d6d1e7f13d4e57f"`); - await queryRunner.query(`DROP INDEX "IDX_4b3593098b6edc9c5afe36b18b"`); - await queryRunner.query(`DROP INDEX "IDX_f92dd6d03f8d994f29987f6214"`); - await queryRunner.query(`DROP INDEX "IDX_7af07790712aa3438ff6773f3b"`); - await queryRunner.query(`DROP INDEX "IDX_f2aeafde2ae6fbad38e857631b"`); - await queryRunner.query(`DROP INDEX "IDX_30bf67687f483ace115c5ca642"`); - await queryRunner.query(`DROP INDEX "IDX_42ea9381f0fda8dfe0fa1c8b53"`); - await queryRunner.query(`DROP INDEX "IDX_e496ca8096d28f6b9b509264dc"`); - await queryRunner.query(`DROP INDEX "IDX_328f259961e60c4fa0bfcf55ca"`); - await queryRunner.query(`DROP INDEX "IDX_5f86db6492274e07c1a3cdf286"`); - await queryRunner.query(`DROP INDEX "IDX_924fc196c80ca24bae01dd37e4"`); - await queryRunner.query(`DROP INDEX "IDX_f09d543e3acb16c5976bdb31fa"`); - await queryRunner.query(`DROP INDEX "IDX_0c9a159c5082cbeef3ca6706b5"`); - await queryRunner.query(`DROP INDEX "IDX_7036f2957151588b813185c794"`); - await queryRunner.query(`DROP INDEX "IDX_e69096589f11e3baa98ddd64d0"`); - await queryRunner.query(`DROP INDEX "IDX_42eb716a37d381cdf566192b2b"`); - await queryRunner.query(`DROP INDEX "IDX_9ff6944f01acb756fdc92d7563"`); - await queryRunner.query(`DROP INDEX "IDX_0a905b992fecd2b5c3fb98759e"`); - await queryRunner.query(`DROP INDEX "IDX_08fac0eb3b11f04c200c0b40dd"`); - await queryRunner.query(`DROP INDEX "IDX_7b5da130992ec9df96712d4290"`); - await queryRunner.query(`DROP INDEX "IDX_f8dd01baeded2ffa833e0a610a"`); - await queryRunner.query(`DROP INDEX "IDX_a1efd3e0048a5f2793a47360dc"`); - await queryRunner.query(`DROP INDEX "IDX_f5448d9633cff74208d850aabe"`); - await queryRunner.query(`DROP INDEX "IDX_39ee857ab2f23493037c6b6631"`); - await queryRunner.query(`DROP INDEX "IDX_d0a4f79af5a97b08f37b547197"`); - await queryRunner.query(`DROP INDEX "IDX_da8a46ba84ca1d8bb5a29bfb63"`); - await queryRunner.query(`DROP INDEX "IDX_c12f0af4a66cdd30c2287ce8aa"`); - await queryRunner.query(`DROP INDEX "IDX_6b8f34a1a64b06014b6fb66824"`); - await queryRunner.query(`DROP INDEX "IDX_6d6f156ceefc6bc5f273a0e370"`); - await queryRunner.query(`DROP INDEX "IDX_25a97c02003338124b2b75fdbc"`); - await queryRunner.query(`DROP INDEX "IDX_49975586f50ed7b800fdd88fbd"`); - await queryRunner.query(`DROP INDEX "IDX_99a7d2faaef84a6f728d714ad6"`); - await queryRunner.query(`DROP INDEX "IDX_fcc181fb8283009c61cc4083ef"`); - await queryRunner.query(`DROP INDEX "IDX_07747a1038c05f532a718fe1de"`); - await queryRunner.query(`DROP INDEX "IDX_e9cd07672b37d8966cf3709283"`); - await queryRunner.query(`DROP INDEX "IDX_dd907becf76104e4b656659e6b"`); - await queryRunner.query(`DROP INDEX "IDX_2d416e6af791a82e338c79d480"`); - await queryRunner.query(`DROP INDEX "IDX_76e87c7bfc5d925fcbba405d84"`); - await queryRunner.query(`DROP INDEX "IDX_e447064455928cf627590ef527"`); - await queryRunner.query(`DROP INDEX "IDX_36cb699c49580d4e6c2e6159f9"`); - await queryRunner.query(`DROP INDEX "IDX_06690fc959f1c9fdaf21928222"`); - await queryRunner.query(`DROP INDEX "IDX_3313d7288855ec105b5bbf6c21"`); - await queryRunner.query(`DROP INDEX "IDX_6e1df243476e20cbf86572ecc0"`); - await queryRunner.query(`DROP INDEX "IDX_7a170f67425e62a8fabb76c872"`); - await queryRunner.query(`DROP INDEX "IDX_3fa0d0f17ca72e3dc80999a032"`); - await queryRunner.query(`DROP INDEX "IDX_13565815f618a1ff53886c5b28"`); - await queryRunner.query(`DROP INDEX "IDX_c26e2c1cbb6e911e0554b27416"`); - await queryRunner.query(`DROP INDEX "IDX_9a3ed15a30ab7e3a37702e6e08"`); - await queryRunner.query(`DROP INDEX "IDX_20f57cc8f142c131340ee16742"`); - await queryRunner.query(`DROP INDEX "IDX_00ed5f86db1f7efafb1978bf21"`); - await queryRunner.query(`DROP INDEX "IDX_15e91a03aeeac9dbccdf43fc06"`); - await queryRunner.query(`DROP INDEX "IDX_0ad37b7ef50f4ddc84363d7ccc"`); - await queryRunner.query(`DROP INDEX "IDX_90148bbc2bf0854428786bfc15"`); - await queryRunner.query(`DROP INDEX "IDX_88937d94d7443d9a99a76fa5c0"`); - await queryRunner.query(`DROP INDEX "IDX_54ebcb6d27222913b908d56fd8"`); - await queryRunner.query(`DROP INDEX "IDX_796a8c03959361f97dc2be1d5c"`); - await queryRunner.query(`DROP INDEX "IDX_25dfc71b0369b003a4cd434d0b"`); - await queryRunner.query(`DROP INDEX "IDX_51c063b6a133a9cb87145450f5"`); - await queryRunner.query(`DROP INDEX "IDX_fa99d777623947a5b05f394cae"`); - await queryRunner.query(`DROP INDEX "IDX_315c779174fe8247ab324f036e"`); - await queryRunner.query(`DROP INDEX "IDX_c5d46cbfda48b1c33ed852e21b"`); - await queryRunner.query(`DROP INDEX "IDX_8cb40cfc8f3c28261e6f887b03"`); - } + async up(queryRunner) { + await queryRunner.query( + `CREATE INDEX "IDX_0ad37b7ef50f4ddc84363d7ccc" ON "__chart__active_users" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_15e91a03aeeac9dbccdf43fc06" ON "__chart__active_users" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_00ed5f86db1f7efafb1978bf21" ON "__chart__active_users" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_20f57cc8f142c131340ee16742" ON "__chart__active_users" ("span", "date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_9a3ed15a30ab7e3a37702e6e08" ON "__chart__active_users" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_c26e2c1cbb6e911e0554b27416" ON "__chart__active_users" ("span", "date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_13565815f618a1ff53886c5b28" ON "__chart__drive" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_3fa0d0f17ca72e3dc80999a032" ON "__chart__drive" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_7a170f67425e62a8fabb76c872" ON "__chart__drive" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_6e1df243476e20cbf86572ecc0" ON "__chart__drive" ("span", "date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_3313d7288855ec105b5bbf6c21" ON "__chart__drive" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_06690fc959f1c9fdaf21928222" ON "__chart__drive" ("span", "date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_36cb699c49580d4e6c2e6159f9" ON "__chart__federation" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_e447064455928cf627590ef527" ON "__chart__federation" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_76e87c7bfc5d925fcbba405d84" ON "__chart__federation" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_2d416e6af791a82e338c79d480" ON "__chart__federation" ("span", "date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_dd907becf76104e4b656659e6b" ON "__chart__federation" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_e9cd07672b37d8966cf3709283" ON "__chart__federation" ("span", "date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_07747a1038c05f532a718fe1de" ON "__chart__hashtag" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_fcc181fb8283009c61cc4083ef" ON "__chart__hashtag" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_99a7d2faaef84a6f728d714ad6" ON "__chart__hashtag" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_49975586f50ed7b800fdd88fbd" ON "__chart__hashtag" ("span", "date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_25a97c02003338124b2b75fdbc" ON "__chart__hashtag" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_6d6f156ceefc6bc5f273a0e370" ON "__chart__hashtag" ("span", "date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b8f34a1a64b06014b6fb66824" ON "__chart__instance" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_c12f0af4a66cdd30c2287ce8aa" ON "__chart__instance" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_da8a46ba84ca1d8bb5a29bfb63" ON "__chart__instance" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_d0a4f79af5a97b08f37b547197" ON "__chart__instance" ("span", "date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_39ee857ab2f23493037c6b6631" ON "__chart__instance" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f5448d9633cff74208d850aabe" ON "__chart__instance" ("span", "date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_a1efd3e0048a5f2793a47360dc" ON "__chart__network" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f8dd01baeded2ffa833e0a610a" ON "__chart__network" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_7b5da130992ec9df96712d4290" ON "__chart__network" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_08fac0eb3b11f04c200c0b40dd" ON "__chart__network" ("span", "date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0a905b992fecd2b5c3fb98759e" ON "__chart__network" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_9ff6944f01acb756fdc92d7563" ON "__chart__network" ("span", "date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_42eb716a37d381cdf566192b2b" ON "__chart__notes" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_e69096589f11e3baa98ddd64d0" ON "__chart__notes" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_7036f2957151588b813185c794" ON "__chart__notes" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0c9a159c5082cbeef3ca6706b5" ON "__chart__notes" ("span", "date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f09d543e3acb16c5976bdb31fa" ON "__chart__notes" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_924fc196c80ca24bae01dd37e4" ON "__chart__notes" ("span", "date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_5f86db6492274e07c1a3cdf286" ON "__chart__per_user_drive" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_328f259961e60c4fa0bfcf55ca" ON "__chart__per_user_drive" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_e496ca8096d28f6b9b509264dc" ON "__chart__per_user_drive" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_42ea9381f0fda8dfe0fa1c8b53" ON "__chart__per_user_drive" ("span", "date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_30bf67687f483ace115c5ca642" ON "__chart__per_user_drive" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f2aeafde2ae6fbad38e857631b" ON "__chart__per_user_drive" ("span", "date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_7af07790712aa3438ff6773f3b" ON "__chart__per_user_following" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f92dd6d03f8d994f29987f6214" ON "__chart__per_user_following" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_4b3593098b6edc9c5afe36b18b" ON "__chart__per_user_following" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_57b5458d0d3d6d1e7f13d4e57f" ON "__chart__per_user_following" ("span", "date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_b77d4dd9562c3a899d9a286fcd" ON "__chart__per_user_following" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_4db3b84c7be0d3464714f3e0b1" ON "__chart__per_user_following" ("span", "date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_84234bd1abb873f07329681c83" ON "__chart__per_user_notes" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_8d2cbbc8114d90d19b44d626b6" ON "__chart__per_user_notes" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_55bf20f366979f2436de99206b" ON "__chart__per_user_notes" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_046feeb12e9ef5f783f409866a" ON "__chart__per_user_notes" ("span", "date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_5048e9daccbbbc6d567bb142d3" ON "__chart__per_user_notes" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f68a5ab958f9f5fa17a32ac23b" ON "__chart__per_user_notes" ("span", "date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f7bf4c62059764c2c2bb40fdab" ON "__chart__per_user_reaction" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_65633a106bce43fc7c5c30a5c7" ON "__chart__per_user_reaction" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_8cf3156fd7a6b15c43459c6e3b" ON "__chart__per_user_reaction" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_edeb73c09c3143a81bcb34d569" ON "__chart__per_user_reaction" ("span", "date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_229a41ad465f9205f1f5703291" ON "__chart__per_user_reaction" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_e316f01a6d24eb31db27f88262" ON "__chart__per_user_reaction" ("span", "date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0c641990ecf47d2545df4edb75" ON "__chart__test_grouped" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_2be7ec6cebddc14dc11e206686" ON "__chart__test_grouped" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_234dff3c0b56a6150b95431ab9" ON "__chart__test_grouped" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_a5133470f4825902e170328ca5" ON "__chart__test_grouped" ("span", "date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_b14489029e4b3aaf4bba5fb524" ON "__chart__test_grouped" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_84e661abb7bd1e51b690d4b017" ON "__chart__test_grouped" ("span", "date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_437bab3c6061d90f6bb65fd2cc" ON "__chart__test_unique" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_5c73bf61da4f6e6f15bae88ed1" ON "__chart__test_unique" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_bbfa573a8181018851ed0b6357" ON "__chart__test_unique" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_d70c86baedc68326be11f9c0ce" ON "__chart__test_unique" ("span", "date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_a0cd75442dd10d0643a17c4a49" ON "__chart__test_unique" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_66e1e1ecd2f29e57778af35b59" ON "__chart__test_unique" ("span", "date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_b070a906db04b44c67c6c2144d" ON "__chart__test" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_92255988735563f0fe4aba1f05" ON "__chart__test" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_d41cce6aee1a50bfc062038f9b" ON "__chart__test" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_c5870993e25c3d5771f91f5003" ON "__chart__test" ("span", "date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_a319e5dbf47e8a17497623beae" ON "__chart__test" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f170de677ea75ad4533de2723e" ON "__chart__test" ("span", "date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_845254b3eaf708ae8a6cac3026" ON "__chart__users" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_7c184198ecf66a8d3ecb253ab3" ON "__chart__users" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_ed9b95919c672a13008e9487ee" ON "__chart__users" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f091abb24193d50c653c6b77fc" ON "__chart__users" ("span", "date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_337e9599f278bd7537fe30876f" ON "__chart__users" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_a770a57c70e668cc61590c9161" ON "__chart__users" ("span", "date", "group") `, + ); + } + async down(queryRunner) { + await queryRunner.query(`DROP INDEX "IDX_a770a57c70e668cc61590c9161"`); + await queryRunner.query(`DROP INDEX "IDX_337e9599f278bd7537fe30876f"`); + await queryRunner.query(`DROP INDEX "IDX_f091abb24193d50c653c6b77fc"`); + await queryRunner.query(`DROP INDEX "IDX_ed9b95919c672a13008e9487ee"`); + await queryRunner.query(`DROP INDEX "IDX_7c184198ecf66a8d3ecb253ab3"`); + await queryRunner.query(`DROP INDEX "IDX_845254b3eaf708ae8a6cac3026"`); + await queryRunner.query(`DROP INDEX "IDX_f170de677ea75ad4533de2723e"`); + await queryRunner.query(`DROP INDEX "IDX_a319e5dbf47e8a17497623beae"`); + await queryRunner.query(`DROP INDEX "IDX_c5870993e25c3d5771f91f5003"`); + await queryRunner.query(`DROP INDEX "IDX_d41cce6aee1a50bfc062038f9b"`); + await queryRunner.query(`DROP INDEX "IDX_92255988735563f0fe4aba1f05"`); + await queryRunner.query(`DROP INDEX "IDX_b070a906db04b44c67c6c2144d"`); + await queryRunner.query(`DROP INDEX "IDX_66e1e1ecd2f29e57778af35b59"`); + await queryRunner.query(`DROP INDEX "IDX_a0cd75442dd10d0643a17c4a49"`); + await queryRunner.query(`DROP INDEX "IDX_d70c86baedc68326be11f9c0ce"`); + await queryRunner.query(`DROP INDEX "IDX_bbfa573a8181018851ed0b6357"`); + await queryRunner.query(`DROP INDEX "IDX_5c73bf61da4f6e6f15bae88ed1"`); + await queryRunner.query(`DROP INDEX "IDX_437bab3c6061d90f6bb65fd2cc"`); + await queryRunner.query(`DROP INDEX "IDX_84e661abb7bd1e51b690d4b017"`); + await queryRunner.query(`DROP INDEX "IDX_b14489029e4b3aaf4bba5fb524"`); + await queryRunner.query(`DROP INDEX "IDX_a5133470f4825902e170328ca5"`); + await queryRunner.query(`DROP INDEX "IDX_234dff3c0b56a6150b95431ab9"`); + await queryRunner.query(`DROP INDEX "IDX_2be7ec6cebddc14dc11e206686"`); + await queryRunner.query(`DROP INDEX "IDX_0c641990ecf47d2545df4edb75"`); + await queryRunner.query(`DROP INDEX "IDX_e316f01a6d24eb31db27f88262"`); + await queryRunner.query(`DROP INDEX "IDX_229a41ad465f9205f1f5703291"`); + await queryRunner.query(`DROP INDEX "IDX_edeb73c09c3143a81bcb34d569"`); + await queryRunner.query(`DROP INDEX "IDX_8cf3156fd7a6b15c43459c6e3b"`); + await queryRunner.query(`DROP INDEX "IDX_65633a106bce43fc7c5c30a5c7"`); + await queryRunner.query(`DROP INDEX "IDX_f7bf4c62059764c2c2bb40fdab"`); + await queryRunner.query(`DROP INDEX "IDX_f68a5ab958f9f5fa17a32ac23b"`); + await queryRunner.query(`DROP INDEX "IDX_5048e9daccbbbc6d567bb142d3"`); + await queryRunner.query(`DROP INDEX "IDX_046feeb12e9ef5f783f409866a"`); + await queryRunner.query(`DROP INDEX "IDX_55bf20f366979f2436de99206b"`); + await queryRunner.query(`DROP INDEX "IDX_8d2cbbc8114d90d19b44d626b6"`); + await queryRunner.query(`DROP INDEX "IDX_84234bd1abb873f07329681c83"`); + await queryRunner.query(`DROP INDEX "IDX_4db3b84c7be0d3464714f3e0b1"`); + await queryRunner.query(`DROP INDEX "IDX_b77d4dd9562c3a899d9a286fcd"`); + await queryRunner.query(`DROP INDEX "IDX_57b5458d0d3d6d1e7f13d4e57f"`); + await queryRunner.query(`DROP INDEX "IDX_4b3593098b6edc9c5afe36b18b"`); + await queryRunner.query(`DROP INDEX "IDX_f92dd6d03f8d994f29987f6214"`); + await queryRunner.query(`DROP INDEX "IDX_7af07790712aa3438ff6773f3b"`); + await queryRunner.query(`DROP INDEX "IDX_f2aeafde2ae6fbad38e857631b"`); + await queryRunner.query(`DROP INDEX "IDX_30bf67687f483ace115c5ca642"`); + await queryRunner.query(`DROP INDEX "IDX_42ea9381f0fda8dfe0fa1c8b53"`); + await queryRunner.query(`DROP INDEX "IDX_e496ca8096d28f6b9b509264dc"`); + await queryRunner.query(`DROP INDEX "IDX_328f259961e60c4fa0bfcf55ca"`); + await queryRunner.query(`DROP INDEX "IDX_5f86db6492274e07c1a3cdf286"`); + await queryRunner.query(`DROP INDEX "IDX_924fc196c80ca24bae01dd37e4"`); + await queryRunner.query(`DROP INDEX "IDX_f09d543e3acb16c5976bdb31fa"`); + await queryRunner.query(`DROP INDEX "IDX_0c9a159c5082cbeef3ca6706b5"`); + await queryRunner.query(`DROP INDEX "IDX_7036f2957151588b813185c794"`); + await queryRunner.query(`DROP INDEX "IDX_e69096589f11e3baa98ddd64d0"`); + await queryRunner.query(`DROP INDEX "IDX_42eb716a37d381cdf566192b2b"`); + await queryRunner.query(`DROP INDEX "IDX_9ff6944f01acb756fdc92d7563"`); + await queryRunner.query(`DROP INDEX "IDX_0a905b992fecd2b5c3fb98759e"`); + await queryRunner.query(`DROP INDEX "IDX_08fac0eb3b11f04c200c0b40dd"`); + await queryRunner.query(`DROP INDEX "IDX_7b5da130992ec9df96712d4290"`); + await queryRunner.query(`DROP INDEX "IDX_f8dd01baeded2ffa833e0a610a"`); + await queryRunner.query(`DROP INDEX "IDX_a1efd3e0048a5f2793a47360dc"`); + await queryRunner.query(`DROP INDEX "IDX_f5448d9633cff74208d850aabe"`); + await queryRunner.query(`DROP INDEX "IDX_39ee857ab2f23493037c6b6631"`); + await queryRunner.query(`DROP INDEX "IDX_d0a4f79af5a97b08f37b547197"`); + await queryRunner.query(`DROP INDEX "IDX_da8a46ba84ca1d8bb5a29bfb63"`); + await queryRunner.query(`DROP INDEX "IDX_c12f0af4a66cdd30c2287ce8aa"`); + await queryRunner.query(`DROP INDEX "IDX_6b8f34a1a64b06014b6fb66824"`); + await queryRunner.query(`DROP INDEX "IDX_6d6f156ceefc6bc5f273a0e370"`); + await queryRunner.query(`DROP INDEX "IDX_25a97c02003338124b2b75fdbc"`); + await queryRunner.query(`DROP INDEX "IDX_49975586f50ed7b800fdd88fbd"`); + await queryRunner.query(`DROP INDEX "IDX_99a7d2faaef84a6f728d714ad6"`); + await queryRunner.query(`DROP INDEX "IDX_fcc181fb8283009c61cc4083ef"`); + await queryRunner.query(`DROP INDEX "IDX_07747a1038c05f532a718fe1de"`); + await queryRunner.query(`DROP INDEX "IDX_e9cd07672b37d8966cf3709283"`); + await queryRunner.query(`DROP INDEX "IDX_dd907becf76104e4b656659e6b"`); + await queryRunner.query(`DROP INDEX "IDX_2d416e6af791a82e338c79d480"`); + await queryRunner.query(`DROP INDEX "IDX_76e87c7bfc5d925fcbba405d84"`); + await queryRunner.query(`DROP INDEX "IDX_e447064455928cf627590ef527"`); + await queryRunner.query(`DROP INDEX "IDX_36cb699c49580d4e6c2e6159f9"`); + await queryRunner.query(`DROP INDEX "IDX_06690fc959f1c9fdaf21928222"`); + await queryRunner.query(`DROP INDEX "IDX_3313d7288855ec105b5bbf6c21"`); + await queryRunner.query(`DROP INDEX "IDX_6e1df243476e20cbf86572ecc0"`); + await queryRunner.query(`DROP INDEX "IDX_7a170f67425e62a8fabb76c872"`); + await queryRunner.query(`DROP INDEX "IDX_3fa0d0f17ca72e3dc80999a032"`); + await queryRunner.query(`DROP INDEX "IDX_13565815f618a1ff53886c5b28"`); + await queryRunner.query(`DROP INDEX "IDX_c26e2c1cbb6e911e0554b27416"`); + await queryRunner.query(`DROP INDEX "IDX_9a3ed15a30ab7e3a37702e6e08"`); + await queryRunner.query(`DROP INDEX "IDX_20f57cc8f142c131340ee16742"`); + await queryRunner.query(`DROP INDEX "IDX_00ed5f86db1f7efafb1978bf21"`); + await queryRunner.query(`DROP INDEX "IDX_15e91a03aeeac9dbccdf43fc06"`); + await queryRunner.query(`DROP INDEX "IDX_0ad37b7ef50f4ddc84363d7ccc"`); + await queryRunner.query(`DROP INDEX "IDX_90148bbc2bf0854428786bfc15"`); + await queryRunner.query(`DROP INDEX "IDX_88937d94d7443d9a99a76fa5c0"`); + await queryRunner.query(`DROP INDEX "IDX_54ebcb6d27222913b908d56fd8"`); + await queryRunner.query(`DROP INDEX "IDX_796a8c03959361f97dc2be1d5c"`); + await queryRunner.query(`DROP INDEX "IDX_25dfc71b0369b003a4cd434d0b"`); + await queryRunner.query(`DROP INDEX "IDX_51c063b6a133a9cb87145450f5"`); + await queryRunner.query(`DROP INDEX "IDX_fa99d777623947a5b05f394cae"`); + await queryRunner.query(`DROP INDEX "IDX_315c779174fe8247ab324f036e"`); + await queryRunner.query(`DROP INDEX "IDX_c5d46cbfda48b1c33ed852e21b"`); + await queryRunner.query(`DROP INDEX "IDX_8cb40cfc8f3c28261e6f887b03"`); + } } diff --git a/packages/backend/migration/1562422242907-PasswordLessLogin.js b/packages/backend/migration/1562422242907-PasswordLessLogin.js index b73c7db4d..8e1280830 100644 --- a/packages/backend/migration/1562422242907-PasswordLessLogin.js +++ b/packages/backend/migration/1562422242907-PasswordLessLogin.js @@ -1,10 +1,12 @@ - - export class PasswordLessLogin1562422242907 { - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" ADD COLUMN "usePasswordLessLogin" boolean DEFAULT false NOT NULL`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "usePasswordLessLogin"`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" ADD COLUMN "usePasswordLessLogin" boolean DEFAULT false NOT NULL`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "usePasswordLessLogin"`, + ); + } } diff --git a/packages/backend/migration/1562444565093-PinnedPage.js b/packages/backend/migration/1562444565093-PinnedPage.js index 9a999a915..dcb342d3f 100644 --- a/packages/backend/migration/1562444565093-PinnedPage.js +++ b/packages/backend/migration/1562444565093-PinnedPage.js @@ -1,14 +1,24 @@ - - export class PinnedPage1562444565093 { - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" ADD "pinnedPageId" character varying(32)`); - await queryRunner.query(`ALTER TABLE "user_profile" ADD CONSTRAINT "UQ_6dc44f1ceb65b1e72bacef2ca27" UNIQUE ("pinnedPageId")`); - await queryRunner.query(`ALTER TABLE "user_profile" ADD CONSTRAINT "FK_6dc44f1ceb65b1e72bacef2ca27" FOREIGN KEY ("pinnedPageId") REFERENCES "page"("id") ON DELETE SET NULL ON UPDATE NO ACTION`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" DROP CONSTRAINT "FK_6dc44f1ceb65b1e72bacef2ca27"`); - await queryRunner.query(`ALTER TABLE "user_profile" DROP CONSTRAINT "UQ_6dc44f1ceb65b1e72bacef2ca27"`); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "pinnedPageId"`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "pinnedPageId" character varying(32)`, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD CONSTRAINT "UQ_6dc44f1ceb65b1e72bacef2ca27" UNIQUE ("pinnedPageId")`, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD CONSTRAINT "FK_6dc44f1ceb65b1e72bacef2ca27" FOREIGN KEY ("pinnedPageId") REFERENCES "page"("id") ON DELETE SET NULL ON UPDATE NO ACTION`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" DROP CONSTRAINT "FK_6dc44f1ceb65b1e72bacef2ca27"`, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP CONSTRAINT "UQ_6dc44f1ceb65b1e72bacef2ca27"`, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "pinnedPageId"`, + ); + } } diff --git a/packages/backend/migration/1562448332510-PageTitleHideOption.js b/packages/backend/migration/1562448332510-PageTitleHideOption.js index 8fc78d202..9a1b42f4b 100644 --- a/packages/backend/migration/1562448332510-PageTitleHideOption.js +++ b/packages/backend/migration/1562448332510-PageTitleHideOption.js @@ -1,10 +1,12 @@ - - export class PageTitleHideOption1562448332510 { - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "page" ADD "hideTitleWhenPinned" boolean NOT NULL DEFAULT false`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "page" DROP COLUMN "hideTitleWhenPinned"`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "page" ADD "hideTitleWhenPinned" boolean NOT NULL DEFAULT false`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "page" DROP COLUMN "hideTitleWhenPinned"`, + ); + } } diff --git a/packages/backend/migration/1562869971568-ModerationLog.js b/packages/backend/migration/1562869971568-ModerationLog.js index dd66d16ee..f652b067b 100644 --- a/packages/backend/migration/1562869971568-ModerationLog.js +++ b/packages/backend/migration/1562869971568-ModerationLog.js @@ -1,14 +1,20 @@ - - export class ModerationLog1562869971568 { - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "moderation_log" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "type" character varying(128) NOT NULL, "info" jsonb NOT NULL, CONSTRAINT "PK_d0adca6ecfd068db83e4526cc26" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_a08ad074601d204e0f69da9a95" ON "moderation_log" ("userId") `); - await queryRunner.query(`ALTER TABLE "moderation_log" ADD CONSTRAINT "FK_a08ad074601d204e0f69da9a954" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "moderation_log" DROP CONSTRAINT "FK_a08ad074601d204e0f69da9a954"`); - await queryRunner.query(`DROP INDEX "IDX_a08ad074601d204e0f69da9a95"`); - await queryRunner.query(`DROP TABLE "moderation_log"`); - } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "moderation_log" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "type" character varying(128) NOT NULL, "info" jsonb NOT NULL, CONSTRAINT "PK_d0adca6ecfd068db83e4526cc26" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_a08ad074601d204e0f69da9a95" ON "moderation_log" ("userId") `, + ); + await queryRunner.query( + `ALTER TABLE "moderation_log" ADD CONSTRAINT "FK_a08ad074601d204e0f69da9a954" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "moderation_log" DROP CONSTRAINT "FK_a08ad074601d204e0f69da9a954"`, + ); + await queryRunner.query(`DROP INDEX "IDX_a08ad074601d204e0f69da9a95"`); + await queryRunner.query(`DROP TABLE "moderation_log"`); + } } diff --git a/packages/backend/migration/1563757595828-UsedUsername.js b/packages/backend/migration/1563757595828-UsedUsername.js index 8972df297..2cf5d8c74 100644 --- a/packages/backend/migration/1563757595828-UsedUsername.js +++ b/packages/backend/migration/1563757595828-UsedUsername.js @@ -1,10 +1,10 @@ - - export class UsedUsername1563757595828 { - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "used_username" ("username" character varying(128) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_78fd79d2d24c6ac2f4cc9a31a5d" PRIMARY KEY ("username"))`); - } - async down(queryRunner) { - await queryRunner.query(`DROP TABLE "used_username"`); - } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "used_username" ("username" character varying(128) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_78fd79d2d24c6ac2f4cc9a31a5d" PRIMARY KEY ("username"))`, + ); + } + async down(queryRunner) { + await queryRunner.query(`DROP TABLE "used_username"`); + } } diff --git a/packages/backend/migration/1565634203341-room.js b/packages/backend/migration/1565634203341-room.js index 679940f24..1023c0a31 100644 --- a/packages/backend/migration/1565634203341-room.js +++ b/packages/backend/migration/1565634203341-room.js @@ -1,10 +1,10 @@ - - export class room1565634203341 { - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" ADD "room" jsonb NOT NULL DEFAULT '{}'`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "room"`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "room" jsonb NOT NULL DEFAULT '{}'`, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "room"`); + } } diff --git a/packages/backend/migration/1571220798684-CustomEmojiCategory.js b/packages/backend/migration/1571220798684-CustomEmojiCategory.js index 37c07366e..4d7531332 100644 --- a/packages/backend/migration/1571220798684-CustomEmojiCategory.js +++ b/packages/backend/migration/1571220798684-CustomEmojiCategory.js @@ -1,10 +1,14 @@ - - export class CustomEmojiCategory1571220798684 { - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "emoji" ADD "category" character varying(128)`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "emoji" DROP COLUMN "category"`, undefined); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "emoji" ADD "category" character varying(128)`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "emoji" DROP COLUMN "category"`, + undefined, + ); + } } diff --git a/packages/backend/migration/1572760203493-nodeinfo.js b/packages/backend/migration/1572760203493-nodeinfo.js index 54d5f914a..eea87c82c 100644 --- a/packages/backend/migration/1572760203493-nodeinfo.js +++ b/packages/backend/migration/1572760203493-nodeinfo.js @@ -1,26 +1,78 @@ - - export class nodeinfo1572760203493 { - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "system"`, undefined); - await queryRunner.query(`ALTER TABLE "instance" ADD "softwareName" character varying(64) DEFAULT null`, undefined); - await queryRunner.query(`ALTER TABLE "instance" ADD "softwareVersion" character varying(64) DEFAULT null`, undefined); - await queryRunner.query(`ALTER TABLE "instance" ADD "openRegistrations" boolean DEFAULT null`, undefined); - await queryRunner.query(`ALTER TABLE "instance" ADD "name" character varying(256) DEFAULT null`, undefined); - await queryRunner.query(`ALTER TABLE "instance" ADD "description" character varying(4096) DEFAULT null`, undefined); - await queryRunner.query(`ALTER TABLE "instance" ADD "maintainerName" character varying(128) DEFAULT null`, undefined); - await queryRunner.query(`ALTER TABLE "instance" ADD "maintainerEmail" character varying(256) DEFAULT null`, undefined); - await queryRunner.query(`ALTER TABLE "instance" ADD "infoUpdatedAt" TIMESTAMP WITH TIME ZONE`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "infoUpdatedAt"`, undefined); - await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "maintainerEmail"`, undefined); - await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "maintainerName"`, undefined); - await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "description"`, undefined); - await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "name"`, undefined); - await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "openRegistrations"`, undefined); - await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "softwareVersion"`, undefined); - await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "softwareName"`, undefined); - await queryRunner.query(`ALTER TABLE "instance" ADD "system" character varying(64)`, undefined); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "instance" DROP COLUMN "system"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "instance" ADD "softwareName" character varying(64) DEFAULT null`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "instance" ADD "softwareVersion" character varying(64) DEFAULT null`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "instance" ADD "openRegistrations" boolean DEFAULT null`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "instance" ADD "name" character varying(256) DEFAULT null`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "instance" ADD "description" character varying(4096) DEFAULT null`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "instance" ADD "maintainerName" character varying(128) DEFAULT null`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "instance" ADD "maintainerEmail" character varying(256) DEFAULT null`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "instance" ADD "infoUpdatedAt" TIMESTAMP WITH TIME ZONE`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "instance" DROP COLUMN "infoUpdatedAt"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "instance" DROP COLUMN "maintainerEmail"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "instance" DROP COLUMN "maintainerName"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "instance" DROP COLUMN "description"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "instance" DROP COLUMN "name"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "instance" DROP COLUMN "openRegistrations"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "instance" DROP COLUMN "softwareVersion"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "instance" DROP COLUMN "softwareName"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "instance" ADD "system" character varying(64)`, + undefined, + ); + } } diff --git a/packages/backend/migration/1576269851876-TalkFederationId.js b/packages/backend/migration/1576269851876-TalkFederationId.js index 35861d571..f0aed7dd8 100644 --- a/packages/backend/migration/1576269851876-TalkFederationId.js +++ b/packages/backend/migration/1576269851876-TalkFederationId.js @@ -1,13 +1,17 @@ - - export class TalkFederationId1576269851876 { - constructor() { - this.name = 'TalkFederationId1576269851876'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "messaging_message" ADD "uri" character varying(512)`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "messaging_message" DROP COLUMN "uri"`, undefined); - } + constructor() { + this.name = "TalkFederationId1576269851876"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "messaging_message" ADD "uri" character varying(512)`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "messaging_message" DROP COLUMN "uri"`, + undefined, + ); + } } diff --git a/packages/backend/migration/1576869585998-ProxyRemoteFiles.js b/packages/backend/migration/1576869585998-ProxyRemoteFiles.js index d6d134be4..5565f64b6 100644 --- a/packages/backend/migration/1576869585998-ProxyRemoteFiles.js +++ b/packages/backend/migration/1576869585998-ProxyRemoteFiles.js @@ -1,13 +1,17 @@ - - export class ProxyRemoteFiles1576869585998 { - constructor() { - this.name = 'ProxyRemoteFiles1576869585998'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "proxyRemoteFiles" boolean NOT NULL DEFAULT false`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "proxyRemoteFiles"`, undefined); - } + constructor() { + this.name = "ProxyRemoteFiles1576869585998"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "proxyRemoteFiles" boolean NOT NULL DEFAULT false`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "proxyRemoteFiles"`, + undefined, + ); + } } diff --git a/packages/backend/migration/1579267006611-v12.js b/packages/backend/migration/1579267006611-v12.js index 7f6318a19..f1d906465 100644 --- a/packages/backend/migration/1579267006611-v12.js +++ b/packages/backend/migration/1579267006611-v12.js @@ -1,33 +1,91 @@ - - export class v121579267006611 { - constructor() { - this.name = 'v121579267006611'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "announcement" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "text" character varying(8192) NOT NULL, "title" character varying(256) NOT NULL, "imageUrl" character varying(1024), CONSTRAINT "PK_e0ef0550174fd1099a308fd18a0" PRIMARY KEY ("id"))`, undefined); - await queryRunner.query(`CREATE INDEX "IDX_118ec703e596086fc4515acb39" ON "announcement" ("createdAt") `, undefined); - await queryRunner.query(`CREATE TABLE "announcement_read" ("id" character varying(32) NOT NULL, "userId" character varying(32) NOT NULL, "announcementId" character varying(32) NOT NULL, CONSTRAINT "PK_4b90ad1f42681d97b2683890c5e" PRIMARY KEY ("id"))`, undefined); - await queryRunner.query(`CREATE INDEX "IDX_8288151386172b8109f7239ab2" ON "announcement_read" ("userId") `, undefined); - await queryRunner.query(`CREATE INDEX "IDX_603a7b1e7aa0533c6c88e9bfaf" ON "announcement_read" ("announcementId") `, undefined); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_924fa71815cfa3941d003702a0" ON "announcement_read" ("userId", "announcementId") `, undefined); - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "isVerified"`, undefined); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "announcements"`, undefined); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "enableEmojiReaction"`, undefined); - await queryRunner.query(`ALTER TABLE "announcement_read" ADD CONSTRAINT "FK_8288151386172b8109f7239ab28" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - await queryRunner.query(`ALTER TABLE "announcement_read" ADD CONSTRAINT "FK_603a7b1e7aa0533c6c88e9bfafe" FOREIGN KEY ("announcementId") REFERENCES "announcement"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "announcement_read" DROP CONSTRAINT "FK_603a7b1e7aa0533c6c88e9bfafe"`, undefined); - await queryRunner.query(`ALTER TABLE "announcement_read" DROP CONSTRAINT "FK_8288151386172b8109f7239ab28"`, undefined); - await queryRunner.query(`ALTER TABLE "meta" ADD "enableEmojiReaction" boolean NOT NULL DEFAULT true`, undefined); - await queryRunner.query(`ALTER TABLE "meta" ADD "announcements" jsonb NOT NULL DEFAULT '[]'`, undefined); - await queryRunner.query(`ALTER TABLE "user" ADD "isVerified" boolean NOT NULL DEFAULT false`, undefined); - await queryRunner.query(`DROP INDEX "IDX_924fa71815cfa3941d003702a0"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_603a7b1e7aa0533c6c88e9bfaf"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_8288151386172b8109f7239ab2"`, undefined); - await queryRunner.query(`DROP TABLE "announcement_read"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_118ec703e596086fc4515acb39"`, undefined); - await queryRunner.query(`DROP TABLE "announcement"`, undefined); - } + constructor() { + this.name = "v121579267006611"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "announcement" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "text" character varying(8192) NOT NULL, "title" character varying(256) NOT NULL, "imageUrl" character varying(1024), CONSTRAINT "PK_e0ef0550174fd1099a308fd18a0" PRIMARY KEY ("id"))`, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_118ec703e596086fc4515acb39" ON "announcement" ("createdAt") `, + undefined, + ); + await queryRunner.query( + `CREATE TABLE "announcement_read" ("id" character varying(32) NOT NULL, "userId" character varying(32) NOT NULL, "announcementId" character varying(32) NOT NULL, CONSTRAINT "PK_4b90ad1f42681d97b2683890c5e" PRIMARY KEY ("id"))`, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_8288151386172b8109f7239ab2" ON "announcement_read" ("userId") `, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_603a7b1e7aa0533c6c88e9bfaf" ON "announcement_read" ("announcementId") `, + undefined, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_924fa71815cfa3941d003702a0" ON "announcement_read" ("userId", "announcementId") `, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user" DROP COLUMN "isVerified"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "announcements"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "enableEmojiReaction"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "announcement_read" ADD CONSTRAINT "FK_8288151386172b8109f7239ab28" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "announcement_read" ADD CONSTRAINT "FK_603a7b1e7aa0533c6c88e9bfafe" FOREIGN KEY ("announcementId") REFERENCES "announcement"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "announcement_read" DROP CONSTRAINT "FK_603a7b1e7aa0533c6c88e9bfafe"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "announcement_read" DROP CONSTRAINT "FK_8288151386172b8109f7239ab28"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "enableEmojiReaction" boolean NOT NULL DEFAULT true`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "announcements" jsonb NOT NULL DEFAULT '[]'`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user" ADD "isVerified" boolean NOT NULL DEFAULT false`, + undefined, + ); + await queryRunner.query( + `DROP INDEX "IDX_924fa71815cfa3941d003702a0"`, + undefined, + ); + await queryRunner.query( + `DROP INDEX "IDX_603a7b1e7aa0533c6c88e9bfaf"`, + undefined, + ); + await queryRunner.query( + `DROP INDEX "IDX_8288151386172b8109f7239ab2"`, + undefined, + ); + await queryRunner.query(`DROP TABLE "announcement_read"`, undefined); + await queryRunner.query( + `DROP INDEX "IDX_118ec703e596086fc4515acb39"`, + undefined, + ); + await queryRunner.query(`DROP TABLE "announcement"`, undefined); + } } diff --git a/packages/backend/migration/1579270193251-v12-2.js b/packages/backend/migration/1579270193251-v12-2.js index c51ce6306..6bbcdcc15 100644 --- a/packages/backend/migration/1579270193251-v12-2.js +++ b/packages/backend/migration/1579270193251-v12-2.js @@ -1,13 +1,17 @@ - - export class v1221579270193251 { - constructor() { - this.name = 'v1221579270193251'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "announcement_read" ADD "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "announcement_read" DROP COLUMN "createdAt"`, undefined); - } + constructor() { + this.name = "v1221579270193251"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "announcement_read" ADD "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "announcement_read" DROP COLUMN "createdAt"`, + undefined, + ); + } } diff --git a/packages/backend/migration/1579282808087-v12-3.js b/packages/backend/migration/1579282808087-v12-3.js index aeb4f5a87..d5a9a86b5 100644 --- a/packages/backend/migration/1579282808087-v12-3.js +++ b/packages/backend/migration/1579282808087-v12-3.js @@ -1,13 +1,17 @@ - - export class v1231579282808087 { - constructor() { - this.name = 'v1231579282808087'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "announcement" ADD "updatedAt" TIMESTAMP WITH TIME ZONE`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "announcement" DROP COLUMN "updatedAt"`, undefined); - } + constructor() { + this.name = "v1231579282808087"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "announcement" ADD "updatedAt" TIMESTAMP WITH TIME ZONE`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "announcement" DROP COLUMN "updatedAt"`, + undefined, + ); + } } diff --git a/packages/backend/migration/1579544426412-v12-4.js b/packages/backend/migration/1579544426412-v12-4.js index f1e093413..efd6ee61b 100644 --- a/packages/backend/migration/1579544426412-v12-4.js +++ b/packages/backend/migration/1579544426412-v12-4.js @@ -1,15 +1,25 @@ - - export class v1241579544426412 { - constructor() { - this.name = 'v1241579544426412'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "notification" ADD "followRequestId" character varying(32)`, undefined); - await queryRunner.query(`ALTER TABLE "notification" ADD CONSTRAINT "FK_bd7fab507621e635b32cd31892c" FOREIGN KEY ("followRequestId") REFERENCES "follow_request"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "notification" DROP CONSTRAINT "FK_bd7fab507621e635b32cd31892c"`, undefined); - await queryRunner.query(`ALTER TABLE "notification" DROP COLUMN "followRequestId"`, undefined); - } + constructor() { + this.name = "v1241579544426412"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "notification" ADD "followRequestId" character varying(32)`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" ADD CONSTRAINT "FK_bd7fab507621e635b32cd31892c" FOREIGN KEY ("followRequestId") REFERENCES "follow_request"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "notification" DROP CONSTRAINT "FK_bd7fab507621e635b32cd31892c"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" DROP COLUMN "followRequestId"`, + undefined, + ); + } } diff --git a/packages/backend/migration/1579977526288-v12-5.js b/packages/backend/migration/1579977526288-v12-5.js index 6d2b5c584..f71c28755 100644 --- a/packages/backend/migration/1579977526288-v12-5.js +++ b/packages/backend/migration/1579977526288-v12-5.js @@ -1,53 +1,156 @@ - - export class v1251579977526288 { - constructor() { - this.name = 'v1251579977526288'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "clip" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "name" character varying(128) NOT NULL, "isPublic" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_f0685dac8d4dd056d7255670b75" PRIMARY KEY ("id"))`, undefined); - await queryRunner.query(`CREATE INDEX "IDX_2b5ec6c574d6802c94c80313fb" ON "clip" ("userId") `, undefined); - await queryRunner.query(`CREATE TABLE "clip_note" ("id" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, "clipId" character varying(32) NOT NULL, CONSTRAINT "PK_e94cda2f40a99b57e032a1a738b" PRIMARY KEY ("id"))`, undefined); - await queryRunner.query(`CREATE INDEX "IDX_a012eaf5c87c65da1deb5fdbfa" ON "clip_note" ("noteId") `, undefined); - await queryRunner.query(`CREATE INDEX "IDX_ebe99317bbbe9968a0c6f579ad" ON "clip_note" ("clipId") `, undefined); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_6fc0ec357d55a18646262fdfff" ON "clip_note" ("noteId", "clipId") `, undefined); - await queryRunner.query(`CREATE TYPE "antenna_src_enum" AS ENUM('home', 'all', 'list')`, undefined); - await queryRunner.query(`CREATE TABLE "antenna" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "name" character varying(128) NOT NULL, "src" "antenna_src_enum" NOT NULL, "userListId" character varying(32), "keywords" jsonb NOT NULL DEFAULT '[]', "withFile" boolean NOT NULL, "expression" character varying(2048), "notify" boolean NOT NULL, "hasNewNote" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_c170b99775e1dccca947c9f2d5f" PRIMARY KEY ("id"))`, undefined); - await queryRunner.query(`CREATE INDEX "IDX_6446c571a0e8d0f05f01c78909" ON "antenna" ("userId") `, undefined); - await queryRunner.query(`CREATE TABLE "antenna_note" ("id" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, "antennaId" character varying(32) NOT NULL, CONSTRAINT "PK_fb28d94d0989a3872df19fd6ef8" PRIMARY KEY ("id"))`, undefined); - await queryRunner.query(`CREATE INDEX "IDX_bd0397be22147e17210940e125" ON "antenna_note" ("noteId") `, undefined); - await queryRunner.query(`CREATE INDEX "IDX_0d775946662d2575dfd2068a5f" ON "antenna_note" ("antennaId") `, undefined); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_335a0bf3f904406f9ef3dd51c2" ON "antenna_note" ("noteId", "antennaId") `, undefined); - await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "geo"`, undefined); - await queryRunner.query(`ALTER TABLE "clip" ADD CONSTRAINT "FK_2b5ec6c574d6802c94c80313fb2" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - await queryRunner.query(`ALTER TABLE "clip_note" ADD CONSTRAINT "FK_a012eaf5c87c65da1deb5fdbfa3" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - await queryRunner.query(`ALTER TABLE "clip_note" ADD CONSTRAINT "FK_ebe99317bbbe9968a0c6f579adf" FOREIGN KEY ("clipId") REFERENCES "clip"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - await queryRunner.query(`ALTER TABLE "antenna" ADD CONSTRAINT "FK_6446c571a0e8d0f05f01c789096" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - await queryRunner.query(`ALTER TABLE "antenna" ADD CONSTRAINT "FK_709d7d32053d0dd7620f678eeb9" FOREIGN KEY ("userListId") REFERENCES "user_list"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - await queryRunner.query(`ALTER TABLE "antenna_note" ADD CONSTRAINT "FK_bd0397be22147e17210940e125b" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - await queryRunner.query(`ALTER TABLE "antenna_note" ADD CONSTRAINT "FK_0d775946662d2575dfd2068a5f5" FOREIGN KEY ("antennaId") REFERENCES "antenna"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "antenna_note" DROP CONSTRAINT "FK_0d775946662d2575dfd2068a5f5"`, undefined); - await queryRunner.query(`ALTER TABLE "antenna_note" DROP CONSTRAINT "FK_bd0397be22147e17210940e125b"`, undefined); - await queryRunner.query(`ALTER TABLE "antenna" DROP CONSTRAINT "FK_709d7d32053d0dd7620f678eeb9"`, undefined); - await queryRunner.query(`ALTER TABLE "antenna" DROP CONSTRAINT "FK_6446c571a0e8d0f05f01c789096"`, undefined); - await queryRunner.query(`ALTER TABLE "clip_note" DROP CONSTRAINT "FK_ebe99317bbbe9968a0c6f579adf"`, undefined); - await queryRunner.query(`ALTER TABLE "clip_note" DROP CONSTRAINT "FK_a012eaf5c87c65da1deb5fdbfa3"`, undefined); - await queryRunner.query(`ALTER TABLE "clip" DROP CONSTRAINT "FK_2b5ec6c574d6802c94c80313fb2"`, undefined); - await queryRunner.query(`ALTER TABLE "note" ADD "geo" jsonb`, undefined); - await queryRunner.query(`DROP INDEX "IDX_335a0bf3f904406f9ef3dd51c2"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_0d775946662d2575dfd2068a5f"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_bd0397be22147e17210940e125"`, undefined); - await queryRunner.query(`DROP TABLE "antenna_note"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_6446c571a0e8d0f05f01c78909"`, undefined); - await queryRunner.query(`DROP TABLE "antenna"`, undefined); - await queryRunner.query(`DROP TYPE "antenna_src_enum"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_6fc0ec357d55a18646262fdfff"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_ebe99317bbbe9968a0c6f579ad"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_a012eaf5c87c65da1deb5fdbfa"`, undefined); - await queryRunner.query(`DROP TABLE "clip_note"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_2b5ec6c574d6802c94c80313fb"`, undefined); - await queryRunner.query(`DROP TABLE "clip"`, undefined); - } + constructor() { + this.name = "v1251579977526288"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "clip" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "name" character varying(128) NOT NULL, "isPublic" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_f0685dac8d4dd056d7255670b75" PRIMARY KEY ("id"))`, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_2b5ec6c574d6802c94c80313fb" ON "clip" ("userId") `, + undefined, + ); + await queryRunner.query( + `CREATE TABLE "clip_note" ("id" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, "clipId" character varying(32) NOT NULL, CONSTRAINT "PK_e94cda2f40a99b57e032a1a738b" PRIMARY KEY ("id"))`, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_a012eaf5c87c65da1deb5fdbfa" ON "clip_note" ("noteId") `, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_ebe99317bbbe9968a0c6f579ad" ON "clip_note" ("clipId") `, + undefined, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_6fc0ec357d55a18646262fdfff" ON "clip_note" ("noteId", "clipId") `, + undefined, + ); + await queryRunner.query( + `CREATE TYPE "antenna_src_enum" AS ENUM('home', 'all', 'list')`, + undefined, + ); + await queryRunner.query( + `CREATE TABLE "antenna" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "name" character varying(128) NOT NULL, "src" "antenna_src_enum" NOT NULL, "userListId" character varying(32), "keywords" jsonb NOT NULL DEFAULT '[]', "withFile" boolean NOT NULL, "expression" character varying(2048), "notify" boolean NOT NULL, "hasNewNote" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_c170b99775e1dccca947c9f2d5f" PRIMARY KEY ("id"))`, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_6446c571a0e8d0f05f01c78909" ON "antenna" ("userId") `, + undefined, + ); + await queryRunner.query( + `CREATE TABLE "antenna_note" ("id" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, "antennaId" character varying(32) NOT NULL, CONSTRAINT "PK_fb28d94d0989a3872df19fd6ef8" PRIMARY KEY ("id"))`, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_bd0397be22147e17210940e125" ON "antenna_note" ("noteId") `, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0d775946662d2575dfd2068a5f" ON "antenna_note" ("antennaId") `, + undefined, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_335a0bf3f904406f9ef3dd51c2" ON "antenna_note" ("noteId", "antennaId") `, + undefined, + ); + await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "geo"`, undefined); + await queryRunner.query( + `ALTER TABLE "clip" ADD CONSTRAINT "FK_2b5ec6c574d6802c94c80313fb2" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "clip_note" ADD CONSTRAINT "FK_a012eaf5c87c65da1deb5fdbfa3" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "clip_note" ADD CONSTRAINT "FK_ebe99317bbbe9968a0c6f579adf" FOREIGN KEY ("clipId") REFERENCES "clip"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna" ADD CONSTRAINT "FK_6446c571a0e8d0f05f01c789096" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna" ADD CONSTRAINT "FK_709d7d32053d0dd7620f678eeb9" FOREIGN KEY ("userListId") REFERENCES "user_list"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna_note" ADD CONSTRAINT "FK_bd0397be22147e17210940e125b" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna_note" ADD CONSTRAINT "FK_0d775946662d2575dfd2068a5f5" FOREIGN KEY ("antennaId") REFERENCES "antenna"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "antenna_note" DROP CONSTRAINT "FK_0d775946662d2575dfd2068a5f5"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna_note" DROP CONSTRAINT "FK_bd0397be22147e17210940e125b"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna" DROP CONSTRAINT "FK_709d7d32053d0dd7620f678eeb9"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna" DROP CONSTRAINT "FK_6446c571a0e8d0f05f01c789096"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "clip_note" DROP CONSTRAINT "FK_ebe99317bbbe9968a0c6f579adf"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "clip_note" DROP CONSTRAINT "FK_a012eaf5c87c65da1deb5fdbfa3"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "clip" DROP CONSTRAINT "FK_2b5ec6c574d6802c94c80313fb2"`, + undefined, + ); + await queryRunner.query(`ALTER TABLE "note" ADD "geo" jsonb`, undefined); + await queryRunner.query( + `DROP INDEX "IDX_335a0bf3f904406f9ef3dd51c2"`, + undefined, + ); + await queryRunner.query( + `DROP INDEX "IDX_0d775946662d2575dfd2068a5f"`, + undefined, + ); + await queryRunner.query( + `DROP INDEX "IDX_bd0397be22147e17210940e125"`, + undefined, + ); + await queryRunner.query(`DROP TABLE "antenna_note"`, undefined); + await queryRunner.query( + `DROP INDEX "IDX_6446c571a0e8d0f05f01c78909"`, + undefined, + ); + await queryRunner.query(`DROP TABLE "antenna"`, undefined); + await queryRunner.query(`DROP TYPE "antenna_src_enum"`, undefined); + await queryRunner.query( + `DROP INDEX "IDX_6fc0ec357d55a18646262fdfff"`, + undefined, + ); + await queryRunner.query( + `DROP INDEX "IDX_ebe99317bbbe9968a0c6f579ad"`, + undefined, + ); + await queryRunner.query( + `DROP INDEX "IDX_a012eaf5c87c65da1deb5fdbfa"`, + undefined, + ); + await queryRunner.query(`DROP TABLE "clip_note"`, undefined); + await queryRunner.query( + `DROP INDEX "IDX_2b5ec6c574d6802c94c80313fb"`, + undefined, + ); + await queryRunner.query(`DROP TABLE "clip"`, undefined); + } } diff --git a/packages/backend/migration/1579993013959-v12-6.js b/packages/backend/migration/1579993013959-v12-6.js index 3941c1391..fc954c361 100644 --- a/packages/backend/migration/1579993013959-v12-6.js +++ b/packages/backend/migration/1579993013959-v12-6.js @@ -1,17 +1,33 @@ - - export class v1261579993013959 { - constructor() { - this.name = 'v1261579993013959'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "antenna" DROP COLUMN "hasNewNote"`, undefined); - await queryRunner.query(`ALTER TABLE "antenna_note" ADD "read" boolean NOT NULL DEFAULT false`, undefined); - await queryRunner.query(`CREATE INDEX "IDX_9937ea48d7ae97ffb4f3f063a4" ON "antenna_note" ("read") `, undefined); - } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "IDX_9937ea48d7ae97ffb4f3f063a4"`, undefined); - await queryRunner.query(`ALTER TABLE "antenna_note" DROP COLUMN "read"`, undefined); - await queryRunner.query(`ALTER TABLE "antenna" ADD "hasNewNote" boolean NOT NULL DEFAULT false`, undefined); - } + constructor() { + this.name = "v1261579993013959"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "antenna" DROP COLUMN "hasNewNote"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna_note" ADD "read" boolean NOT NULL DEFAULT false`, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_9937ea48d7ae97ffb4f3f063a4" ON "antenna_note" ("read") `, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `DROP INDEX "IDX_9937ea48d7ae97ffb4f3f063a4"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna_note" DROP COLUMN "read"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna" ADD "hasNewNote" boolean NOT NULL DEFAULT false`, + undefined, + ); + } } diff --git a/packages/backend/migration/1580069531114-v12-7.js b/packages/backend/migration/1580069531114-v12-7.js index 4b4790cb7..c4214ddf1 100644 --- a/packages/backend/migration/1580069531114-v12-7.js +++ b/packages/backend/migration/1580069531114-v12-7.js @@ -1,23 +1,51 @@ - - export class v1271580069531114 { - constructor() { - this.name = 'v1271580069531114'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "antenna" ADD "users" character varying(1024) array NOT NULL DEFAULT '{}'::varchar[]`, undefined); - await queryRunner.query(`ALTER TABLE "antenna" ADD "caseSensitive" boolean NOT NULL DEFAULT false`, undefined); - await queryRunner.query(`ALTER TYPE "public"."antenna_src_enum" RENAME TO "antenna_src_enum_old"`, undefined); - await queryRunner.query(`CREATE TYPE "antenna_src_enum" AS ENUM('home', 'all', 'users', 'list')`, undefined); - await queryRunner.query(`ALTER TABLE "antenna" ALTER COLUMN "src" TYPE "antenna_src_enum" USING "src"::"text"::"antenna_src_enum"`, undefined); - await queryRunner.query(`DROP TYPE "antenna_src_enum_old"`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`CREATE TYPE "antenna_src_enum_old" AS ENUM('home', 'all', 'list')`, undefined); - await queryRunner.query(`ALTER TABLE "antenna" ALTER COLUMN "src" TYPE "antenna_src_enum_old" USING "src"::"text"::"antenna_src_enum_old"`, undefined); - await queryRunner.query(`DROP TYPE "antenna_src_enum"`, undefined); - await queryRunner.query(`ALTER TYPE "antenna_src_enum_old" RENAME TO "antenna_src_enum"`, undefined); - await queryRunner.query(`ALTER TABLE "antenna" DROP COLUMN "caseSensitive"`, undefined); - await queryRunner.query(`ALTER TABLE "antenna" DROP COLUMN "users"`, undefined); - } + constructor() { + this.name = "v1271580069531114"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "antenna" ADD "users" character varying(1024) array NOT NULL DEFAULT '{}'::varchar[]`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna" ADD "caseSensitive" boolean NOT NULL DEFAULT false`, + undefined, + ); + await queryRunner.query( + `ALTER TYPE "public"."antenna_src_enum" RENAME TO "antenna_src_enum_old"`, + undefined, + ); + await queryRunner.query( + `CREATE TYPE "antenna_src_enum" AS ENUM('home', 'all', 'users', 'list')`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna" ALTER COLUMN "src" TYPE "antenna_src_enum" USING "src"::"text"::"antenna_src_enum"`, + undefined, + ); + await queryRunner.query(`DROP TYPE "antenna_src_enum_old"`, undefined); + } + async down(queryRunner) { + await queryRunner.query( + `CREATE TYPE "antenna_src_enum_old" AS ENUM('home', 'all', 'list')`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna" ALTER COLUMN "src" TYPE "antenna_src_enum_old" USING "src"::"text"::"antenna_src_enum_old"`, + undefined, + ); + await queryRunner.query(`DROP TYPE "antenna_src_enum"`, undefined); + await queryRunner.query( + `ALTER TYPE "antenna_src_enum_old" RENAME TO "antenna_src_enum"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna" DROP COLUMN "caseSensitive"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna" DROP COLUMN "users"`, + undefined, + ); + } } diff --git a/packages/backend/migration/1580148575182-v12-8.js b/packages/backend/migration/1580148575182-v12-8.js index cc30200c1..11b792b7e 100644 --- a/packages/backend/migration/1580148575182-v12-8.js +++ b/packages/backend/migration/1580148575182-v12-8.js @@ -1,15 +1,25 @@ - - export class v1281580148575182 { - constructor() { - this.name = 'v1281580148575182'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "note" DROP CONSTRAINT "FK_ec5c201576192ba8904c345c5cc"`, undefined); - await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "appId"`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "note" ADD "appId" character varying(32)`, undefined); - await queryRunner.query(`ALTER TABLE "note" ADD CONSTRAINT "FK_ec5c201576192ba8904c345c5cc" FOREIGN KEY ("appId") REFERENCES "app"("id") ON DELETE SET NULL ON UPDATE NO ACTION`, undefined); - } + constructor() { + this.name = "v1281580148575182"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "note" DROP CONSTRAINT "FK_ec5c201576192ba8904c345c5cc"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "note" DROP COLUMN "appId"`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "note" ADD "appId" character varying(32)`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "note" ADD CONSTRAINT "FK_ec5c201576192ba8904c345c5cc" FOREIGN KEY ("appId") REFERENCES "app"("id") ON DELETE SET NULL ON UPDATE NO ACTION`, + undefined, + ); + } } diff --git a/packages/backend/migration/1580154400017-v12-9.js b/packages/backend/migration/1580154400017-v12-9.js index 3715798f1..19f8be095 100644 --- a/packages/backend/migration/1580154400017-v12-9.js +++ b/packages/backend/migration/1580154400017-v12-9.js @@ -1,13 +1,17 @@ - - export class v1291580154400017 { - constructor() { - this.name = 'v1291580154400017'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "antenna" ADD "withReplies" boolean NOT NULL DEFAULT false`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "antenna" DROP COLUMN "withReplies"`, undefined); - } + constructor() { + this.name = "v1291580154400017"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "antenna" ADD "withReplies" boolean NOT NULL DEFAULT false`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "antenna" DROP COLUMN "withReplies"`, + undefined, + ); + } } diff --git a/packages/backend/migration/1580276619901-v12-10.js b/packages/backend/migration/1580276619901-v12-10.js index d5decb882..e5dd1db5e 100644 --- a/packages/backend/migration/1580276619901-v12-10.js +++ b/packages/backend/migration/1580276619901-v12-10.js @@ -1,18 +1,31 @@ - - export class v12101580276619901 { - constructor() { - this.name = 'v12101580276619901'; - } - async up(queryRunner) { - await queryRunner.query(`TRUNCATE TABLE "notification"`, undefined); - await queryRunner.query(`ALTER TABLE "notification" DROP COLUMN "type"`, undefined); - await queryRunner.query(`CREATE TYPE "notification_type_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted')`, undefined); - await queryRunner.query(`ALTER TABLE "notification" ADD "type" "notification_type_enum" NOT NULL`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "notification" DROP COLUMN "type"`, undefined); - await queryRunner.query(`DROP TYPE "notification_type_enum"`, undefined); - await queryRunner.query(`ALTER TABLE "notification" ADD "type" character varying(32) NOT NULL`, undefined); - } + constructor() { + this.name = "v12101580276619901"; + } + async up(queryRunner) { + await queryRunner.query(`TRUNCATE TABLE "notification"`, undefined); + await queryRunner.query( + `ALTER TABLE "notification" DROP COLUMN "type"`, + undefined, + ); + await queryRunner.query( + `CREATE TYPE "notification_type_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted')`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" ADD "type" "notification_type_enum" NOT NULL`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "notification" DROP COLUMN "type"`, + undefined, + ); + await queryRunner.query(`DROP TYPE "notification_type_enum"`, undefined); + await queryRunner.query( + `ALTER TABLE "notification" ADD "type" character varying(32) NOT NULL`, + undefined, + ); + } } diff --git a/packages/backend/migration/1580331224276-v12-11.js b/packages/backend/migration/1580331224276-v12-11.js index 129720adb..c31dca175 100644 --- a/packages/backend/migration/1580331224276-v12-11.js +++ b/packages/backend/migration/1580331224276-v12-11.js @@ -1,17 +1,33 @@ - - export class v12111580331224276 { - constructor() { - this.name = 'v12111580331224276'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "isMarkedAsClosed"`, undefined); - await queryRunner.query(`ALTER TABLE "instance" ADD "isSuspended" boolean NOT NULL DEFAULT false`, undefined); - await queryRunner.query(`CREATE INDEX "IDX_34500da2e38ac393f7bb6b299c" ON "instance" ("isSuspended") `, undefined); - } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "IDX_34500da2e38ac393f7bb6b299c"`, undefined); - await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "isSuspended"`, undefined); - await queryRunner.query(`ALTER TABLE "instance" ADD "isMarkedAsClosed" boolean NOT NULL DEFAULT false`, undefined); - } + constructor() { + this.name = "v12111580331224276"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "instance" DROP COLUMN "isMarkedAsClosed"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "instance" ADD "isSuspended" boolean NOT NULL DEFAULT false`, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_34500da2e38ac393f7bb6b299c" ON "instance" ("isSuspended") `, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `DROP INDEX "IDX_34500da2e38ac393f7bb6b299c"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "instance" DROP COLUMN "isSuspended"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "instance" ADD "isMarkedAsClosed" boolean NOT NULL DEFAULT false`, + undefined, + ); + } } diff --git a/packages/backend/migration/1580508795118-v12-12.js b/packages/backend/migration/1580508795118-v12-12.js index c5cec23a3..6df1b8f8a 100644 --- a/packages/backend/migration/1580508795118-v12-12.js +++ b/packages/backend/migration/1580508795118-v12-12.js @@ -1,45 +1,145 @@ - - export class v12121580508795118 { - constructor() { - this.name = 'v12121580508795118'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "twitter"`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "twitterAccessToken"`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "twitterAccessTokenSecret"`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "twitterUserId"`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "twitterScreenName"`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "github"`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "githubAccessToken"`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "githubId"`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "githubLogin"`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "discord"`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "discordAccessToken"`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "discordRefreshToken"`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "discordExpiresDate"`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "discordId"`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "discordUsername"`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "discordDiscriminator"`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "integrations" jsonb NOT NULL DEFAULT '{}'`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "integrations"`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "discordDiscriminator" character varying(64) DEFAULT NULL`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "discordUsername" character varying(64) DEFAULT NULL`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "discordId" character varying(64) DEFAULT NULL`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "discordExpiresDate" character varying(64)`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "discordRefreshToken" character varying(64) DEFAULT NULL`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "discordAccessToken" character varying(64) DEFAULT NULL`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "discord" boolean NOT NULL DEFAULT false`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "githubLogin" character varying(64) DEFAULT NULL`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "githubId" character varying(64)`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "githubAccessToken" character varying(64) DEFAULT NULL`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "github" boolean NOT NULL DEFAULT false`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "twitterScreenName" character varying(64) DEFAULT NULL`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "twitterUserId" character varying(64) DEFAULT NULL`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "twitterAccessTokenSecret" character varying(64) DEFAULT NULL`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "twitterAccessToken" character varying(64) DEFAULT NULL`, undefined); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "twitter" boolean NOT NULL DEFAULT false`, undefined); - } + constructor() { + this.name = "v12121580508795118"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "twitter"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "twitterAccessToken"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "twitterAccessTokenSecret"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "twitterUserId"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "twitterScreenName"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "github"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "githubAccessToken"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "githubId"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "githubLogin"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "discord"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "discordAccessToken"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "discordRefreshToken"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "discordExpiresDate"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "discordId"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "discordUsername"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "discordDiscriminator"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "integrations" jsonb NOT NULL DEFAULT '{}'`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "integrations"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "discordDiscriminator" character varying(64) DEFAULT NULL`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "discordUsername" character varying(64) DEFAULT NULL`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "discordId" character varying(64) DEFAULT NULL`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "discordExpiresDate" character varying(64)`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "discordRefreshToken" character varying(64) DEFAULT NULL`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "discordAccessToken" character varying(64) DEFAULT NULL`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "discord" boolean NOT NULL DEFAULT false`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "githubLogin" character varying(64) DEFAULT NULL`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "githubId" character varying(64)`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "githubAccessToken" character varying(64) DEFAULT NULL`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "github" boolean NOT NULL DEFAULT false`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "twitterScreenName" character varying(64) DEFAULT NULL`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "twitterUserId" character varying(64) DEFAULT NULL`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "twitterAccessTokenSecret" character varying(64) DEFAULT NULL`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "twitterAccessToken" character varying(64) DEFAULT NULL`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "twitter" boolean NOT NULL DEFAULT false`, + undefined, + ); + } } diff --git a/packages/backend/migration/1580543501339-v12-13.js b/packages/backend/migration/1580543501339-v12-13.js index 2fa490392..fd4d13151 100644 --- a/packages/backend/migration/1580543501339-v12-13.js +++ b/packages/backend/migration/1580543501339-v12-13.js @@ -1,13 +1,14 @@ - - export class v12131580543501339 { - constructor() { - this.name = 'v12131580543501339'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE INDEX "IDX_NOTE_TAGS" ON "note" USING gin ("tags")`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "IDX_NOTE_TAGS"`, undefined); - } + constructor() { + this.name = "v12131580543501339"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE INDEX "IDX_NOTE_TAGS" ON "note" USING gin ("tags")`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query(`DROP INDEX "IDX_NOTE_TAGS"`, undefined); + } } diff --git a/packages/backend/migration/1580864313253-v12-14.js b/packages/backend/migration/1580864313253-v12-14.js index a3756ad02..47f778e1d 100644 --- a/packages/backend/migration/1580864313253-v12-14.js +++ b/packages/backend/migration/1580864313253-v12-14.js @@ -1,19 +1,41 @@ - - export class v12141580864313253 { - constructor() { - this.name = 'v12141580864313253'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" RENAME COLUMN "proxyAccount" TO "proxyAccountId"`, undefined); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "proxyAccountId"`, undefined); - await queryRunner.query(`ALTER TABLE "meta" ADD "proxyAccountId" character varying(32)`, undefined); - await queryRunner.query(`ALTER TABLE "meta" ADD CONSTRAINT "FK_ab1bc0c1e209daa77b8e8d212ad" FOREIGN KEY ("proxyAccountId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE NO ACTION`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP CONSTRAINT "FK_ab1bc0c1e209daa77b8e8d212ad"`, undefined); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "proxyAccountId"`, undefined); - await queryRunner.query(`ALTER TABLE "meta" ADD "proxyAccountId" character varying(128)`, undefined); - await queryRunner.query(`ALTER TABLE "meta" RENAME COLUMN "proxyAccountId" TO "proxyAccount"`, undefined); - } + constructor() { + this.name = "v12141580864313253"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" RENAME COLUMN "proxyAccount" TO "proxyAccountId"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "proxyAccountId"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "proxyAccountId" character varying(32)`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD CONSTRAINT "FK_ab1bc0c1e209daa77b8e8d212ad" FOREIGN KEY ("proxyAccountId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE NO ACTION`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" DROP CONSTRAINT "FK_ab1bc0c1e209daa77b8e8d212ad"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "proxyAccountId"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "proxyAccountId" character varying(128)`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "meta" RENAME COLUMN "proxyAccountId" TO "proxyAccount"`, + undefined, + ); + } } diff --git a/packages/backend/migration/1581526429287-user-group-invitation.js b/packages/backend/migration/1581526429287-user-group-invitation.js index 181b0aba8..e327816ea 100644 --- a/packages/backend/migration/1581526429287-user-group-invitation.js +++ b/packages/backend/migration/1581526429287-user-group-invitation.js @@ -1,37 +1,107 @@ - - export class userGroupInvitation1581526429287 { - constructor() { - this.name = 'userGroupInvitation1581526429287'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "user_group_invitation" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "userGroupId" character varying(32) NOT NULL, CONSTRAINT "PK_160c63ec02bf23f6a5c5e8140d6" PRIMARY KEY ("id"))`, undefined); - await queryRunner.query(`CREATE INDEX "IDX_bfbc6305547539369fe73eb144" ON "user_group_invitation" ("userId") `, undefined); - await queryRunner.query(`CREATE INDEX "IDX_5cc8c468090e129857e9fecce5" ON "user_group_invitation" ("userGroupId") `, undefined); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_e9793f65f504e5a31fbaedbf2f" ON "user_group_invitation" ("userId", "userGroupId") `, undefined); - await queryRunner.query(`ALTER TABLE "notification" ADD "userGroupInvitationId" character varying(32)`, undefined); - await queryRunner.query(`ALTER TYPE "public"."notification_type_enum" RENAME TO "notification_type_enum_old"`, undefined); - await queryRunner.query(`CREATE TYPE "notification_type_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited')`, undefined); - await queryRunner.query(`ALTER TABLE "notification" ALTER COLUMN "type" TYPE "notification_type_enum" USING "type"::"text"::"notification_type_enum"`, undefined); - await queryRunner.query(`DROP TYPE "notification_type_enum_old"`, undefined); - await queryRunner.query(`COMMENT ON COLUMN "notification"."type" IS 'The type of the Notification.'`, undefined); - await queryRunner.query(`ALTER TABLE "user_group_invitation" ADD CONSTRAINT "FK_bfbc6305547539369fe73eb144a" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - await queryRunner.query(`ALTER TABLE "user_group_invitation" ADD CONSTRAINT "FK_5cc8c468090e129857e9fecce5a" FOREIGN KEY ("userGroupId") REFERENCES "user_group"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - await queryRunner.query(`ALTER TABLE "notification" ADD CONSTRAINT "FK_8fe87814e978053a53b1beb7e98" FOREIGN KEY ("userGroupInvitationId") REFERENCES "user_group_invitation"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "notification" DROP CONSTRAINT "FK_8fe87814e978053a53b1beb7e98"`, undefined); - await queryRunner.query(`ALTER TABLE "user_group_invitation" DROP CONSTRAINT "FK_5cc8c468090e129857e9fecce5a"`, undefined); - await queryRunner.query(`ALTER TABLE "user_group_invitation" DROP CONSTRAINT "FK_bfbc6305547539369fe73eb144a"`, undefined); - await queryRunner.query(`COMMENT ON COLUMN "notification"."type" IS ''`, undefined); - await queryRunner.query(`CREATE TYPE "notification_type_enum_old" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted')`, undefined); - await queryRunner.query(`ALTER TABLE "notification" ALTER COLUMN "type" TYPE "notification_type_enum_old" USING "type"::"text"::"notification_type_enum_old"`, undefined); - await queryRunner.query(`DROP TYPE "notification_type_enum"`, undefined); - await queryRunner.query(`ALTER TYPE "notification_type_enum_old" RENAME TO "notification_type_enum"`, undefined); - await queryRunner.query(`ALTER TABLE "notification" DROP COLUMN "userGroupInvitationId"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_e9793f65f504e5a31fbaedbf2f"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_5cc8c468090e129857e9fecce5"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_bfbc6305547539369fe73eb144"`, undefined); - await queryRunner.query(`DROP TABLE "user_group_invitation"`, undefined); - } + constructor() { + this.name = "userGroupInvitation1581526429287"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "user_group_invitation" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "userGroupId" character varying(32) NOT NULL, CONSTRAINT "PK_160c63ec02bf23f6a5c5e8140d6" PRIMARY KEY ("id"))`, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_bfbc6305547539369fe73eb144" ON "user_group_invitation" ("userId") `, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_5cc8c468090e129857e9fecce5" ON "user_group_invitation" ("userGroupId") `, + undefined, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_e9793f65f504e5a31fbaedbf2f" ON "user_group_invitation" ("userId", "userGroupId") `, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" ADD "userGroupInvitationId" character varying(32)`, + undefined, + ); + await queryRunner.query( + `ALTER TYPE "public"."notification_type_enum" RENAME TO "notification_type_enum_old"`, + undefined, + ); + await queryRunner.query( + `CREATE TYPE "notification_type_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited')`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" ALTER COLUMN "type" TYPE "notification_type_enum" USING "type"::"text"::"notification_type_enum"`, + undefined, + ); + await queryRunner.query( + `DROP TYPE "notification_type_enum_old"`, + undefined, + ); + await queryRunner.query( + `COMMENT ON COLUMN "notification"."type" IS 'The type of the Notification.'`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_group_invitation" ADD CONSTRAINT "FK_bfbc6305547539369fe73eb144a" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_group_invitation" ADD CONSTRAINT "FK_5cc8c468090e129857e9fecce5a" FOREIGN KEY ("userGroupId") REFERENCES "user_group"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" ADD CONSTRAINT "FK_8fe87814e978053a53b1beb7e98" FOREIGN KEY ("userGroupInvitationId") REFERENCES "user_group_invitation"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "notification" DROP CONSTRAINT "FK_8fe87814e978053a53b1beb7e98"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_group_invitation" DROP CONSTRAINT "FK_5cc8c468090e129857e9fecce5a"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "user_group_invitation" DROP CONSTRAINT "FK_bfbc6305547539369fe73eb144a"`, + undefined, + ); + await queryRunner.query( + `COMMENT ON COLUMN "notification"."type" IS ''`, + undefined, + ); + await queryRunner.query( + `CREATE TYPE "notification_type_enum_old" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted')`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" ALTER COLUMN "type" TYPE "notification_type_enum_old" USING "type"::"text"::"notification_type_enum_old"`, + undefined, + ); + await queryRunner.query(`DROP TYPE "notification_type_enum"`, undefined); + await queryRunner.query( + `ALTER TYPE "notification_type_enum_old" RENAME TO "notification_type_enum"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" DROP COLUMN "userGroupInvitationId"`, + undefined, + ); + await queryRunner.query( + `DROP INDEX "IDX_e9793f65f504e5a31fbaedbf2f"`, + undefined, + ); + await queryRunner.query( + `DROP INDEX "IDX_5cc8c468090e129857e9fecce5"`, + undefined, + ); + await queryRunner.query( + `DROP INDEX "IDX_bfbc6305547539369fe73eb144"`, + undefined, + ); + await queryRunner.query(`DROP TABLE "user_group_invitation"`, undefined); + } } diff --git a/packages/backend/migration/1581695816408-user-group-antenna.js b/packages/backend/migration/1581695816408-user-group-antenna.js index 267b58cd9..28112767e 100644 --- a/packages/backend/migration/1581695816408-user-group-antenna.js +++ b/packages/backend/migration/1581695816408-user-group-antenna.js @@ -1,27 +1,67 @@ - - export class userGroupAntenna1581695816408 { - constructor() { - this.name = 'userGroupAntenna1581695816408'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "antenna" ADD "userGroupJoiningId" character varying(32)`, undefined); - await queryRunner.query(`ALTER TYPE "public"."antenna_src_enum" RENAME TO "antenna_src_enum_old"`, undefined); - await queryRunner.query(`CREATE TYPE "antenna_src_enum" AS ENUM('home', 'all', 'users', 'list', 'group')`, undefined); - await queryRunner.query(`ALTER TABLE "antenna" ALTER COLUMN "src" TYPE "antenna_src_enum" USING "src"::"text"::"antenna_src_enum"`, undefined); - await queryRunner.query(`DROP TYPE "antenna_src_enum_old"`, undefined); - await queryRunner.query(`ALTER TABLE "antenna" DROP COLUMN "users"`, undefined); - await queryRunner.query(`ALTER TABLE "antenna" ADD "users" character varying(1024) array NOT NULL DEFAULT '{}'::varchar[]`, undefined); - await queryRunner.query(`ALTER TABLE "antenna" ADD CONSTRAINT "FK_ccbf5a8c0be4511133dcc50ddeb" FOREIGN KEY ("userGroupJoiningId") REFERENCES "user_group_joining"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "antenna" DROP CONSTRAINT "FK_ccbf5a8c0be4511133dcc50ddeb"`, undefined); - await queryRunner.query(`ALTER TABLE "antenna" DROP COLUMN "users"`, undefined); - await queryRunner.query(`ALTER TABLE "antenna" ADD "users" character varying array NOT NULL DEFAULT '{}'`, undefined); - await queryRunner.query(`CREATE TYPE "antenna_src_enum_old" AS ENUM('home', 'all', 'users', 'list')`, undefined); - await queryRunner.query(`ALTER TABLE "antenna" ALTER COLUMN "src" TYPE "antenna_src_enum_old" USING "src"::"text"::"antenna_src_enum_old"`, undefined); - await queryRunner.query(`DROP TYPE "antenna_src_enum"`, undefined); - await queryRunner.query(`ALTER TYPE "antenna_src_enum_old" RENAME TO "antenna_src_enum"`, undefined); - await queryRunner.query(`ALTER TABLE "antenna" DROP COLUMN "userGroupJoiningId"`, undefined); - } + constructor() { + this.name = "userGroupAntenna1581695816408"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "antenna" ADD "userGroupJoiningId" character varying(32)`, + undefined, + ); + await queryRunner.query( + `ALTER TYPE "public"."antenna_src_enum" RENAME TO "antenna_src_enum_old"`, + undefined, + ); + await queryRunner.query( + `CREATE TYPE "antenna_src_enum" AS ENUM('home', 'all', 'users', 'list', 'group')`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna" ALTER COLUMN "src" TYPE "antenna_src_enum" USING "src"::"text"::"antenna_src_enum"`, + undefined, + ); + await queryRunner.query(`DROP TYPE "antenna_src_enum_old"`, undefined); + await queryRunner.query( + `ALTER TABLE "antenna" DROP COLUMN "users"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna" ADD "users" character varying(1024) array NOT NULL DEFAULT '{}'::varchar[]`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna" ADD CONSTRAINT "FK_ccbf5a8c0be4511133dcc50ddeb" FOREIGN KEY ("userGroupJoiningId") REFERENCES "user_group_joining"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "antenna" DROP CONSTRAINT "FK_ccbf5a8c0be4511133dcc50ddeb"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna" DROP COLUMN "users"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna" ADD "users" character varying array NOT NULL DEFAULT '{}'`, + undefined, + ); + await queryRunner.query( + `CREATE TYPE "antenna_src_enum_old" AS ENUM('home', 'all', 'users', 'list')`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna" ALTER COLUMN "src" TYPE "antenna_src_enum_old" USING "src"::"text"::"antenna_src_enum_old"`, + undefined, + ); + await queryRunner.query(`DROP TYPE "antenna_src_enum"`, undefined); + await queryRunner.query( + `ALTER TYPE "antenna_src_enum_old" RENAME TO "antenna_src_enum"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "antenna" DROP COLUMN "userGroupJoiningId"`, + undefined, + ); + } } diff --git a/packages/backend/migration/1581708415836-drive-user-folder-id-index.js b/packages/backend/migration/1581708415836-drive-user-folder-id-index.js index 43c2ce6ce..41902dc53 100644 --- a/packages/backend/migration/1581708415836-drive-user-folder-id-index.js +++ b/packages/backend/migration/1581708415836-drive-user-folder-id-index.js @@ -1,13 +1,17 @@ - - export class driveUserFolderIdIndex1581708415836 { - constructor() { - this.name = 'driveUserFolderIdIndex1581708415836'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE INDEX "IDX_55720b33a61a7c806a8215b825" ON "drive_file" ("userId", "folderId", "id") `, undefined); - } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "IDX_55720b33a61a7c806a8215b825"`, undefined); - } + constructor() { + this.name = "driveUserFolderIdIndex1581708415836"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE INDEX "IDX_55720b33a61a7c806a8215b825" ON "drive_file" ("userId", "folderId", "id") `, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `DROP INDEX "IDX_55720b33a61a7c806a8215b825"`, + undefined, + ); + } } diff --git a/packages/backend/migration/1581979837262-promo.js b/packages/backend/migration/1581979837262-promo.js index 4813a5f48..39e79965b 100644 --- a/packages/backend/migration/1581979837262-promo.js +++ b/packages/backend/migration/1581979837262-promo.js @@ -1,27 +1,67 @@ - - export class promo1581979837262 { - constructor() { - this.name = 'promo1581979837262'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "promo_note" ("noteId" character varying(32) NOT NULL, "expiresAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, CONSTRAINT "REL_e263909ca4fe5d57f8d4230dd5" UNIQUE ("noteId"), CONSTRAINT "PK_e263909ca4fe5d57f8d4230dd5c" PRIMARY KEY ("noteId"))`, undefined); - await queryRunner.query(`CREATE INDEX "IDX_83f0862e9bae44af52ced7099e" ON "promo_note" ("userId") `, undefined); - await queryRunner.query(`CREATE TABLE "promo_read" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, CONSTRAINT "PK_61917c1541002422b703318b7c9" PRIMARY KEY ("id"))`, undefined); - await queryRunner.query(`CREATE INDEX "IDX_9657d55550c3d37bfafaf7d4b0" ON "promo_read" ("userId") `, undefined); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_2882b8a1a07c7d281a98b6db16" ON "promo_read" ("userId", "noteId") `, undefined); - await queryRunner.query(`ALTER TABLE "promo_note" ADD CONSTRAINT "FK_e263909ca4fe5d57f8d4230dd5c" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - await queryRunner.query(`ALTER TABLE "promo_read" ADD CONSTRAINT "FK_9657d55550c3d37bfafaf7d4b05" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - await queryRunner.query(`ALTER TABLE "promo_read" ADD CONSTRAINT "FK_a46a1a603ecee695d7db26da5f4" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "promo_read" DROP CONSTRAINT "FK_a46a1a603ecee695d7db26da5f4"`, undefined); - await queryRunner.query(`ALTER TABLE "promo_read" DROP CONSTRAINT "FK_9657d55550c3d37bfafaf7d4b05"`, undefined); - await queryRunner.query(`ALTER TABLE "promo_note" DROP CONSTRAINT "FK_e263909ca4fe5d57f8d4230dd5c"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_2882b8a1a07c7d281a98b6db16"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_9657d55550c3d37bfafaf7d4b0"`, undefined); - await queryRunner.query(`DROP TABLE "promo_read"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_83f0862e9bae44af52ced7099e"`, undefined); - await queryRunner.query(`DROP TABLE "promo_note"`, undefined); - } + constructor() { + this.name = "promo1581979837262"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "promo_note" ("noteId" character varying(32) NOT NULL, "expiresAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, CONSTRAINT "REL_e263909ca4fe5d57f8d4230dd5" UNIQUE ("noteId"), CONSTRAINT "PK_e263909ca4fe5d57f8d4230dd5c" PRIMARY KEY ("noteId"))`, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_83f0862e9bae44af52ced7099e" ON "promo_note" ("userId") `, + undefined, + ); + await queryRunner.query( + `CREATE TABLE "promo_read" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, CONSTRAINT "PK_61917c1541002422b703318b7c9" PRIMARY KEY ("id"))`, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_9657d55550c3d37bfafaf7d4b0" ON "promo_read" ("userId") `, + undefined, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_2882b8a1a07c7d281a98b6db16" ON "promo_read" ("userId", "noteId") `, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "promo_note" ADD CONSTRAINT "FK_e263909ca4fe5d57f8d4230dd5c" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "promo_read" ADD CONSTRAINT "FK_9657d55550c3d37bfafaf7d4b05" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "promo_read" ADD CONSTRAINT "FK_a46a1a603ecee695d7db26da5f4" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "promo_read" DROP CONSTRAINT "FK_a46a1a603ecee695d7db26da5f4"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "promo_read" DROP CONSTRAINT "FK_9657d55550c3d37bfafaf7d4b05"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "promo_note" DROP CONSTRAINT "FK_e263909ca4fe5d57f8d4230dd5c"`, + undefined, + ); + await queryRunner.query( + `DROP INDEX "IDX_2882b8a1a07c7d281a98b6db16"`, + undefined, + ); + await queryRunner.query( + `DROP INDEX "IDX_9657d55550c3d37bfafaf7d4b0"`, + undefined, + ); + await queryRunner.query(`DROP TABLE "promo_read"`, undefined); + await queryRunner.query( + `DROP INDEX "IDX_83f0862e9bae44af52ced7099e"`, + undefined, + ); + await queryRunner.query(`DROP TABLE "promo_note"`, undefined); + } } diff --git a/packages/backend/migration/1582019042083-featured-injecttion.js b/packages/backend/migration/1582019042083-featured-injecttion.js index 7f8790b01..61b7d0c27 100644 --- a/packages/backend/migration/1582019042083-featured-injecttion.js +++ b/packages/backend/migration/1582019042083-featured-injecttion.js @@ -1,13 +1,17 @@ - - export class featuredInjecttion1582019042083 { - constructor() { - this.name = 'featuredInjecttion1582019042083'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" ADD "injectFeaturedNote" boolean NOT NULL DEFAULT true`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "injectFeaturedNote"`, undefined); - } + constructor() { + this.name = "featuredInjecttion1582019042083"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "injectFeaturedNote" boolean NOT NULL DEFAULT true`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "injectFeaturedNote"`, + undefined, + ); + } } diff --git a/packages/backend/migration/1582210532752-antenna-exclude.js b/packages/backend/migration/1582210532752-antenna-exclude.js index ff8d7b80d..5a394270e 100644 --- a/packages/backend/migration/1582210532752-antenna-exclude.js +++ b/packages/backend/migration/1582210532752-antenna-exclude.js @@ -1,13 +1,17 @@ - - export class antennaExclude1582210532752 { - constructor() { - this.name = 'antennaExclude1582210532752'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "antenna" ADD "excludeKeywords" jsonb NOT NULL DEFAULT '[]'`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "antenna" DROP COLUMN "excludeKeywords"`, undefined); - } + constructor() { + this.name = "antennaExclude1582210532752"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "antenna" ADD "excludeKeywords" jsonb NOT NULL DEFAULT '[]'`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "antenna" DROP COLUMN "excludeKeywords"`, + undefined, + ); + } } diff --git a/packages/backend/migration/1582875306439-note-reaction-length.js b/packages/backend/migration/1582875306439-note-reaction-length.js index e99501f01..2c9b72673 100644 --- a/packages/backend/migration/1582875306439-note-reaction-length.js +++ b/packages/backend/migration/1582875306439-note-reaction-length.js @@ -1,13 +1,17 @@ - - export class noteReactionLength1582875306439 { - constructor() { - this.name = 'noteReactionLength1582875306439'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "note_reaction" ALTER COLUMN "reaction" TYPE character varying(130)`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "note_reaction" ALTER COLUMN "reaction" TYPE character varying(128)`, undefined); - } + constructor() { + this.name = "noteReactionLength1582875306439"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "note_reaction" ALTER COLUMN "reaction" TYPE character varying(130)`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "note_reaction" ALTER COLUMN "reaction" TYPE character varying(128)`, + undefined, + ); + } } diff --git a/packages/backend/migration/1585361548360-miauth.js b/packages/backend/migration/1585361548360-miauth.js index e59aa3b6e..2e052cb89 100644 --- a/packages/backend/migration/1585361548360-miauth.js +++ b/packages/backend/migration/1585361548360-miauth.js @@ -1,35 +1,105 @@ - - export class miauth1585361548360 { - constructor() { - this.name = 'miauth1585361548360'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "access_token" ADD "lastUsedAt" TIMESTAMP WITH TIME ZONE DEFAULT null`, undefined); - await queryRunner.query(`ALTER TABLE "access_token" ADD "session" character varying(128) DEFAULT null`, undefined); - await queryRunner.query(`ALTER TABLE "access_token" ADD "name" character varying(128) DEFAULT null`, undefined); - await queryRunner.query(`ALTER TABLE "access_token" ADD "description" character varying(512) DEFAULT null`, undefined); - await queryRunner.query(`ALTER TABLE "access_token" ADD "iconUrl" character varying(512) DEFAULT null`, undefined); - await queryRunner.query(`ALTER TABLE "access_token" ADD "permission" character varying(64) array NOT NULL DEFAULT '{}'::varchar[]`, undefined); - await queryRunner.query(`ALTER TABLE "access_token" ADD "fetched" boolean NOT NULL DEFAULT false`, undefined); - await queryRunner.query(`ALTER TABLE "access_token" DROP CONSTRAINT "FK_a3ff16c90cc87a82a0b5959e560"`, undefined); - await queryRunner.query(`ALTER TABLE "access_token" ALTER COLUMN "appId" DROP NOT NULL`, undefined); - await queryRunner.query(`ALTER TABLE "access_token" ALTER COLUMN "appId" SET DEFAULT null`, undefined); - await queryRunner.query(`CREATE INDEX "IDX_bf3a053c07d9fb5d87317c56ee" ON "access_token" ("session") `, undefined); - await queryRunner.query(`ALTER TABLE "access_token" ADD CONSTRAINT "FK_a3ff16c90cc87a82a0b5959e560" FOREIGN KEY ("appId") REFERENCES "app"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "access_token" DROP CONSTRAINT "FK_a3ff16c90cc87a82a0b5959e560"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_bf3a053c07d9fb5d87317c56ee"`, undefined); - await queryRunner.query(`ALTER TABLE "access_token" ALTER COLUMN "appId" DROP DEFAULT`, undefined); - await queryRunner.query(`ALTER TABLE "access_token" ALTER COLUMN "appId" SET NOT NULL`, undefined); - await queryRunner.query(`ALTER TABLE "access_token" ADD CONSTRAINT "FK_a3ff16c90cc87a82a0b5959e560" FOREIGN KEY ("appId") REFERENCES "app"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - await queryRunner.query(`ALTER TABLE "access_token" DROP COLUMN "fetched"`, undefined); - await queryRunner.query(`ALTER TABLE "access_token" DROP COLUMN "permission"`, undefined); - await queryRunner.query(`ALTER TABLE "access_token" DROP COLUMN "iconUrl"`, undefined); - await queryRunner.query(`ALTER TABLE "access_token" DROP COLUMN "description"`, undefined); - await queryRunner.query(`ALTER TABLE "access_token" DROP COLUMN "name"`, undefined); - await queryRunner.query(`ALTER TABLE "access_token" DROP COLUMN "session"`, undefined); - await queryRunner.query(`ALTER TABLE "access_token" DROP COLUMN "lastUsedAt"`, undefined); - } + constructor() { + this.name = "miauth1585361548360"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "access_token" ADD "lastUsedAt" TIMESTAMP WITH TIME ZONE DEFAULT null`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" ADD "session" character varying(128) DEFAULT null`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" ADD "name" character varying(128) DEFAULT null`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" ADD "description" character varying(512) DEFAULT null`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" ADD "iconUrl" character varying(512) DEFAULT null`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" ADD "permission" character varying(64) array NOT NULL DEFAULT '{}'::varchar[]`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" ADD "fetched" boolean NOT NULL DEFAULT false`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" DROP CONSTRAINT "FK_a3ff16c90cc87a82a0b5959e560"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" ALTER COLUMN "appId" DROP NOT NULL`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" ALTER COLUMN "appId" SET DEFAULT null`, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_bf3a053c07d9fb5d87317c56ee" ON "access_token" ("session") `, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" ADD CONSTRAINT "FK_a3ff16c90cc87a82a0b5959e560" FOREIGN KEY ("appId") REFERENCES "app"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "access_token" DROP CONSTRAINT "FK_a3ff16c90cc87a82a0b5959e560"`, + undefined, + ); + await queryRunner.query( + `DROP INDEX "IDX_bf3a053c07d9fb5d87317c56ee"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" ALTER COLUMN "appId" DROP DEFAULT`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" ALTER COLUMN "appId" SET NOT NULL`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" ADD CONSTRAINT "FK_a3ff16c90cc87a82a0b5959e560" FOREIGN KEY ("appId") REFERENCES "app"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" DROP COLUMN "fetched"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" DROP COLUMN "permission"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" DROP COLUMN "iconUrl"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" DROP COLUMN "description"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" DROP COLUMN "name"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" DROP COLUMN "session"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "access_token" DROP COLUMN "lastUsedAt"`, + undefined, + ); + } } diff --git a/packages/backend/migration/1585385921215-custom-notification.js b/packages/backend/migration/1585385921215-custom-notification.js index c3ddb2be1..23142cd3a 100644 --- a/packages/backend/migration/1585385921215-custom-notification.js +++ b/packages/backend/migration/1585385921215-custom-notification.js @@ -1,47 +1,150 @@ - - export class customNotification1585385921215 { - constructor() { - this.name = 'customNotification1585385921215'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "notification" ADD "customBody" character varying(2048)`, undefined); - await queryRunner.query(`ALTER TABLE "notification" ADD "customHeader" character varying(256)`, undefined); - await queryRunner.query(`ALTER TABLE "notification" ADD "customIcon" character varying(1024)`, undefined); - await queryRunner.query(`ALTER TABLE "notification" ADD "appAccessTokenId" character varying(32)`, undefined); - await queryRunner.query(`ALTER TABLE "notification" DROP CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710"`, undefined); - await queryRunner.query(`ALTER TABLE "notification" ALTER COLUMN "notifierId" DROP NOT NULL`, undefined); - await queryRunner.query(`COMMENT ON COLUMN "notification"."notifierId" IS 'The ID of sender user of the Notification.'`, undefined); - await queryRunner.query(`ALTER TYPE "public"."notification_type_enum" RENAME TO "notification_type_enum_old"`, undefined); - await queryRunner.query(`CREATE TYPE "notification_type_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`, undefined); - await queryRunner.query(`ALTER TABLE "notification" ALTER COLUMN "type" TYPE "notification_type_enum" USING "type"::"text"::"notification_type_enum"`, undefined); - await queryRunner.query(`DROP TYPE "notification_type_enum_old"`, undefined); - await queryRunner.query(`COMMENT ON COLUMN "notification"."type" IS 'The type of the Notification.'`, undefined); - await queryRunner.query(`CREATE INDEX "IDX_3b4e96eec8d36a8bbb9d02aa71" ON "notification" ("notifierId") `, undefined); - await queryRunner.query(`CREATE INDEX "IDX_33f33cc8ef29d805a97ff4628b" ON "notification" ("type") `, undefined); - await queryRunner.query(`CREATE INDEX "IDX_080ab397c379af09b9d2169e5b" ON "notification" ("isRead") `, undefined); - await queryRunner.query(`CREATE INDEX "IDX_e22bf6bda77b6adc1fd9e75c8c" ON "notification" ("appAccessTokenId") `, undefined); - await queryRunner.query(`ALTER TABLE "notification" ADD CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710" FOREIGN KEY ("notifierId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - await queryRunner.query(`ALTER TABLE "notification" ADD CONSTRAINT "FK_e22bf6bda77b6adc1fd9e75c8c9" FOREIGN KEY ("appAccessTokenId") REFERENCES "access_token"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "notification" DROP CONSTRAINT "FK_e22bf6bda77b6adc1fd9e75c8c9"`, undefined); - await queryRunner.query(`ALTER TABLE "notification" DROP CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_e22bf6bda77b6adc1fd9e75c8c"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_080ab397c379af09b9d2169e5b"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_33f33cc8ef29d805a97ff4628b"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_3b4e96eec8d36a8bbb9d02aa71"`, undefined); - await queryRunner.query(`COMMENT ON COLUMN "notification"."type" IS ''`, undefined); - await queryRunner.query(`CREATE TYPE "notification_type_enum_old" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited')`, undefined); - await queryRunner.query(`ALTER TABLE "notification" ALTER COLUMN "type" TYPE "notification_type_enum_old" USING "type"::"text"::"notification_type_enum_old"`, undefined); - await queryRunner.query(`DROP TYPE "notification_type_enum"`, undefined); - await queryRunner.query(`ALTER TYPE "notification_type_enum_old" RENAME TO "notification_type_enum"`, undefined); - await queryRunner.query(`COMMENT ON COLUMN "notification"."notifierId" IS ''`, undefined); - await queryRunner.query(`ALTER TABLE "notification" ALTER COLUMN "notifierId" SET NOT NULL`, undefined); - await queryRunner.query(`ALTER TABLE "notification" ADD CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710" FOREIGN KEY ("notifierId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined); - await queryRunner.query(`ALTER TABLE "notification" DROP COLUMN "appAccessTokenId"`, undefined); - await queryRunner.query(`ALTER TABLE "notification" DROP COLUMN "customIcon"`, undefined); - await queryRunner.query(`ALTER TABLE "notification" DROP COLUMN "customHeader"`, undefined); - await queryRunner.query(`ALTER TABLE "notification" DROP COLUMN "customBody"`, undefined); - } + constructor() { + this.name = "customNotification1585385921215"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "notification" ADD "customBody" character varying(2048)`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" ADD "customHeader" character varying(256)`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" ADD "customIcon" character varying(1024)`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" ADD "appAccessTokenId" character varying(32)`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" DROP CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" ALTER COLUMN "notifierId" DROP NOT NULL`, + undefined, + ); + await queryRunner.query( + `COMMENT ON COLUMN "notification"."notifierId" IS 'The ID of sender user of the Notification.'`, + undefined, + ); + await queryRunner.query( + `ALTER TYPE "public"."notification_type_enum" RENAME TO "notification_type_enum_old"`, + undefined, + ); + await queryRunner.query( + `CREATE TYPE "notification_type_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" ALTER COLUMN "type" TYPE "notification_type_enum" USING "type"::"text"::"notification_type_enum"`, + undefined, + ); + await queryRunner.query( + `DROP TYPE "notification_type_enum_old"`, + undefined, + ); + await queryRunner.query( + `COMMENT ON COLUMN "notification"."type" IS 'The type of the Notification.'`, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_3b4e96eec8d36a8bbb9d02aa71" ON "notification" ("notifierId") `, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_33f33cc8ef29d805a97ff4628b" ON "notification" ("type") `, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_080ab397c379af09b9d2169e5b" ON "notification" ("isRead") `, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_e22bf6bda77b6adc1fd9e75c8c" ON "notification" ("appAccessTokenId") `, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" ADD CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710" FOREIGN KEY ("notifierId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" ADD CONSTRAINT "FK_e22bf6bda77b6adc1fd9e75c8c9" FOREIGN KEY ("appAccessTokenId") REFERENCES "access_token"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "notification" DROP CONSTRAINT "FK_e22bf6bda77b6adc1fd9e75c8c9"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" DROP CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710"`, + undefined, + ); + await queryRunner.query( + `DROP INDEX "IDX_e22bf6bda77b6adc1fd9e75c8c"`, + undefined, + ); + await queryRunner.query( + `DROP INDEX "IDX_080ab397c379af09b9d2169e5b"`, + undefined, + ); + await queryRunner.query( + `DROP INDEX "IDX_33f33cc8ef29d805a97ff4628b"`, + undefined, + ); + await queryRunner.query( + `DROP INDEX "IDX_3b4e96eec8d36a8bbb9d02aa71"`, + undefined, + ); + await queryRunner.query( + `COMMENT ON COLUMN "notification"."type" IS ''`, + undefined, + ); + await queryRunner.query( + `CREATE TYPE "notification_type_enum_old" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited')`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" ALTER COLUMN "type" TYPE "notification_type_enum_old" USING "type"::"text"::"notification_type_enum_old"`, + undefined, + ); + await queryRunner.query(`DROP TYPE "notification_type_enum"`, undefined); + await queryRunner.query( + `ALTER TYPE "notification_type_enum_old" RENAME TO "notification_type_enum"`, + undefined, + ); + await queryRunner.query( + `COMMENT ON COLUMN "notification"."notifierId" IS ''`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" ALTER COLUMN "notifierId" SET NOT NULL`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" ADD CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710" FOREIGN KEY ("notifierId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" DROP COLUMN "appAccessTokenId"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" DROP COLUMN "customIcon"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" DROP COLUMN "customHeader"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "notification" DROP COLUMN "customBody"`, + undefined, + ); + } } diff --git a/packages/backend/migration/1585772678853-ap-url.js b/packages/backend/migration/1585772678853-ap-url.js index 5fb809ff5..18cc4588e 100644 --- a/packages/backend/migration/1585772678853-ap-url.js +++ b/packages/backend/migration/1585772678853-ap-url.js @@ -1,13 +1,14 @@ - - export class apUrl1585772678853 { - constructor() { - this.name = 'apUrl1585772678853'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "note" ADD "url" character varying(512)`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "url"`, undefined); - } + constructor() { + this.name = "apUrl1585772678853"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "note" ADD "url" character varying(512)`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "url"`, undefined); + } } diff --git a/packages/backend/migration/1586624197029-AddObjectStorageUseProxy.js b/packages/backend/migration/1586624197029-AddObjectStorageUseProxy.js index e13bb217e..89694f84b 100644 --- a/packages/backend/migration/1586624197029-AddObjectStorageUseProxy.js +++ b/packages/backend/migration/1586624197029-AddObjectStorageUseProxy.js @@ -1,13 +1,17 @@ - - export class AddObjectStorageUseProxy1586624197029 { - constructor() { - this.name = 'AddObjectStorageUseProxy1586624197029'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "objectStorageUseProxy" boolean NOT NULL DEFAULT true`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "objectStorageUseProxy"`, undefined); - } + constructor() { + this.name = "AddObjectStorageUseProxy1586624197029"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "objectStorageUseProxy" boolean NOT NULL DEFAULT true`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "objectStorageUseProxy"`, + undefined, + ); + } } diff --git a/packages/backend/migration/1586641139527-remote-reaction.js b/packages/backend/migration/1586641139527-remote-reaction.js index 5b23103a1..d7390544c 100644 --- a/packages/backend/migration/1586641139527-remote-reaction.js +++ b/packages/backend/migration/1586641139527-remote-reaction.js @@ -1,13 +1,17 @@ - - export class remoteReaction1586641139527 { - constructor() { - this.name = 'remoteReaction1586641139527'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "note_reaction" ALTER COLUMN "reaction" TYPE character varying(260)`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "note_reaction" ALTER COLUMN "reaction" TYPE character varying(130)`, undefined); - } + constructor() { + this.name = "remoteReaction1586641139527"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "note_reaction" ALTER COLUMN "reaction" TYPE character varying(260)`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "note_reaction" ALTER COLUMN "reaction" TYPE character varying(130)`, + undefined, + ); + } } diff --git a/packages/backend/migration/1586708940386-pageAiScript.js b/packages/backend/migration/1586708940386-pageAiScript.js index eed616c11..25eb71098 100644 --- a/packages/backend/migration/1586708940386-pageAiScript.js +++ b/packages/backend/migration/1586708940386-pageAiScript.js @@ -1,13 +1,17 @@ - - export class pageAiScript1586708940386 { - constructor() { - this.name = 'pageAiScript1586708940386'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "page" ADD "script" character varying(16384) NOT NULL DEFAULT ''`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "page" DROP COLUMN "script"`, undefined); - } + constructor() { + this.name = "pageAiScript1586708940386"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "page" ADD "script" character varying(16384) NOT NULL DEFAULT ''`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "page" DROP COLUMN "script"`, + undefined, + ); + } } diff --git a/packages/backend/migration/1588044505511-hCaptcha.js b/packages/backend/migration/1588044505511-hCaptcha.js index a33dbd713..29ba87370 100644 --- a/packages/backend/migration/1588044505511-hCaptcha.js +++ b/packages/backend/migration/1588044505511-hCaptcha.js @@ -1,17 +1,33 @@ - - export class hCaptcha1588044505511 { - constructor() { - this.name = 'hCaptcha1588044505511'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "enableHcaptcha" boolean NOT NULL DEFAULT false`, undefined); - await queryRunner.query(`ALTER TABLE "meta" ADD "hcaptchaSiteKey" character varying(64)`, undefined); - await queryRunner.query(`ALTER TABLE "meta" ADD "hcaptchaSecretKey" character varying(64)`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "hcaptchaSecretKey"`, undefined); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "hcaptchaSiteKey"`, undefined); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "enableHcaptcha"`, undefined); - } + constructor() { + this.name = "hCaptcha1588044505511"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "enableHcaptcha" boolean NOT NULL DEFAULT false`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "hcaptchaSiteKey" character varying(64)`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "hcaptchaSecretKey" character varying(64)`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "hcaptchaSecretKey"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "hcaptchaSiteKey"`, + undefined, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "enableHcaptcha"`, + undefined, + ); + } } diff --git a/packages/backend/migration/1589023282116-pubRelay.js b/packages/backend/migration/1589023282116-pubRelay.js index 48a1028d3..a1a229919 100644 --- a/packages/backend/migration/1589023282116-pubRelay.js +++ b/packages/backend/migration/1589023282116-pubRelay.js @@ -1,17 +1,27 @@ - - export class pubRelay1589023282116 { - constructor() { - this.name = 'pubRelay1589023282116'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE TYPE "relay_status_enum" AS ENUM('requesting', 'accepted', 'rejected')`, undefined); - await queryRunner.query(`CREATE TABLE "relay" ("id" character varying(32) NOT NULL, "inbox" character varying(512) NOT NULL, "status" "relay_status_enum" NOT NULL, CONSTRAINT "PK_78ebc9cfddf4292633b7ba57aee" PRIMARY KEY ("id"))`, undefined); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_0d9a1738f2cf7f3b1c3334dfab" ON "relay" ("inbox") `, undefined); - } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "IDX_0d9a1738f2cf7f3b1c3334dfab"`, undefined); - await queryRunner.query(`DROP TABLE "relay"`, undefined); - await queryRunner.query(`DROP TYPE "relay_status_enum"`, undefined); - } + constructor() { + this.name = "pubRelay1589023282116"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE TYPE "relay_status_enum" AS ENUM('requesting', 'accepted', 'rejected')`, + undefined, + ); + await queryRunner.query( + `CREATE TABLE "relay" ("id" character varying(32) NOT NULL, "inbox" character varying(512) NOT NULL, "status" "relay_status_enum" NOT NULL, CONSTRAINT "PK_78ebc9cfddf4292633b7ba57aee" PRIMARY KEY ("id"))`, + undefined, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_0d9a1738f2cf7f3b1c3334dfab" ON "relay" ("inbox") `, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `DROP INDEX "IDX_0d9a1738f2cf7f3b1c3334dfab"`, + undefined, + ); + await queryRunner.query(`DROP TABLE "relay"`, undefined); + await queryRunner.query(`DROP TYPE "relay_status_enum"`, undefined); + } } diff --git a/packages/backend/migration/1595075960584-blurhash.js b/packages/backend/migration/1595075960584-blurhash.js index f24d3722c..50660cd05 100644 --- a/packages/backend/migration/1595075960584-blurhash.js +++ b/packages/backend/migration/1595075960584-blurhash.js @@ -1,13 +1,13 @@ - - export class blurhash1595075960584 { - constructor() { - this.name = 'blurhash1595075960584'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "drive_file" ADD "blurhash" character varying(128)`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "drive_file" DROP COLUMN "blurhash"`); - } + constructor() { + this.name = "blurhash1595075960584"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "drive_file" ADD "blurhash" character varying(128)`, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "drive_file" DROP COLUMN "blurhash"`); + } } diff --git a/packages/backend/migration/1595077605646-blurhash-for-avatar-banner.js b/packages/backend/migration/1595077605646-blurhash-for-avatar-banner.js index f18f6f972..612ab648c 100644 --- a/packages/backend/migration/1595077605646-blurhash-for-avatar-banner.js +++ b/packages/backend/migration/1595077605646-blurhash-for-avatar-banner.js @@ -1,19 +1,25 @@ - - export class blurhashForAvatarBanner1595077605646 { - constructor() { - this.name = 'blurhashForAvatarBanner1595077605646'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "avatarColor"`); - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "bannerColor"`); - await queryRunner.query(`ALTER TABLE "user" ADD "avatarBlurhash" character varying(128)`); - await queryRunner.query(`ALTER TABLE "user" ADD "bannerBlurhash" character varying(128)`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "bannerBlurhash"`); - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "avatarBlurhash"`); - await queryRunner.query(`ALTER TABLE "user" ADD "bannerColor" character varying(32)`); - await queryRunner.query(`ALTER TABLE "user" ADD "avatarColor" character varying(32)`); - } + constructor() { + this.name = "blurhashForAvatarBanner1595077605646"; + } + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "avatarColor"`); + await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "bannerColor"`); + await queryRunner.query( + `ALTER TABLE "user" ADD "avatarBlurhash" character varying(128)`, + ); + await queryRunner.query( + `ALTER TABLE "user" ADD "bannerBlurhash" character varying(128)`, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "bannerBlurhash"`); + await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "avatarBlurhash"`); + await queryRunner.query( + `ALTER TABLE "user" ADD "bannerColor" character varying(32)`, + ); + await queryRunner.query( + `ALTER TABLE "user" ADD "avatarColor" character varying(32)`, + ); + } } diff --git a/packages/backend/migration/1595676934834-instance-icon-url.js b/packages/backend/migration/1595676934834-instance-icon-url.js index df9d8199b..c228b14b6 100644 --- a/packages/backend/migration/1595676934834-instance-icon-url.js +++ b/packages/backend/migration/1595676934834-instance-icon-url.js @@ -1,13 +1,13 @@ - - export class instanceIconUrl1595676934834 { - constructor() { - this.name = 'instanceIconUrl1595676934834'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "instance" ADD "iconUrl" character varying(256) DEFAULT null`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "iconUrl"`); - } + constructor() { + this.name = "instanceIconUrl1595676934834"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "instance" ADD "iconUrl" character varying(256) DEFAULT null`, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "iconUrl"`); + } } diff --git a/packages/backend/migration/1595771249699-word-mute.js b/packages/backend/migration/1595771249699-word-mute.js index e8e4ac838..0a8a63294 100644 --- a/packages/backend/migration/1595771249699-word-mute.js +++ b/packages/backend/migration/1595771249699-word-mute.js @@ -1,29 +1,53 @@ - - export class wordMute1595771249699 { - constructor() { - this.name = 'wordMute1595771249699'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "muted_note" ("id" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, "userId" character varying(32) NOT NULL, CONSTRAINT "PK_897e2eff1c0b9b64e55ca1418a4" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_70ab9786313d78e4201d81cdb8" ON "muted_note" ("noteId") `); - await queryRunner.query(`CREATE INDEX "IDX_d8e07aa18c2d64e86201601aec" ON "muted_note" ("userId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_a8c6bfd637d3f1d67a27c48e27" ON "muted_note" ("noteId", "userId") `); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "enableWordMute" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "mutedWords" jsonb NOT NULL DEFAULT '[]'`); - await queryRunner.query(`CREATE INDEX "IDX_3befe6f999c86aff06eb0257b4" ON "user_profile" ("enableWordMute") `); - await queryRunner.query(`ALTER TABLE "muted_note" ADD CONSTRAINT "FK_70ab9786313d78e4201d81cdb89" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "muted_note" ADD CONSTRAINT "FK_d8e07aa18c2d64e86201601aec1" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "muted_note" DROP CONSTRAINT "FK_d8e07aa18c2d64e86201601aec1"`); - await queryRunner.query(`ALTER TABLE "muted_note" DROP CONSTRAINT "FK_70ab9786313d78e4201d81cdb89"`); - await queryRunner.query(`DROP INDEX "IDX_3befe6f999c86aff06eb0257b4"`); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "mutedWords"`); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "enableWordMute"`); - await queryRunner.query(`DROP INDEX "IDX_a8c6bfd637d3f1d67a27c48e27"`); - await queryRunner.query(`DROP INDEX "IDX_d8e07aa18c2d64e86201601aec"`); - await queryRunner.query(`DROP INDEX "IDX_70ab9786313d78e4201d81cdb8"`); - await queryRunner.query(`DROP TABLE "muted_note"`); - } + constructor() { + this.name = "wordMute1595771249699"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "muted_note" ("id" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, "userId" character varying(32) NOT NULL, CONSTRAINT "PK_897e2eff1c0b9b64e55ca1418a4" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_70ab9786313d78e4201d81cdb8" ON "muted_note" ("noteId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_d8e07aa18c2d64e86201601aec" ON "muted_note" ("userId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_a8c6bfd637d3f1d67a27c48e27" ON "muted_note" ("noteId", "userId") `, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "enableWordMute" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "mutedWords" jsonb NOT NULL DEFAULT '[]'`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_3befe6f999c86aff06eb0257b4" ON "user_profile" ("enableWordMute") `, + ); + await queryRunner.query( + `ALTER TABLE "muted_note" ADD CONSTRAINT "FK_70ab9786313d78e4201d81cdb89" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "muted_note" ADD CONSTRAINT "FK_d8e07aa18c2d64e86201601aec1" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "muted_note" DROP CONSTRAINT "FK_d8e07aa18c2d64e86201601aec1"`, + ); + await queryRunner.query( + `ALTER TABLE "muted_note" DROP CONSTRAINT "FK_70ab9786313d78e4201d81cdb89"`, + ); + await queryRunner.query(`DROP INDEX "IDX_3befe6f999c86aff06eb0257b4"`); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "mutedWords"`, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "enableWordMute"`, + ); + await queryRunner.query(`DROP INDEX "IDX_a8c6bfd637d3f1d67a27c48e27"`); + await queryRunner.query(`DROP INDEX "IDX_d8e07aa18c2d64e86201601aec"`); + await queryRunner.query(`DROP INDEX "IDX_70ab9786313d78e4201d81cdb8"`); + await queryRunner.query(`DROP TABLE "muted_note"`); + } } diff --git a/packages/backend/migration/1595782306083-word-mute2.js b/packages/backend/migration/1595782306083-word-mute2.js index ab1e40a04..61f06b347 100644 --- a/packages/backend/migration/1595782306083-word-mute2.js +++ b/packages/backend/migration/1595782306083-word-mute2.js @@ -1,17 +1,21 @@ - - export class wordMute21595782306083 { - constructor() { - this.name = 'wordMute21595782306083'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE TYPE "muted_note_reason_enum" AS ENUM('word', 'manual', 'spam', 'other')`); - await queryRunner.query(`ALTER TABLE "muted_note" ADD "reason" "muted_note_reason_enum" NOT NULL`); - await queryRunner.query(`CREATE INDEX "IDX_636e977ff90b23676fb5624b25" ON "muted_note" ("reason") `); - } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "IDX_636e977ff90b23676fb5624b25"`); - await queryRunner.query(`ALTER TABLE "muted_note" DROP COLUMN "reason"`); - await queryRunner.query(`DROP TYPE "muted_note_reason_enum"`); - } + constructor() { + this.name = "wordMute21595782306083"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE TYPE "muted_note_reason_enum" AS ENUM('word', 'manual', 'spam', 'other')`, + ); + await queryRunner.query( + `ALTER TABLE "muted_note" ADD "reason" "muted_note_reason_enum" NOT NULL`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_636e977ff90b23676fb5624b25" ON "muted_note" ("reason") `, + ); + } + async down(queryRunner) { + await queryRunner.query(`DROP INDEX "IDX_636e977ff90b23676fb5624b25"`); + await queryRunner.query(`ALTER TABLE "muted_note" DROP COLUMN "reason"`); + await queryRunner.query(`DROP TYPE "muted_note_reason_enum"`); + } } diff --git a/packages/backend/migration/1596548170836-channel.js b/packages/backend/migration/1596548170836-channel.js index 242db7d45..2aaaf9550 100644 --- a/packages/backend/migration/1596548170836-channel.js +++ b/packages/backend/migration/1596548170836-channel.js @@ -1,57 +1,115 @@ - - export class channel1596548170836 { - constructor() { - this.name = 'channel1596548170836'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "channel" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "lastNotedAt" TIMESTAMP WITH TIME ZONE, "userId" character varying(32) NOT NULL, "name" character varying(128) NOT NULL, "description" character varying(2048), "bannerId" character varying(32), "notesCount" integer NOT NULL DEFAULT 0, "usersCount" integer NOT NULL DEFAULT 0, CONSTRAINT "PK_590f33ee6ee7d76437acf362e39" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_71cb7b435b7c0d4843317e7e16" ON "channel" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_29ef80c6f13bcea998447fce43" ON "channel" ("lastNotedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_823bae55bd81b3be6e05cff438" ON "channel" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_0f58c11241e649d2a638a8de94" ON "channel" ("notesCount") `); - await queryRunner.query(`CREATE INDEX "IDX_094b86cd36bb805d1aa1e8cc9a" ON "channel" ("usersCount") `); - await queryRunner.query(`CREATE TABLE "channel_following" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "followeeId" character varying(32) NOT NULL, "followerId" character varying(32) NOT NULL, CONSTRAINT "PK_8b104be7f7415113f2a02cd5bdd" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_11e71f2511589dcc8a4d3214f9" ON "channel_following" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_0e43068c3f92cab197c3d3cd86" ON "channel_following" ("followeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_6d8084ec9496e7334a4602707e" ON "channel_following" ("followerId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_2e230dd45a10e671d781d99f3e" ON "channel_following" ("followerId", "followeeId") `); - await queryRunner.query(`CREATE TABLE "channel_note_pining" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "channelId" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, CONSTRAINT "PK_44f7474496bcf2e4b741681146d" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_8125f950afd3093acb10d2db8a" ON "channel_note_pining" ("channelId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_f36fed37d6d4cdcc68c803cd9c" ON "channel_note_pining" ("channelId", "noteId") `); - await queryRunner.query(`ALTER TABLE "note" ADD "channelId" character varying(32) DEFAULT null`); - await queryRunner.query(`CREATE INDEX "IDX_f22169eb10657bded6d875ac8f" ON "note" ("channelId") `); - await queryRunner.query(`ALTER TABLE "channel" ADD CONSTRAINT "FK_823bae55bd81b3be6e05cff4383" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "channel" ADD CONSTRAINT "FK_999da2bcc7efadbfe0e92d3bc19" FOREIGN KEY ("bannerId") REFERENCES "drive_file"("id") ON DELETE SET NULL ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "note" ADD CONSTRAINT "FK_f22169eb10657bded6d875ac8f9" FOREIGN KEY ("channelId") REFERENCES "channel"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "channel_following" ADD CONSTRAINT "FK_0e43068c3f92cab197c3d3cd86e" FOREIGN KEY ("followeeId") REFERENCES "channel"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "channel_following" ADD CONSTRAINT "FK_6d8084ec9496e7334a4602707e1" FOREIGN KEY ("followerId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "channel_note_pining" ADD CONSTRAINT "FK_8125f950afd3093acb10d2db8a8" FOREIGN KEY ("channelId") REFERENCES "channel"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "channel_note_pining" ADD CONSTRAINT "FK_10b19ef67d297ea9de325cd4502" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "channel_note_pining" DROP CONSTRAINT "FK_10b19ef67d297ea9de325cd4502"`); - await queryRunner.query(`ALTER TABLE "channel_note_pining" DROP CONSTRAINT "FK_8125f950afd3093acb10d2db8a8"`); - await queryRunner.query(`ALTER TABLE "channel_following" DROP CONSTRAINT "FK_6d8084ec9496e7334a4602707e1"`); - await queryRunner.query(`ALTER TABLE "channel_following" DROP CONSTRAINT "FK_0e43068c3f92cab197c3d3cd86e"`); - await queryRunner.query(`ALTER TABLE "note" DROP CONSTRAINT "FK_f22169eb10657bded6d875ac8f9"`); - await queryRunner.query(`ALTER TABLE "channel" DROP CONSTRAINT "FK_999da2bcc7efadbfe0e92d3bc19"`); - await queryRunner.query(`ALTER TABLE "channel" DROP CONSTRAINT "FK_823bae55bd81b3be6e05cff4383"`); - await queryRunner.query(`DROP INDEX "IDX_f22169eb10657bded6d875ac8f"`); - await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "channelId"`); - await queryRunner.query(`DROP INDEX "IDX_f36fed37d6d4cdcc68c803cd9c"`); - await queryRunner.query(`DROP INDEX "IDX_8125f950afd3093acb10d2db8a"`); - await queryRunner.query(`DROP TABLE "channel_note_pining"`); - await queryRunner.query(`DROP INDEX "IDX_2e230dd45a10e671d781d99f3e"`); - await queryRunner.query(`DROP INDEX "IDX_6d8084ec9496e7334a4602707e"`); - await queryRunner.query(`DROP INDEX "IDX_0e43068c3f92cab197c3d3cd86"`); - await queryRunner.query(`DROP INDEX "IDX_11e71f2511589dcc8a4d3214f9"`); - await queryRunner.query(`DROP TABLE "channel_following"`); - await queryRunner.query(`DROP INDEX "IDX_094b86cd36bb805d1aa1e8cc9a"`); - await queryRunner.query(`DROP INDEX "IDX_0f58c11241e649d2a638a8de94"`); - await queryRunner.query(`DROP INDEX "IDX_823bae55bd81b3be6e05cff438"`); - await queryRunner.query(`DROP INDEX "IDX_29ef80c6f13bcea998447fce43"`); - await queryRunner.query(`DROP INDEX "IDX_71cb7b435b7c0d4843317e7e16"`); - await queryRunner.query(`DROP TABLE "channel"`); - } + constructor() { + this.name = "channel1596548170836"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "channel" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "lastNotedAt" TIMESTAMP WITH TIME ZONE, "userId" character varying(32) NOT NULL, "name" character varying(128) NOT NULL, "description" character varying(2048), "bannerId" character varying(32), "notesCount" integer NOT NULL DEFAULT 0, "usersCount" integer NOT NULL DEFAULT 0, CONSTRAINT "PK_590f33ee6ee7d76437acf362e39" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_71cb7b435b7c0d4843317e7e16" ON "channel" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_29ef80c6f13bcea998447fce43" ON "channel" ("lastNotedAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_823bae55bd81b3be6e05cff438" ON "channel" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0f58c11241e649d2a638a8de94" ON "channel" ("notesCount") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_094b86cd36bb805d1aa1e8cc9a" ON "channel" ("usersCount") `, + ); + await queryRunner.query( + `CREATE TABLE "channel_following" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "followeeId" character varying(32) NOT NULL, "followerId" character varying(32) NOT NULL, CONSTRAINT "PK_8b104be7f7415113f2a02cd5bdd" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_11e71f2511589dcc8a4d3214f9" ON "channel_following" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0e43068c3f92cab197c3d3cd86" ON "channel_following" ("followeeId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_6d8084ec9496e7334a4602707e" ON "channel_following" ("followerId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_2e230dd45a10e671d781d99f3e" ON "channel_following" ("followerId", "followeeId") `, + ); + await queryRunner.query( + `CREATE TABLE "channel_note_pining" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "channelId" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, CONSTRAINT "PK_44f7474496bcf2e4b741681146d" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_8125f950afd3093acb10d2db8a" ON "channel_note_pining" ("channelId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_f36fed37d6d4cdcc68c803cd9c" ON "channel_note_pining" ("channelId", "noteId") `, + ); + await queryRunner.query( + `ALTER TABLE "note" ADD "channelId" character varying(32) DEFAULT null`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f22169eb10657bded6d875ac8f" ON "note" ("channelId") `, + ); + await queryRunner.query( + `ALTER TABLE "channel" ADD CONSTRAINT "FK_823bae55bd81b3be6e05cff4383" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "channel" ADD CONSTRAINT "FK_999da2bcc7efadbfe0e92d3bc19" FOREIGN KEY ("bannerId") REFERENCES "drive_file"("id") ON DELETE SET NULL ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "note" ADD CONSTRAINT "FK_f22169eb10657bded6d875ac8f9" FOREIGN KEY ("channelId") REFERENCES "channel"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "channel_following" ADD CONSTRAINT "FK_0e43068c3f92cab197c3d3cd86e" FOREIGN KEY ("followeeId") REFERENCES "channel"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "channel_following" ADD CONSTRAINT "FK_6d8084ec9496e7334a4602707e1" FOREIGN KEY ("followerId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "channel_note_pining" ADD CONSTRAINT "FK_8125f950afd3093acb10d2db8a8" FOREIGN KEY ("channelId") REFERENCES "channel"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "channel_note_pining" ADD CONSTRAINT "FK_10b19ef67d297ea9de325cd4502" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "channel_note_pining" DROP CONSTRAINT "FK_10b19ef67d297ea9de325cd4502"`, + ); + await queryRunner.query( + `ALTER TABLE "channel_note_pining" DROP CONSTRAINT "FK_8125f950afd3093acb10d2db8a8"`, + ); + await queryRunner.query( + `ALTER TABLE "channel_following" DROP CONSTRAINT "FK_6d8084ec9496e7334a4602707e1"`, + ); + await queryRunner.query( + `ALTER TABLE "channel_following" DROP CONSTRAINT "FK_0e43068c3f92cab197c3d3cd86e"`, + ); + await queryRunner.query( + `ALTER TABLE "note" DROP CONSTRAINT "FK_f22169eb10657bded6d875ac8f9"`, + ); + await queryRunner.query( + `ALTER TABLE "channel" DROP CONSTRAINT "FK_999da2bcc7efadbfe0e92d3bc19"`, + ); + await queryRunner.query( + `ALTER TABLE "channel" DROP CONSTRAINT "FK_823bae55bd81b3be6e05cff4383"`, + ); + await queryRunner.query(`DROP INDEX "IDX_f22169eb10657bded6d875ac8f"`); + await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "channelId"`); + await queryRunner.query(`DROP INDEX "IDX_f36fed37d6d4cdcc68c803cd9c"`); + await queryRunner.query(`DROP INDEX "IDX_8125f950afd3093acb10d2db8a"`); + await queryRunner.query(`DROP TABLE "channel_note_pining"`); + await queryRunner.query(`DROP INDEX "IDX_2e230dd45a10e671d781d99f3e"`); + await queryRunner.query(`DROP INDEX "IDX_6d8084ec9496e7334a4602707e"`); + await queryRunner.query(`DROP INDEX "IDX_0e43068c3f92cab197c3d3cd86"`); + await queryRunner.query(`DROP INDEX "IDX_11e71f2511589dcc8a4d3214f9"`); + await queryRunner.query(`DROP TABLE "channel_following"`); + await queryRunner.query(`DROP INDEX "IDX_094b86cd36bb805d1aa1e8cc9a"`); + await queryRunner.query(`DROP INDEX "IDX_0f58c11241e649d2a638a8de94"`); + await queryRunner.query(`DROP INDEX "IDX_823bae55bd81b3be6e05cff438"`); + await queryRunner.query(`DROP INDEX "IDX_29ef80c6f13bcea998447fce43"`); + await queryRunner.query(`DROP INDEX "IDX_71cb7b435b7c0d4843317e7e16"`); + await queryRunner.query(`DROP TABLE "channel"`); + } } diff --git a/packages/backend/migration/1596786425167-channel2.js b/packages/backend/migration/1596786425167-channel2.js index 4b17048fe..ae871f5ff 100644 --- a/packages/backend/migration/1596786425167-channel2.js +++ b/packages/backend/migration/1596786425167-channel2.js @@ -1,13 +1,15 @@ - - export class channel21596786425167 { - constructor() { - this.name = 'channel21596786425167'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "channel_following" ADD "readCursor" TIMESTAMP WITH TIME ZONE NOT NULL`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "channel_following" DROP COLUMN "readCursor"`); - } + constructor() { + this.name = "channel21596786425167"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "channel_following" ADD "readCursor" TIMESTAMP WITH TIME ZONE NOT NULL`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "channel_following" DROP COLUMN "readCursor"`, + ); + } } diff --git a/packages/backend/migration/1597230137744-objectStorageSetPublicRead.js b/packages/backend/migration/1597230137744-objectStorageSetPublicRead.js index 07283e31d..81540d5e8 100644 --- a/packages/backend/migration/1597230137744-objectStorageSetPublicRead.js +++ b/packages/backend/migration/1597230137744-objectStorageSetPublicRead.js @@ -1,13 +1,15 @@ - - export class objectStorageSetPublicRead1597230137744 { - constructor() { - this.name = 'objectStorageSetPublicRead1597230137744'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "objectStorageSetPublicRead" boolean NOT NULL DEFAULT false`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "objectStorageSetPublicRead"`); - } + constructor() { + this.name = "objectStorageSetPublicRead1597230137744"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "objectStorageSetPublicRead" boolean NOT NULL DEFAULT false`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "objectStorageSetPublicRead"`, + ); + } } diff --git a/packages/backend/migration/1597236229720-IncludingNotificationTypes.js b/packages/backend/migration/1597236229720-IncludingNotificationTypes.js index f498fa7d9..ce02148d2 100644 --- a/packages/backend/migration/1597236229720-IncludingNotificationTypes.js +++ b/packages/backend/migration/1597236229720-IncludingNotificationTypes.js @@ -1,15 +1,21 @@ - - export class IncludingNotificationTypes1597236229720 { - constructor() { - this.name = 'IncludingNotificationTypes1597236229720'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE TYPE "user_profile_includingnotificationtypes_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "includingNotificationTypes" "user_profile_includingnotificationtypes_enum" array`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "includingNotificationTypes"`); - await queryRunner.query(`DROP TYPE "user_profile_includingnotificationtypes_enum"`); - } + constructor() { + this.name = "IncludingNotificationTypes1597236229720"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE TYPE "user_profile_includingnotificationtypes_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "includingNotificationTypes" "user_profile_includingnotificationtypes_enum" array`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "includingNotificationTypes"`, + ); + await queryRunner.query( + `DROP TYPE "user_profile_includingnotificationtypes_enum"`, + ); + } } diff --git a/packages/backend/migration/1597385880794-add-sensitive-index.js b/packages/backend/migration/1597385880794-add-sensitive-index.js index 8c5c040ba..d7c818bbf 100644 --- a/packages/backend/migration/1597385880794-add-sensitive-index.js +++ b/packages/backend/migration/1597385880794-add-sensitive-index.js @@ -1,13 +1,13 @@ - - export class addSensitiveIndex1597385880794 { - constructor() { - this.name = 'addSensitiveIndex1597385880794'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE INDEX "IDX_a7eba67f8b3fa27271e85d2e26" ON "drive_file" ("isSensitive") `); - } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "IDX_a7eba67f8b3fa27271e85d2e26"`); - } + constructor() { + this.name = "addSensitiveIndex1597385880794"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE INDEX "IDX_a7eba67f8b3fa27271e85d2e26" ON "drive_file" ("isSensitive") `, + ); + } + async down(queryRunner) { + await queryRunner.query(`DROP INDEX "IDX_a7eba67f8b3fa27271e85d2e26"`); + } } diff --git a/packages/backend/migration/1597459042300-channel-unread.js b/packages/backend/migration/1597459042300-channel-unread.js index 3157ab779..4975a84f9 100644 --- a/packages/backend/migration/1597459042300-channel-unread.js +++ b/packages/backend/migration/1597459042300-channel-unread.js @@ -1,26 +1,44 @@ - - export class channelUnread1597459042300 { - constructor() { - this.name = 'channelUnread1597459042300'; - } - async up(queryRunner) { - await queryRunner.query(`TRUNCATE TABLE "note_unread"`, undefined); - await queryRunner.query(`ALTER TABLE "channel_following" DROP COLUMN "readCursor"`); - await queryRunner.query(`ALTER TABLE "note_unread" ADD "isMentioned" boolean NOT NULL`); - await queryRunner.query(`ALTER TABLE "note_unread" ADD "noteChannelId" character varying(32)`); - await queryRunner.query(`CREATE INDEX "IDX_25b1dd384bec391b07b74b861c" ON "note_unread" ("isMentioned") `); - await queryRunner.query(`CREATE INDEX "IDX_89a29c9237b8c3b6b3cbb4cb30" ON "note_unread" ("isSpecified") `); - await queryRunner.query(`CREATE INDEX "IDX_29e8c1d579af54d4232939f994" ON "note_unread" ("noteUserId") `); - await queryRunner.query(`CREATE INDEX "IDX_6a57f051d82c6d4036c141e107" ON "note_unread" ("noteChannelId") `); - } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "IDX_6a57f051d82c6d4036c141e107"`); - await queryRunner.query(`DROP INDEX "IDX_29e8c1d579af54d4232939f994"`); - await queryRunner.query(`DROP INDEX "IDX_89a29c9237b8c3b6b3cbb4cb30"`); - await queryRunner.query(`DROP INDEX "IDX_25b1dd384bec391b07b74b861c"`); - await queryRunner.query(`ALTER TABLE "note_unread" DROP COLUMN "noteChannelId"`); - await queryRunner.query(`ALTER TABLE "note_unread" DROP COLUMN "isMentioned"`); - await queryRunner.query(`ALTER TABLE "channel_following" ADD "readCursor" TIMESTAMP WITH TIME ZONE NOT NULL`); - } + constructor() { + this.name = "channelUnread1597459042300"; + } + async up(queryRunner) { + await queryRunner.query(`TRUNCATE TABLE "note_unread"`, undefined); + await queryRunner.query( + `ALTER TABLE "channel_following" DROP COLUMN "readCursor"`, + ); + await queryRunner.query( + `ALTER TABLE "note_unread" ADD "isMentioned" boolean NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "note_unread" ADD "noteChannelId" character varying(32)`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_25b1dd384bec391b07b74b861c" ON "note_unread" ("isMentioned") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_89a29c9237b8c3b6b3cbb4cb30" ON "note_unread" ("isSpecified") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_29e8c1d579af54d4232939f994" ON "note_unread" ("noteUserId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_6a57f051d82c6d4036c141e107" ON "note_unread" ("noteChannelId") `, + ); + } + async down(queryRunner) { + await queryRunner.query(`DROP INDEX "IDX_6a57f051d82c6d4036c141e107"`); + await queryRunner.query(`DROP INDEX "IDX_29e8c1d579af54d4232939f994"`); + await queryRunner.query(`DROP INDEX "IDX_89a29c9237b8c3b6b3cbb4cb30"`); + await queryRunner.query(`DROP INDEX "IDX_25b1dd384bec391b07b74b861c"`); + await queryRunner.query( + `ALTER TABLE "note_unread" DROP COLUMN "noteChannelId"`, + ); + await queryRunner.query( + `ALTER TABLE "note_unread" DROP COLUMN "isMentioned"`, + ); + await queryRunner.query( + `ALTER TABLE "channel_following" ADD "readCursor" TIMESTAMP WITH TIME ZONE NOT NULL`, + ); + } } diff --git a/packages/backend/migration/1597893996136-ChannelNoteIdDescIndex.js b/packages/backend/migration/1597893996136-ChannelNoteIdDescIndex.js index 2bd8aee35..5a31d51e8 100644 --- a/packages/backend/migration/1597893996136-ChannelNoteIdDescIndex.js +++ b/packages/backend/migration/1597893996136-ChannelNoteIdDescIndex.js @@ -1,15 +1,17 @@ - - export class ChannelNoteIdDescIndex1597893996136 { - constructor() { - this.name = 'ChannelNoteIdDescIndex1597893996136'; - } - async up(queryRunner) { - await queryRunner.query(`DROP INDEX "IDX_f22169eb10657bded6d875ac8f"`); - await queryRunner.query(`CREATE INDEX "IDX_note_on_channelId_and_id_desc" ON "note" ("channelId", "id" desc)`); - } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "IDX_note_on_channelId_and_id_desc"`); - await queryRunner.query(`CREATE INDEX "IDX_f22169eb10657bded6d875ac8f" ON "note" ("channelId") `); - } + constructor() { + this.name = "ChannelNoteIdDescIndex1597893996136"; + } + async up(queryRunner) { + await queryRunner.query(`DROP INDEX "IDX_f22169eb10657bded6d875ac8f"`); + await queryRunner.query( + `CREATE INDEX "IDX_note_on_channelId_and_id_desc" ON "note" ("channelId", "id" desc)`, + ); + } + async down(queryRunner) { + await queryRunner.query(`DROP INDEX "IDX_note_on_channelId_and_id_desc"`); + await queryRunner.query( + `CREATE INDEX "IDX_f22169eb10657bded6d875ac8f" ON "note" ("channelId") `, + ); + } } diff --git a/packages/backend/migration/1600353287890-mutingNotificationTypes.js b/packages/backend/migration/1600353287890-mutingNotificationTypes.js index ed3eb7d14..2a317b3f9 100644 --- a/packages/backend/migration/1600353287890-mutingNotificationTypes.js +++ b/packages/backend/migration/1600353287890-mutingNotificationTypes.js @@ -1,19 +1,33 @@ - - export class mutingNotificationTypes1600353287890 { - constructor() { - this.name = 'mutingNotificationTypes1600353287890'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "includingNotificationTypes"`); - await queryRunner.query(`DROP TYPE "public"."user_profile_includingnotificationtypes_enum"`); - await queryRunner.query(`CREATE TYPE "user_profile_mutingnotificationtypes_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "mutingNotificationTypes" "user_profile_mutingnotificationtypes_enum" array NOT NULL DEFAULT '{}'`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "mutingNotificationTypes"`); - await queryRunner.query(`DROP TYPE "user_profile_mutingnotificationtypes_enum"`); - await queryRunner.query(`CREATE TYPE "public"."user_profile_includingnotificationtypes_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "includingNotificationTypes" "user_profile_includingnotificationtypes_enum" array`); - } + constructor() { + this.name = "mutingNotificationTypes1600353287890"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "includingNotificationTypes"`, + ); + await queryRunner.query( + `DROP TYPE "public"."user_profile_includingnotificationtypes_enum"`, + ); + await queryRunner.query( + `CREATE TYPE "user_profile_mutingnotificationtypes_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "mutingNotificationTypes" "user_profile_mutingnotificationtypes_enum" array NOT NULL DEFAULT '{}'`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "mutingNotificationTypes"`, + ); + await queryRunner.query( + `DROP TYPE "user_profile_mutingnotificationtypes_enum"`, + ); + await queryRunner.query( + `CREATE TYPE "public"."user_profile_includingnotificationtypes_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "includingNotificationTypes" "user_profile_includingnotificationtypes_enum" array`, + ); + } } diff --git a/packages/backend/migration/1603094348345-refine-abuse-user-report.js b/packages/backend/migration/1603094348345-refine-abuse-user-report.js index 4918032a2..1aaf2685e 100644 --- a/packages/backend/migration/1603094348345-refine-abuse-user-report.js +++ b/packages/backend/migration/1603094348345-refine-abuse-user-report.js @@ -1,31 +1,63 @@ - - export class refineAbuseUserReport1603094348345 { - constructor() { - this.name = 'refineAbuseUserReport1603094348345'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "abuse_user_report" DROP CONSTRAINT "FK_d049123c413e68ca52abe734203"`); - await queryRunner.query(`DROP INDEX "IDX_d049123c413e68ca52abe73420"`); - await queryRunner.query(`DROP INDEX "IDX_5cd442c3b2e74fdd99dae20243"`); - await queryRunner.query(`ALTER TABLE "abuse_user_report" RENAME COLUMN "userId" TO "targetUserId"`); - await queryRunner.query(`ALTER TABLE "abuse_user_report" ADD "assigneeId" character varying(32)`); - await queryRunner.query(`ALTER TABLE "abuse_user_report" ADD "resolved" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`ALTER TABLE "abuse_user_report" DROP COLUMN "comment"`); - await queryRunner.query(`ALTER TABLE "abuse_user_report" ADD "comment" character varying(2048) NOT NULL DEFAULT '{}'::varchar[]`); - await queryRunner.query(`CREATE INDEX "IDX_2b15aaf4a0dc5be3499af7ab6a" ON "abuse_user_report" ("resolved") `); - await queryRunner.query(`ALTER TABLE "abuse_user_report" ADD CONSTRAINT "FK_08b883dd5fdd6f9c4c1572b36de" FOREIGN KEY ("assigneeId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE NO ACTION`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "abuse_user_report" DROP CONSTRAINT "FK_08b883dd5fdd6f9c4c1572b36de"`); - await queryRunner.query(`DROP INDEX "IDX_2b15aaf4a0dc5be3499af7ab6a"`); - await queryRunner.query(`ALTER TABLE "abuse_user_report" DROP COLUMN "comment"`); - await queryRunner.query(`ALTER TABLE "abuse_user_report" ADD "comment" character varying(512) NOT NULL DEFAULT '{}'::varchar[]`); - await queryRunner.query(`ALTER TABLE "abuse_user_report" DROP COLUMN "resolved"`); - await queryRunner.query(`ALTER TABLE "abuse_user_report" DROP COLUMN "assigneeId"`); - await queryRunner.query(`ALTER TABLE "abuse_user_report" RENAME COLUMN "targetUserId" TO "userId"`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_5cd442c3b2e74fdd99dae20243" ON "abuse_user_report" ("userId", "reporterId") `); - await queryRunner.query(`CREATE INDEX "IDX_d049123c413e68ca52abe73420" ON "abuse_user_report" ("userId") `); - await queryRunner.query(`ALTER TABLE "abuse_user_report" ADD CONSTRAINT "FK_d049123c413e68ca52abe734203" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - } + constructor() { + this.name = "refineAbuseUserReport1603094348345"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "abuse_user_report" DROP CONSTRAINT "FK_d049123c413e68ca52abe734203"`, + ); + await queryRunner.query(`DROP INDEX "IDX_d049123c413e68ca52abe73420"`); + await queryRunner.query(`DROP INDEX "IDX_5cd442c3b2e74fdd99dae20243"`); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" RENAME COLUMN "userId" TO "targetUserId"`, + ); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" ADD "assigneeId" character varying(32)`, + ); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" ADD "resolved" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" DROP COLUMN "comment"`, + ); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" ADD "comment" character varying(2048) NOT NULL DEFAULT '{}'::varchar[]`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_2b15aaf4a0dc5be3499af7ab6a" ON "abuse_user_report" ("resolved") `, + ); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" ADD CONSTRAINT "FK_08b883dd5fdd6f9c4c1572b36de" FOREIGN KEY ("assigneeId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE NO ACTION`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "abuse_user_report" DROP CONSTRAINT "FK_08b883dd5fdd6f9c4c1572b36de"`, + ); + await queryRunner.query(`DROP INDEX "IDX_2b15aaf4a0dc5be3499af7ab6a"`); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" DROP COLUMN "comment"`, + ); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" ADD "comment" character varying(512) NOT NULL DEFAULT '{}'::varchar[]`, + ); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" DROP COLUMN "resolved"`, + ); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" DROP COLUMN "assigneeId"`, + ); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" RENAME COLUMN "targetUserId" TO "userId"`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_5cd442c3b2e74fdd99dae20243" ON "abuse_user_report" ("userId", "reporterId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_d049123c413e68ca52abe73420" ON "abuse_user_report" ("userId") `, + ); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" ADD CONSTRAINT "FK_d049123c413e68ca52abe734203" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } } diff --git a/packages/backend/migration/1603095701770-refine-abuse-user-report2.js b/packages/backend/migration/1603095701770-refine-abuse-user-report2.js index 64e92672f..301a8e538 100644 --- a/packages/backend/migration/1603095701770-refine-abuse-user-report2.js +++ b/packages/backend/migration/1603095701770-refine-abuse-user-report2.js @@ -1,19 +1,29 @@ - - export class refineAbuseUserReport21603095701770 { - constructor() { - this.name = 'refineAbuseUserReport21603095701770'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "abuse_user_report" ADD "targetUserHost" character varying(128)`); - await queryRunner.query(`ALTER TABLE "abuse_user_report" ADD "reporterHost" character varying(128)`); - await queryRunner.query(`CREATE INDEX "IDX_4ebbf7f93cdc10e8d1ef2fc6cd" ON "abuse_user_report" ("targetUserHost") `); - await queryRunner.query(`CREATE INDEX "IDX_f8d8b93740ad12c4ce8213a199" ON "abuse_user_report" ("reporterHost") `); - } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "IDX_f8d8b93740ad12c4ce8213a199"`); - await queryRunner.query(`DROP INDEX "IDX_4ebbf7f93cdc10e8d1ef2fc6cd"`); - await queryRunner.query(`ALTER TABLE "abuse_user_report" DROP COLUMN "reporterHost"`); - await queryRunner.query(`ALTER TABLE "abuse_user_report" DROP COLUMN "targetUserHost"`); - } + constructor() { + this.name = "refineAbuseUserReport21603095701770"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "abuse_user_report" ADD "targetUserHost" character varying(128)`, + ); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" ADD "reporterHost" character varying(128)`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_4ebbf7f93cdc10e8d1ef2fc6cd" ON "abuse_user_report" ("targetUserHost") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f8d8b93740ad12c4ce8213a199" ON "abuse_user_report" ("reporterHost") `, + ); + } + async down(queryRunner) { + await queryRunner.query(`DROP INDEX "IDX_f8d8b93740ad12c4ce8213a199"`); + await queryRunner.query(`DROP INDEX "IDX_4ebbf7f93cdc10e8d1ef2fc6cd"`); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" DROP COLUMN "reporterHost"`, + ); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" DROP COLUMN "targetUserHost"`, + ); + } } diff --git a/packages/backend/migration/1603776877564-instance-theme-color.js b/packages/backend/migration/1603776877564-instance-theme-color.js index 92440d3f6..9bb3d65c0 100644 --- a/packages/backend/migration/1603776877564-instance-theme-color.js +++ b/packages/backend/migration/1603776877564-instance-theme-color.js @@ -1,13 +1,13 @@ - - export class instanceThemeColor1603776877564 { - constructor() { - this.name = 'instanceThemeColor1603776877564'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "instance" ADD "themeColor" character varying(64) DEFAULT null`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "themeColor"`); - } + constructor() { + this.name = "instanceThemeColor1603776877564"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "instance" ADD "themeColor" character varying(64) DEFAULT null`, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "themeColor"`); + } } diff --git a/packages/backend/migration/1603781553011-instance-favicon.js b/packages/backend/migration/1603781553011-instance-favicon.js index f607c49ff..4b2442692 100644 --- a/packages/backend/migration/1603781553011-instance-favicon.js +++ b/packages/backend/migration/1603781553011-instance-favicon.js @@ -1,13 +1,13 @@ - - export class instanceFavicon1603781553011 { - constructor() { - this.name = 'instanceFavicon1603781553011'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "instance" ADD "faviconUrl" character varying(256) DEFAULT null`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "faviconUrl"`); - } + constructor() { + this.name = "instanceFavicon1603781553011"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "instance" ADD "faviconUrl" character varying(256) DEFAULT null`, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "faviconUrl"`); + } } diff --git a/packages/backend/migration/1604821689616-delete-auto-watch.js b/packages/backend/migration/1604821689616-delete-auto-watch.js index 4706e8bae..6a8333ce1 100644 --- a/packages/backend/migration/1604821689616-delete-auto-watch.js +++ b/packages/backend/migration/1604821689616-delete-auto-watch.js @@ -1,13 +1,15 @@ - - export class deleteAutoWatch1604821689616 { - constructor() { - this.name = 'deleteAutoWatch1604821689616'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "autoWatch"`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" ADD "autoWatch" boolean NOT NULL DEFAULT false`); - } + constructor() { + this.name = "deleteAutoWatch1604821689616"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "autoWatch"`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "autoWatch" boolean NOT NULL DEFAULT false`, + ); + } } diff --git a/packages/backend/migration/1605408848373-clip-description.js b/packages/backend/migration/1605408848373-clip-description.js index edd5505b3..99cda6534 100644 --- a/packages/backend/migration/1605408848373-clip-description.js +++ b/packages/backend/migration/1605408848373-clip-description.js @@ -1,13 +1,13 @@ - - export class clipDescription1605408848373 { - constructor() { - this.name = 'clipDescription1605408848373'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "clip" ADD "description" character varying(2048) DEFAULT null`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "clip" DROP COLUMN "description"`); - } + constructor() { + this.name = "clipDescription1605408848373"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "clip" ADD "description" character varying(2048) DEFAULT null`, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "clip" DROP COLUMN "description"`); + } } diff --git a/packages/backend/migration/1605408971051-comments.js b/packages/backend/migration/1605408971051-comments.js index 400efd5e7..363fec5cd 100644 --- a/packages/backend/migration/1605408971051-comments.js +++ b/packages/backend/migration/1605408971051-comments.js @@ -1,433 +1,1067 @@ - - export class comments1605408971051 { - constructor() { - this.name = 'comments1605408971051'; - } - async up(queryRunner) { - await queryRunner.query(`COMMENT ON COLUMN "log"."createdAt" IS 'The created date of the Log.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_folder"."createdAt" IS 'The created date of the DriveFolder.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_folder"."name" IS 'The name of the DriveFolder.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_folder"."userId" IS 'The owner ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_folder"."parentId" IS 'The parent folder ID. If null, it means the DriveFolder is located in root.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."createdAt" IS 'The created date of the DriveFile.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."userId" IS 'The owner ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."userHost" IS 'The host of owner. It will be null if the user in local.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."md5" IS 'The MD5 hash of the DriveFile.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."name" IS 'The file name of the DriveFile.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."type" IS 'The content type (MIME) of the DriveFile.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."size" IS 'The file size (bytes) of the DriveFile.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."comment" IS 'The comment of the DriveFile.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."blurhash" IS 'The BlurHash string.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."properties" IS 'The any properties of the DriveFile. For example, it includes image width/height.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."url" IS 'The URL of the DriveFile.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."thumbnailUrl" IS 'The URL of the thumbnail of the DriveFile.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."webpublicUrl" IS 'The URL of the webpublic of the DriveFile.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."uri" IS 'The URI of the DriveFile. it will be null when the DriveFile is local.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."folderId" IS 'The parent folder ID. If null, it means the DriveFile is located in root.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."isSensitive" IS 'Whether the DriveFile is NSFW.'`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."isLink" IS 'Whether the DriveFile is direct link to remote server.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."createdAt" IS 'The created date of the User.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."updatedAt" IS 'The updated date of the User.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."username" IS 'The username of the User.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."usernameLower" IS 'The username (lowercased) of the User.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."name" IS 'The name of the User.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."followersCount" IS 'The count of followers.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."followingCount" IS 'The count of following.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."notesCount" IS 'The count of notes.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."avatarId" IS 'The ID of avatar DriveFile.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."bannerId" IS 'The ID of banner DriveFile.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."isSuspended" IS 'Whether the User is suspended.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."isSilenced" IS 'Whether the User is silenced.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."isLocked" IS 'Whether the User is locked.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."isBot" IS 'Whether the User is a bot.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."isCat" IS 'Whether the User is a cat.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."isAdmin" IS 'Whether the User is the admin.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."isModerator" IS 'Whether the User is a moderator.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."host" IS 'The host of the User. It will be null if the origin of the user is local.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."inbox" IS 'The inbox URL of the User. It will be null if the origin of the user is local.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."sharedInbox" IS 'The sharedInbox URL of the User. It will be null if the origin of the user is local.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."featured" IS 'The featured URL of the User. It will be null if the origin of the user is local.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."uri" IS 'The URI of the User. It will be null if the origin of the user is local.'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."token" IS 'The native access token of the User. It will be null if the origin of the user is local.'`); - await queryRunner.query(`COMMENT ON COLUMN "app"."createdAt" IS 'The created date of the App.'`); - await queryRunner.query(`COMMENT ON COLUMN "app"."userId" IS 'The owner ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "app"."secret" IS 'The secret key of the App.'`); - await queryRunner.query(`COMMENT ON COLUMN "app"."name" IS 'The name of the App.'`); - await queryRunner.query(`COMMENT ON COLUMN "app"."description" IS 'The description of the App.'`); - await queryRunner.query(`COMMENT ON COLUMN "app"."permission" IS 'The permission of the App.'`); - await queryRunner.query(`COMMENT ON COLUMN "app"."callbackUrl" IS 'The callbackUrl of the App.'`); - await queryRunner.query(`COMMENT ON COLUMN "access_token"."createdAt" IS 'The created date of the AccessToken.'`); - await queryRunner.query(`COMMENT ON COLUMN "access_token"."lastUsedAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "access_token"."session" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "access_token"."appId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "access_token"."name" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "access_token"."description" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "access_token"."iconUrl" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "channel"."createdAt" IS 'The created date of the Channel.'`); - await queryRunner.query(`COMMENT ON COLUMN "channel"."userId" IS 'The owner ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "channel"."name" IS 'The name of the Channel.'`); - await queryRunner.query(`COMMENT ON COLUMN "channel"."description" IS 'The description of the Channel.'`); - await queryRunner.query(`COMMENT ON COLUMN "channel"."bannerId" IS 'The ID of banner Channel.'`); - await queryRunner.query(`COMMENT ON COLUMN "channel"."notesCount" IS 'The count of notes.'`); - await queryRunner.query(`COMMENT ON COLUMN "channel"."usersCount" IS 'The count of users.'`); - await queryRunner.query(`COMMENT ON COLUMN "note"."createdAt" IS 'The created date of the Note.'`); - await queryRunner.query(`COMMENT ON COLUMN "note"."replyId" IS 'The ID of reply target.'`); - await queryRunner.query(`COMMENT ON COLUMN "note"."renoteId" IS 'The ID of renote target.'`); - await queryRunner.query(`COMMENT ON COLUMN "note"."userId" IS 'The ID of author.'`); - await queryRunner.query(`COMMENT ON COLUMN "note"."uri" IS 'The URI of a note. it will be null when the note is local.'`); - await queryRunner.query(`COMMENT ON COLUMN "note"."url" IS 'The human readable url of a note. it will be null when the note is local.'`); - await queryRunner.query(`COMMENT ON COLUMN "note"."channelId" IS 'The ID of source channel.'`); - await queryRunner.query(`COMMENT ON COLUMN "note"."userHost" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "note"."replyUserId" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "note"."replyUserHost" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "note"."renoteUserId" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "note"."renoteUserHost" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "poll_vote"."createdAt" IS 'The created date of the PollVote.'`); - await queryRunner.query(`COMMENT ON COLUMN "note_reaction"."createdAt" IS 'The created date of the NoteReaction.'`); - await queryRunner.query(`COMMENT ON COLUMN "note_watching"."createdAt" IS 'The created date of the NoteWatching.'`); - await queryRunner.query(`COMMENT ON COLUMN "note_watching"."userId" IS 'The watcher ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "note_watching"."noteId" IS 'The target Note ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "note_watching"."noteUserId" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "note_unread"."noteUserId" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "note_unread"."noteChannelId" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."createdAt" IS 'The created date of the FollowRequest.'`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."followeeId" IS 'The followee user ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."followerId" IS 'The follower user ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."requestId" IS 'id of Follow Activity.'`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."followerHost" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."followerInbox" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."followerSharedInbox" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."followeeHost" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."followeeInbox" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."followeeSharedInbox" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "user_group"."createdAt" IS 'The created date of the UserGroup.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_group"."userId" IS 'The ID of owner.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_group_invitation"."createdAt" IS 'The created date of the UserGroupInvitation.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_group_invitation"."userId" IS 'The user ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_group_invitation"."userGroupId" IS 'The group ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "notification"."createdAt" IS 'The created date of the Notification.'`); - await queryRunner.query(`COMMENT ON COLUMN "notification"."notifieeId" IS 'The ID of recipient user of the Notification.'`); - await queryRunner.query(`COMMENT ON COLUMN "notification"."isRead" IS 'Whether the Notification is read.'`); - await queryRunner.query(`COMMENT ON COLUMN "meta"."localDriveCapacityMb" IS 'Drive capacity of a local user (MB)'`); - await queryRunner.query(`COMMENT ON COLUMN "meta"."remoteDriveCapacityMb" IS 'Drive capacity of a remote user (MB)'`); - await queryRunner.query(`COMMENT ON COLUMN "meta"."maxNoteTextLength" IS 'Max allowed note text length in characters'`); - await queryRunner.query(`COMMENT ON COLUMN "following"."createdAt" IS 'The created date of the Following.'`); - await queryRunner.query(`COMMENT ON COLUMN "following"."followeeId" IS 'The followee user ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "following"."followerId" IS 'The follower user ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "following"."followerHost" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "following"."followerInbox" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "following"."followerSharedInbox" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "following"."followeeHost" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "following"."followeeInbox" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "following"."followeeSharedInbox" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."caughtAt" IS 'The caught date of the Instance.'`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."host" IS 'The host of the Instance.'`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."usersCount" IS 'The count of the users of the Instance.'`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."notesCount" IS 'The count of the notes of the Instance.'`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."softwareName" IS 'The software of the Instance.'`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."softwareVersion" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."openRegistrations" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."name" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."description" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."maintainerName" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."maintainerEmail" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."iconUrl" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."faviconUrl" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."themeColor" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "muting"."createdAt" IS 'The created date of the Muting.'`); - await queryRunner.query(`COMMENT ON COLUMN "muting"."muteeId" IS 'The mutee user ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "muting"."muterId" IS 'The muter user ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "blocking"."createdAt" IS 'The created date of the Blocking.'`); - await queryRunner.query(`COMMENT ON COLUMN "blocking"."blockeeId" IS 'The blockee user ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "blocking"."blockerId" IS 'The blocker user ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_list"."createdAt" IS 'The created date of the UserList.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_list"."userId" IS 'The owner ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_list"."name" IS 'The name of the UserList.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_list_joining"."createdAt" IS 'The created date of the UserListJoining.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_list_joining"."userId" IS 'The user ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_list_joining"."userListId" IS 'The list ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_group_joining"."createdAt" IS 'The created date of the UserGroupJoining.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_group_joining"."userId" IS 'The user ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_group_joining"."userGroupId" IS 'The group ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "note_favorite"."createdAt" IS 'The created date of the NoteFavorite.'`); - await queryRunner.query(`COMMENT ON COLUMN "abuse_user_report"."createdAt" IS 'The created date of the AbuseUserReport.'`); - await queryRunner.query(`COMMENT ON COLUMN "abuse_user_report"."targetUserHost" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "abuse_user_report"."reporterHost" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "messaging_message"."createdAt" IS 'The created date of the MessagingMessage.'`); - await queryRunner.query(`COMMENT ON COLUMN "messaging_message"."userId" IS 'The sender user ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "messaging_message"."groupId" IS 'The recipient group ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "signin"."createdAt" IS 'The created date of the Signin.'`); - await queryRunner.query(`COMMENT ON COLUMN "auth_session"."createdAt" IS 'The created date of the AuthSession.'`); - await queryRunner.query(`COMMENT ON COLUMN "reversi_game"."createdAt" IS 'The created date of the ReversiGame.'`); - await queryRunner.query(`COMMENT ON COLUMN "reversi_game"."startedAt" IS 'The started date of the ReversiGame.'`); - await queryRunner.query(`COMMENT ON COLUMN "reversi_game"."form1" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "reversi_game"."form2" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "reversi_matching"."createdAt" IS 'The created date of the ReversiMatching.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_note_pining"."createdAt" IS 'The created date of the UserNotePinings.'`); - await queryRunner.query(`COMMENT ON COLUMN "poll"."noteId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "poll"."noteVisibility" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "poll"."userId" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "poll"."userHost" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "user_keypair"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_publickey"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "page"."createdAt" IS 'The created date of the Page.'`); - await queryRunner.query(`COMMENT ON COLUMN "page"."updatedAt" IS 'The updated date of the Page.'`); - await queryRunner.query(`COMMENT ON COLUMN "page"."userId" IS 'The ID of author.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."location" IS 'The location of the User.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."birthday" IS 'The birthday (YYYY-MM-DD) of the User.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."description" IS 'The description (bio) of the User.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."url" IS 'Remote URL of the user.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."email" IS 'The email address of the User.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."password" IS 'The password hash of the User. It will be null if the origin of the user is local.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."clientData" IS 'The client-specific data of the User.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."room" IS 'The room data of the User.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."userHost" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "user_security_key"."id" IS 'Variable-length id given to navigator.credentials.get()'`); - await queryRunner.query(`COMMENT ON COLUMN "user_security_key"."publicKey" IS 'Variable-length public key used to verify attestations (hex-encoded).'`); - await queryRunner.query(`COMMENT ON COLUMN "user_security_key"."lastUsed" IS 'The date of the last time the UserSecurityKey was successfully validated.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_security_key"."name" IS 'User-defined name for this key'`); - await queryRunner.query(`COMMENT ON COLUMN "attestation_challenge"."challenge" IS 'Hex-encoded sha256 hash of the challenge.'`); - await queryRunner.query(`COMMENT ON COLUMN "attestation_challenge"."createdAt" IS 'The date challenge was created for expiry purposes.'`); - await queryRunner.query(`COMMENT ON COLUMN "attestation_challenge"."registrationChallenge" IS 'Indicates that the challenge is only for registration purposes if true to prevent the challenge for being used as authentication.'`); - await queryRunner.query(`COMMENT ON COLUMN "moderation_log"."createdAt" IS 'The created date of the ModerationLog.'`); - await queryRunner.query(`COMMENT ON COLUMN "announcement"."createdAt" IS 'The created date of the Announcement.'`); - await queryRunner.query(`COMMENT ON COLUMN "announcement"."updatedAt" IS 'The updated date of the Announcement.'`); - await queryRunner.query(`COMMENT ON COLUMN "announcement_read"."createdAt" IS 'The created date of the AnnouncementRead.'`); - await queryRunner.query(`COMMENT ON COLUMN "clip"."createdAt" IS 'The created date of the Clip.'`); - await queryRunner.query(`COMMENT ON COLUMN "clip"."userId" IS 'The owner ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "clip"."name" IS 'The name of the Clip.'`); - await queryRunner.query(`COMMENT ON COLUMN "clip"."description" IS 'The description of the Clip.'`); - await queryRunner.query(`COMMENT ON COLUMN "clip_note"."noteId" IS 'The note ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "clip_note"."clipId" IS 'The clip ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "antenna"."createdAt" IS 'The created date of the Antenna.'`); - await queryRunner.query(`COMMENT ON COLUMN "antenna"."userId" IS 'The owner ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "antenna"."name" IS 'The name of the Antenna.'`); - await queryRunner.query(`COMMENT ON COLUMN "antenna_note"."noteId" IS 'The note ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "antenna_note"."antennaId" IS 'The antenna ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "promo_note"."noteId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "promo_note"."userId" IS '[Denormalized]'`); - await queryRunner.query(`COMMENT ON COLUMN "promo_read"."createdAt" IS 'The created date of the PromoRead.'`); - await queryRunner.query(`COMMENT ON COLUMN "muted_note"."noteId" IS 'The note ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "muted_note"."userId" IS 'The user ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "muted_note"."reason" IS 'The reason of the MutedNote.'`); - await queryRunner.query(`COMMENT ON COLUMN "channel_following"."createdAt" IS 'The created date of the ChannelFollowing.'`); - await queryRunner.query(`COMMENT ON COLUMN "channel_following"."followeeId" IS 'The followee channel ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "channel_following"."followerId" IS 'The follower user ID.'`); - await queryRunner.query(`COMMENT ON COLUMN "channel_note_pining"."createdAt" IS 'The created date of the ChannelNotePining.'`); - } - async down(queryRunner) { - await queryRunner.query(`COMMENT ON COLUMN "channel_note_pining"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "channel_following"."followerId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "channel_following"."followeeId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "channel_following"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "muted_note"."reason" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "muted_note"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "muted_note"."noteId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "promo_read"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "promo_note"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "promo_note"."noteId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "antenna_note"."antennaId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "antenna_note"."noteId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "antenna"."name" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "antenna"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "antenna"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "clip_note"."clipId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "clip_note"."noteId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "clip"."description" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "clip"."name" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "clip"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "clip"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "announcement_read"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "announcement"."updatedAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "announcement"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "moderation_log"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "attestation_challenge"."registrationChallenge" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "attestation_challenge"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "attestation_challenge"."challenge" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_security_key"."name" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_security_key"."lastUsed" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_security_key"."publicKey" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_security_key"."id" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."userHost" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."room" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."clientData" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."password" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."email" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."url" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."description" IS 'The description (bio) of the User.'`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."birthday" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."location" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "page"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "page"."updatedAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "page"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_publickey"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_keypair"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "poll"."userHost" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "poll"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "poll"."noteVisibility" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "poll"."noteId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_note_pining"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "reversi_matching"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "reversi_game"."form2" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "reversi_game"."form1" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "reversi_game"."startedAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "reversi_game"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "auth_session"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "signin"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "messaging_message"."groupId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "messaging_message"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "messaging_message"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "abuse_user_report"."reporterHost" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "abuse_user_report"."targetUserHost" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "abuse_user_report"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note_favorite"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_group_joining"."userGroupId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_group_joining"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_group_joining"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_list_joining"."userListId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_list_joining"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_list_joining"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_list"."name" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_list"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_list"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "blocking"."blockerId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "blocking"."blockeeId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "blocking"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "muting"."muterId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "muting"."muteeId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "muting"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."themeColor" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."faviconUrl" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."iconUrl" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."maintainerEmail" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."maintainerName" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."description" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."name" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."openRegistrations" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."softwareVersion" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."softwareName" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."notesCount" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."usersCount" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."host" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "instance"."caughtAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "following"."followeeSharedInbox" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "following"."followeeInbox" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "following"."followeeHost" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "following"."followerSharedInbox" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "following"."followerInbox" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "following"."followerHost" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "following"."followerId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "following"."followeeId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "following"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "meta"."maxNoteTextLength" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "meta"."remoteDriveCapacityMb" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "meta"."localDriveCapacityMb" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "notification"."isRead" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "notification"."notifieeId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "notification"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_group_invitation"."userGroupId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_group_invitation"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_group_invitation"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_group"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user_group"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."followeeSharedInbox" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."followeeInbox" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."followeeHost" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."followerSharedInbox" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."followerInbox" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."followerHost" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."requestId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."followerId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."followeeId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "follow_request"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note_unread"."noteChannelId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note_unread"."noteUserId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note_watching"."noteUserId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note_watching"."noteId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note_watching"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note_watching"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note_reaction"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "poll_vote"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note"."renoteUserHost" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note"."renoteUserId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note"."replyUserHost" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note"."replyUserId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note"."userHost" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note"."channelId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note"."url" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note"."uri" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note"."renoteId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note"."replyId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "note"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "channel"."usersCount" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "channel"."notesCount" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "channel"."bannerId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "channel"."description" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "channel"."name" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "channel"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "channel"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "access_token"."iconUrl" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "access_token"."description" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "access_token"."name" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "access_token"."appId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "access_token"."session" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "access_token"."lastUsedAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "access_token"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "app"."callbackUrl" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "app"."permission" IS 'The permission of the App.'`); - await queryRunner.query(`COMMENT ON COLUMN "app"."description" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "app"."name" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "app"."secret" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "app"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "app"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."token" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."uri" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."featured" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."sharedInbox" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."inbox" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."host" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."isModerator" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."isAdmin" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."isCat" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."isBot" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."isLocked" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."isSilenced" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."isSuspended" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."bannerId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."avatarId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."notesCount" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."followingCount" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."followersCount" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."name" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."usernameLower" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."username" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."updatedAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."isLink" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."isSensitive" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."folderId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."uri" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."webpublicUrl" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."thumbnailUrl" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."url" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."properties" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."blurhash" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."comment" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."size" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."type" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."name" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."md5" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."userHost" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_folder"."parentId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_folder"."userId" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_folder"."name" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "drive_folder"."createdAt" IS NULL`); - await queryRunner.query(`COMMENT ON COLUMN "log"."createdAt" IS NULL`); - } + constructor() { + this.name = "comments1605408971051"; + } + async up(queryRunner) { + await queryRunner.query( + `COMMENT ON COLUMN "log"."createdAt" IS 'The created date of the Log.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_folder"."createdAt" IS 'The created date of the DriveFolder.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_folder"."name" IS 'The name of the DriveFolder.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_folder"."userId" IS 'The owner ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_folder"."parentId" IS 'The parent folder ID. If null, it means the DriveFolder is located in root.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."createdAt" IS 'The created date of the DriveFile.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."userId" IS 'The owner ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."userHost" IS 'The host of owner. It will be null if the user in local.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."md5" IS 'The MD5 hash of the DriveFile.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."name" IS 'The file name of the DriveFile.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."type" IS 'The content type (MIME) of the DriveFile.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."size" IS 'The file size (bytes) of the DriveFile.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."comment" IS 'The comment of the DriveFile.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."blurhash" IS 'The BlurHash string.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."properties" IS 'The any properties of the DriveFile. For example, it includes image width/height.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."url" IS 'The URL of the DriveFile.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."thumbnailUrl" IS 'The URL of the thumbnail of the DriveFile.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."webpublicUrl" IS 'The URL of the webpublic of the DriveFile.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."uri" IS 'The URI of the DriveFile. it will be null when the DriveFile is local.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."folderId" IS 'The parent folder ID. If null, it means the DriveFile is located in root.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."isSensitive" IS 'Whether the DriveFile is NSFW.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."isLink" IS 'Whether the DriveFile is direct link to remote server.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."createdAt" IS 'The created date of the User.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."updatedAt" IS 'The updated date of the User.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."username" IS 'The username of the User.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."usernameLower" IS 'The username (lowercased) of the User.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."name" IS 'The name of the User.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."followersCount" IS 'The count of followers.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."followingCount" IS 'The count of following.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."notesCount" IS 'The count of notes.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."avatarId" IS 'The ID of avatar DriveFile.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."bannerId" IS 'The ID of banner DriveFile.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."isSuspended" IS 'Whether the User is suspended.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."isSilenced" IS 'Whether the User is silenced.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."isLocked" IS 'Whether the User is locked.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."isBot" IS 'Whether the User is a bot.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."isCat" IS 'Whether the User is a cat.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."isAdmin" IS 'Whether the User is the admin.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."isModerator" IS 'Whether the User is a moderator.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."host" IS 'The host of the User. It will be null if the origin of the user is local.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."inbox" IS 'The inbox URL of the User. It will be null if the origin of the user is local.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."sharedInbox" IS 'The sharedInbox URL of the User. It will be null if the origin of the user is local.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."featured" IS 'The featured URL of the User. It will be null if the origin of the user is local.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."uri" IS 'The URI of the User. It will be null if the origin of the user is local.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."token" IS 'The native access token of the User. It will be null if the origin of the user is local.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "app"."createdAt" IS 'The created date of the App.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "app"."userId" IS 'The owner ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "app"."secret" IS 'The secret key of the App.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "app"."name" IS 'The name of the App.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "app"."description" IS 'The description of the App.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "app"."permission" IS 'The permission of the App.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "app"."callbackUrl" IS 'The callbackUrl of the App.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "access_token"."createdAt" IS 'The created date of the AccessToken.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "access_token"."lastUsedAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "access_token"."session" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "access_token"."appId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "access_token"."name" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "access_token"."description" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "access_token"."iconUrl" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "channel"."createdAt" IS 'The created date of the Channel.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "channel"."userId" IS 'The owner ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "channel"."name" IS 'The name of the Channel.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "channel"."description" IS 'The description of the Channel.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "channel"."bannerId" IS 'The ID of banner Channel.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "channel"."notesCount" IS 'The count of notes.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "channel"."usersCount" IS 'The count of users.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note"."createdAt" IS 'The created date of the Note.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note"."replyId" IS 'The ID of reply target.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note"."renoteId" IS 'The ID of renote target.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note"."userId" IS 'The ID of author.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note"."uri" IS 'The URI of a note. it will be null when the note is local.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note"."url" IS 'The human readable url of a note. it will be null when the note is local.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note"."channelId" IS 'The ID of source channel.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note"."userHost" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note"."replyUserId" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note"."replyUserHost" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note"."renoteUserId" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note"."renoteUserHost" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "poll_vote"."createdAt" IS 'The created date of the PollVote.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note_reaction"."createdAt" IS 'The created date of the NoteReaction.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note_watching"."createdAt" IS 'The created date of the NoteWatching.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note_watching"."userId" IS 'The watcher ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note_watching"."noteId" IS 'The target Note ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note_watching"."noteUserId" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note_unread"."noteUserId" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note_unread"."noteChannelId" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."createdAt" IS 'The created date of the FollowRequest.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."followeeId" IS 'The followee user ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."followerId" IS 'The follower user ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."requestId" IS 'id of Follow Activity.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."followerHost" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."followerInbox" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."followerSharedInbox" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."followeeHost" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."followeeInbox" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."followeeSharedInbox" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_group"."createdAt" IS 'The created date of the UserGroup.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_group"."userId" IS 'The ID of owner.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_group_invitation"."createdAt" IS 'The created date of the UserGroupInvitation.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_group_invitation"."userId" IS 'The user ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_group_invitation"."userGroupId" IS 'The group ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "notification"."createdAt" IS 'The created date of the Notification.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "notification"."notifieeId" IS 'The ID of recipient user of the Notification.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "notification"."isRead" IS 'Whether the Notification is read.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "meta"."localDriveCapacityMb" IS 'Drive capacity of a local user (MB)'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "meta"."remoteDriveCapacityMb" IS 'Drive capacity of a remote user (MB)'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "meta"."maxNoteTextLength" IS 'Max allowed note text length in characters'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "following"."createdAt" IS 'The created date of the Following.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "following"."followeeId" IS 'The followee user ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "following"."followerId" IS 'The follower user ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "following"."followerHost" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "following"."followerInbox" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "following"."followerSharedInbox" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "following"."followeeHost" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "following"."followeeInbox" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "following"."followeeSharedInbox" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."caughtAt" IS 'The caught date of the Instance.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."host" IS 'The host of the Instance.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."usersCount" IS 'The count of the users of the Instance.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."notesCount" IS 'The count of the notes of the Instance.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."softwareName" IS 'The software of the Instance.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."softwareVersion" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."openRegistrations" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "instance"."name" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."description" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."maintainerName" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."maintainerEmail" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "instance"."iconUrl" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."faviconUrl" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."themeColor" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "muting"."createdAt" IS 'The created date of the Muting.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "muting"."muteeId" IS 'The mutee user ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "muting"."muterId" IS 'The muter user ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "blocking"."createdAt" IS 'The created date of the Blocking.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "blocking"."blockeeId" IS 'The blockee user ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "blocking"."blockerId" IS 'The blocker user ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_list"."createdAt" IS 'The created date of the UserList.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_list"."userId" IS 'The owner ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_list"."name" IS 'The name of the UserList.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_list_joining"."createdAt" IS 'The created date of the UserListJoining.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_list_joining"."userId" IS 'The user ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_list_joining"."userListId" IS 'The list ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_group_joining"."createdAt" IS 'The created date of the UserGroupJoining.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_group_joining"."userId" IS 'The user ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_group_joining"."userGroupId" IS 'The group ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note_favorite"."createdAt" IS 'The created date of the NoteFavorite.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "abuse_user_report"."createdAt" IS 'The created date of the AbuseUserReport.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "abuse_user_report"."targetUserHost" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "abuse_user_report"."reporterHost" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "messaging_message"."createdAt" IS 'The created date of the MessagingMessage.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "messaging_message"."userId" IS 'The sender user ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "messaging_message"."groupId" IS 'The recipient group ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "signin"."createdAt" IS 'The created date of the Signin.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "auth_session"."createdAt" IS 'The created date of the AuthSession.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "reversi_game"."createdAt" IS 'The created date of the ReversiGame.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "reversi_game"."startedAt" IS 'The started date of the ReversiGame.'`, + ); + await queryRunner.query(`COMMENT ON COLUMN "reversi_game"."form1" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "reversi_game"."form2" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "reversi_matching"."createdAt" IS 'The created date of the ReversiMatching.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_note_pining"."createdAt" IS 'The created date of the UserNotePinings.'`, + ); + await queryRunner.query(`COMMENT ON COLUMN "poll"."noteId" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "poll"."noteVisibility" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "poll"."userId" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "poll"."userHost" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_keypair"."userId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_publickey"."userId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "page"."createdAt" IS 'The created date of the Page.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "page"."updatedAt" IS 'The updated date of the Page.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "page"."userId" IS 'The ID of author.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."userId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."location" IS 'The location of the User.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."birthday" IS 'The birthday (YYYY-MM-DD) of the User.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."description" IS 'The description (bio) of the User.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."url" IS 'Remote URL of the user.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."email" IS 'The email address of the User.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."password" IS 'The password hash of the User. It will be null if the origin of the user is local.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."clientData" IS 'The client-specific data of the User.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."room" IS 'The room data of the User.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."userHost" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_security_key"."id" IS 'Variable-length id given to navigator.credentials.get()'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_security_key"."publicKey" IS 'Variable-length public key used to verify attestations (hex-encoded).'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_security_key"."lastUsed" IS 'The date of the last time the UserSecurityKey was successfully validated.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_security_key"."name" IS 'User-defined name for this key'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "attestation_challenge"."challenge" IS 'Hex-encoded sha256 hash of the challenge.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "attestation_challenge"."createdAt" IS 'The date challenge was created for expiry purposes.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "attestation_challenge"."registrationChallenge" IS 'Indicates that the challenge is only for registration purposes if true to prevent the challenge for being used as authentication.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "moderation_log"."createdAt" IS 'The created date of the ModerationLog.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "announcement"."createdAt" IS 'The created date of the Announcement.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "announcement"."updatedAt" IS 'The updated date of the Announcement.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "announcement_read"."createdAt" IS 'The created date of the AnnouncementRead.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "clip"."createdAt" IS 'The created date of the Clip.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "clip"."userId" IS 'The owner ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "clip"."name" IS 'The name of the Clip.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "clip"."description" IS 'The description of the Clip.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "clip_note"."noteId" IS 'The note ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "clip_note"."clipId" IS 'The clip ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "antenna"."createdAt" IS 'The created date of the Antenna.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "antenna"."userId" IS 'The owner ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "antenna"."name" IS 'The name of the Antenna.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "antenna_note"."noteId" IS 'The note ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "antenna_note"."antennaId" IS 'The antenna ID.'`, + ); + await queryRunner.query(`COMMENT ON COLUMN "promo_note"."noteId" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "promo_note"."userId" IS '[Denormalized]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "promo_read"."createdAt" IS 'The created date of the PromoRead.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "muted_note"."noteId" IS 'The note ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "muted_note"."userId" IS 'The user ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "muted_note"."reason" IS 'The reason of the MutedNote.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "channel_following"."createdAt" IS 'The created date of the ChannelFollowing.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "channel_following"."followeeId" IS 'The followee channel ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "channel_following"."followerId" IS 'The follower user ID.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "channel_note_pining"."createdAt" IS 'The created date of the ChannelNotePining.'`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `COMMENT ON COLUMN "channel_note_pining"."createdAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "channel_following"."followerId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "channel_following"."followeeId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "channel_following"."createdAt" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "muted_note"."reason" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "muted_note"."userId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "muted_note"."noteId" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "promo_read"."createdAt" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "promo_note"."userId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "promo_note"."noteId" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "antenna_note"."antennaId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "antenna_note"."noteId" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "antenna"."name" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "antenna"."userId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "antenna"."createdAt" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "clip_note"."clipId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "clip_note"."noteId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "clip"."description" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "clip"."name" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "clip"."userId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "clip"."createdAt" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "announcement_read"."createdAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "announcement"."updatedAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "announcement"."createdAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "moderation_log"."createdAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "attestation_challenge"."registrationChallenge" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "attestation_challenge"."createdAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "attestation_challenge"."challenge" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_security_key"."name" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_security_key"."lastUsed" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_security_key"."publicKey" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_security_key"."id" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."userHost" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "user_profile"."room" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."clientData" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."password" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "user_profile"."email" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user_profile"."url" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."description" IS 'The description (bio) of the User.'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."birthday" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."location" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."userId" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "page"."userId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "page"."updatedAt" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "page"."createdAt" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "user_publickey"."userId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_keypair"."userId" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "poll"."userHost" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "poll"."userId" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "poll"."noteVisibility" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "poll"."noteId" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "user_note_pining"."createdAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "reversi_matching"."createdAt" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "reversi_game"."form2" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "reversi_game"."form1" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "reversi_game"."startedAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "reversi_game"."createdAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "auth_session"."createdAt" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "signin"."createdAt" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "messaging_message"."groupId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "messaging_message"."userId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "messaging_message"."createdAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "abuse_user_report"."reporterHost" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "abuse_user_report"."targetUserHost" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "abuse_user_report"."createdAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note_favorite"."createdAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_group_joining"."userGroupId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_group_joining"."userId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_group_joining"."createdAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_list_joining"."userListId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_list_joining"."userId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_list_joining"."createdAt" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "user_list"."name" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user_list"."userId" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "user_list"."createdAt" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "blocking"."blockerId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "blocking"."blockeeId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "blocking"."createdAt" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "muting"."muterId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "muting"."muteeId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "muting"."createdAt" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."themeColor" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."faviconUrl" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "instance"."iconUrl" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."maintainerEmail" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."maintainerName" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."description" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "instance"."name" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."openRegistrations" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."softwareVersion" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."softwareName" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."notesCount" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "instance"."usersCount" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "instance"."host" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "instance"."caughtAt" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "following"."followeeSharedInbox" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "following"."followeeInbox" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "following"."followeeHost" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "following"."followerSharedInbox" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "following"."followerInbox" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "following"."followerHost" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "following"."followerId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "following"."followeeId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "following"."createdAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "meta"."maxNoteTextLength" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "meta"."remoteDriveCapacityMb" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "meta"."localDriveCapacityMb" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "notification"."isRead" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "notification"."notifieeId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "notification"."createdAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_group_invitation"."userGroupId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_group_invitation"."userId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_group_invitation"."createdAt" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "user_group"."userId" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "user_group"."createdAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."followeeSharedInbox" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."followeeInbox" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."followeeHost" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."followerSharedInbox" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."followerInbox" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."followerHost" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."requestId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."followerId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."followeeId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "follow_request"."createdAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note_unread"."noteChannelId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note_unread"."noteUserId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note_watching"."noteUserId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note_watching"."noteId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note_watching"."userId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note_watching"."createdAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note_reaction"."createdAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "poll_vote"."createdAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "note"."renoteUserHost" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "note"."renoteUserId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "note"."replyUserHost" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "note"."replyUserId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "note"."userHost" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "note"."channelId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "note"."url" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "note"."uri" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "note"."userId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "note"."renoteId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "note"."replyId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "note"."createdAt" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "channel"."usersCount" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "channel"."notesCount" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "channel"."bannerId" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "channel"."description" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "channel"."name" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "channel"."userId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "channel"."createdAt" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "access_token"."iconUrl" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "access_token"."description" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "access_token"."name" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "access_token"."appId" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "access_token"."session" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "access_token"."lastUsedAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "access_token"."createdAt" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "app"."callbackUrl" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "app"."permission" IS 'The permission of the App.'`, + ); + await queryRunner.query(`COMMENT ON COLUMN "app"."description" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "app"."name" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "app"."secret" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "app"."userId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "app"."createdAt" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."token" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."uri" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."featured" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."sharedInbox" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."inbox" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."host" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."isModerator" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."isAdmin" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."isCat" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."isBot" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."isLocked" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."isSilenced" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."isSuspended" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."bannerId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."avatarId" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."notesCount" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "user"."followingCount" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."followersCount" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "user"."name" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."usernameLower" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."username" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."updatedAt" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "user"."createdAt" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "drive_file"."isLink" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."isSensitive" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."folderId" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "drive_file"."uri" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."webpublicUrl" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."thumbnailUrl" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "drive_file"."url" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."properties" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."blurhash" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "drive_file"."comment" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "drive_file"."size" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "drive_file"."type" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "drive_file"."name" IS NULL`); + await queryRunner.query(`COMMENT ON COLUMN "drive_file"."md5" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."userHost" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "drive_file"."userId" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."createdAt" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_folder"."parentId" IS NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_folder"."userId" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "drive_folder"."name" IS NULL`); + await queryRunner.query( + `COMMENT ON COLUMN "drive_folder"."createdAt" IS NULL`, + ); + await queryRunner.query(`COMMENT ON COLUMN "log"."createdAt" IS NULL`); + } } diff --git a/packages/backend/migration/1605585339718-instance-pinned-pages.js b/packages/backend/migration/1605585339718-instance-pinned-pages.js index 56ccd44c8..09e161764 100644 --- a/packages/backend/migration/1605585339718-instance-pinned-pages.js +++ b/packages/backend/migration/1605585339718-instance-pinned-pages.js @@ -1,13 +1,13 @@ - - export class instancePinnedPages1605585339718 { - constructor() { - this.name = 'instancePinnedPages1605585339718'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "pinnedPages" character varying(512) array NOT NULL DEFAULT '{"/featured", "/channels", "/explore", "/pages", "/about-misskey"}'::varchar[]`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "pinnedPages"`); - } + constructor() { + this.name = "instancePinnedPages1605585339718"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "pinnedPages" character varying(512) array NOT NULL DEFAULT '{"/featured", "/channels", "/explore", "/pages", "/about-misskey"}'::varchar[]`, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "pinnedPages"`); + } } diff --git a/packages/backend/migration/1605965516823-instance-images.js b/packages/backend/migration/1605965516823-instance-images.js index 710c75981..ed9a26a65 100644 --- a/packages/backend/migration/1605965516823-instance-images.js +++ b/packages/backend/migration/1605965516823-instance-images.js @@ -1,15 +1,19 @@ - - export class instanceImages1605965516823 { - constructor() { - this.name = 'instanceImages1605965516823'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "backgroundImageUrl" character varying(512)`); - await queryRunner.query(`ALTER TABLE "meta" ADD "logoImageUrl" character varying(512)`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "logoImageUrl"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "backgroundImageUrl"`); - } + constructor() { + this.name = "instanceImages1605965516823"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "backgroundImageUrl" character varying(512)`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "logoImageUrl" character varying(512)`, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "logoImageUrl"`); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "backgroundImageUrl"`, + ); + } } diff --git a/packages/backend/migration/1606191203881-no-crawle.js b/packages/backend/migration/1606191203881-no-crawle.js index b9ada4354..4e7e82277 100644 --- a/packages/backend/migration/1606191203881-no-crawle.js +++ b/packages/backend/migration/1606191203881-no-crawle.js @@ -1,15 +1,21 @@ - - export class noCrawle1606191203881 { - constructor() { - this.name = 'noCrawle1606191203881'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" ADD "noCrawle" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."noCrawle" IS 'Whether reject index by crawler.'`); - } - async down(queryRunner) { - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."noCrawle" IS 'Whether reject index by crawler.'`); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "noCrawle"`); - } + constructor() { + this.name = "noCrawle1606191203881"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "noCrawle" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."noCrawle" IS 'Whether reject index by crawler.'`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."noCrawle" IS 'Whether reject index by crawler.'`, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "noCrawle"`, + ); + } } diff --git a/packages/backend/migration/1607151207216-instance-pinned-clip.js b/packages/backend/migration/1607151207216-instance-pinned-clip.js index 9a4195e74..655b4c7fb 100644 --- a/packages/backend/migration/1607151207216-instance-pinned-clip.js +++ b/packages/backend/migration/1607151207216-instance-pinned-clip.js @@ -1,13 +1,13 @@ - - export class instancePinnedClip1607151207216 { - constructor() { - this.name = 'instancePinnedClip1607151207216'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "pinnedClipId" character varying(32)`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "pinnedClipId"`); - } + constructor() { + this.name = "instancePinnedClip1607151207216"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "pinnedClipId" character varying(32)`, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "pinnedClipId"`); + } } diff --git a/packages/backend/migration/1607353487793-isExplorable.js b/packages/backend/migration/1607353487793-isExplorable.js index d9f1ff4c6..d654ee121 100644 --- a/packages/backend/migration/1607353487793-isExplorable.js +++ b/packages/backend/migration/1607353487793-isExplorable.js @@ -1,17 +1,23 @@ - - export class isExplorable1607353487793 { - constructor() { - this.name = 'isExplorable1607353487793'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user" ADD "isExplorable" boolean NOT NULL DEFAULT true`); - await queryRunner.query(`COMMENT ON COLUMN "user"."isExplorable" IS 'Whether the User is explorable.'`); - await queryRunner.query(`CREATE INDEX "IDX_d5a1b83c7cab66f167e6888188" ON "user" ("isExplorable") `); - } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "IDX_d5a1b83c7cab66f167e6888188"`); - await queryRunner.query(`COMMENT ON COLUMN "user"."isExplorable" IS 'Whether the User is explorable.'`); - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "isExplorable"`); - } + constructor() { + this.name = "isExplorable1607353487793"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user" ADD "isExplorable" boolean NOT NULL DEFAULT true`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."isExplorable" IS 'Whether the User is explorable.'`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_d5a1b83c7cab66f167e6888188" ON "user" ("isExplorable") `, + ); + } + async down(queryRunner) { + await queryRunner.query(`DROP INDEX "IDX_d5a1b83c7cab66f167e6888188"`); + await queryRunner.query( + `COMMENT ON COLUMN "user"."isExplorable" IS 'Whether the User is explorable.'`, + ); + await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "isExplorable"`); + } } diff --git a/packages/backend/migration/1610277136869-registry.js b/packages/backend/migration/1610277136869-registry.js index 184c062dd..023519302 100644 --- a/packages/backend/migration/1610277136869-registry.js +++ b/packages/backend/migration/1610277136869-registry.js @@ -1,21 +1,31 @@ - - export class registry1610277136869 { - constructor() { - this.name = 'registry1610277136869'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "registry_item" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "key" character varying(1024) NOT NULL, "scope" character varying(1024) array NOT NULL DEFAULT '{}'::varchar[], "domain" character varying(512), CONSTRAINT "PK_64b3f7e6008b4d89b826cd3af95" PRIMARY KEY ("id")); COMMENT ON COLUMN "registry_item"."createdAt" IS 'The created date of the RegistryItem.'; COMMENT ON COLUMN "registry_item"."updatedAt" IS 'The updated date of the RegistryItem.'; COMMENT ON COLUMN "registry_item"."userId" IS 'The owner ID.'; COMMENT ON COLUMN "registry_item"."key" IS 'The key of the RegistryItem.'`); - await queryRunner.query(`CREATE INDEX "IDX_fb9d21ba0abb83223263df6bcb" ON "registry_item" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_22baca135bb8a3ea1a83d13df3" ON "registry_item" ("scope") `); - await queryRunner.query(`CREATE INDEX "IDX_0a72bdfcdb97c0eca11fe7ecad" ON "registry_item" ("domain") `); - await queryRunner.query(`ALTER TABLE "registry_item" ADD CONSTRAINT "FK_fb9d21ba0abb83223263df6bcb3" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "registry_item" DROP CONSTRAINT "FK_fb9d21ba0abb83223263df6bcb3"`); - await queryRunner.query(`DROP INDEX "IDX_0a72bdfcdb97c0eca11fe7ecad"`); - await queryRunner.query(`DROP INDEX "IDX_22baca135bb8a3ea1a83d13df3"`); - await queryRunner.query(`DROP INDEX "IDX_fb9d21ba0abb83223263df6bcb"`); - await queryRunner.query(`DROP TABLE "registry_item"`); - } + constructor() { + this.name = "registry1610277136869"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "registry_item" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "key" character varying(1024) NOT NULL, "scope" character varying(1024) array NOT NULL DEFAULT '{}'::varchar[], "domain" character varying(512), CONSTRAINT "PK_64b3f7e6008b4d89b826cd3af95" PRIMARY KEY ("id")); COMMENT ON COLUMN "registry_item"."createdAt" IS 'The created date of the RegistryItem.'; COMMENT ON COLUMN "registry_item"."updatedAt" IS 'The updated date of the RegistryItem.'; COMMENT ON COLUMN "registry_item"."userId" IS 'The owner ID.'; COMMENT ON COLUMN "registry_item"."key" IS 'The key of the RegistryItem.'`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_fb9d21ba0abb83223263df6bcb" ON "registry_item" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_22baca135bb8a3ea1a83d13df3" ON "registry_item" ("scope") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0a72bdfcdb97c0eca11fe7ecad" ON "registry_item" ("domain") `, + ); + await queryRunner.query( + `ALTER TABLE "registry_item" ADD CONSTRAINT "FK_fb9d21ba0abb83223263df6bcb3" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "registry_item" DROP CONSTRAINT "FK_fb9d21ba0abb83223263df6bcb3"`, + ); + await queryRunner.query(`DROP INDEX "IDX_0a72bdfcdb97c0eca11fe7ecad"`); + await queryRunner.query(`DROP INDEX "IDX_22baca135bb8a3ea1a83d13df3"`); + await queryRunner.query(`DROP INDEX "IDX_fb9d21ba0abb83223263df6bcb"`); + await queryRunner.query(`DROP TABLE "registry_item"`); + } } diff --git a/packages/backend/migration/1610277585759-registry2.js b/packages/backend/migration/1610277585759-registry2.js index 591bafae3..a2c1fb01b 100644 --- a/packages/backend/migration/1610277585759-registry2.js +++ b/packages/backend/migration/1610277585759-registry2.js @@ -1,15 +1,19 @@ - - export class registry21610277585759 { - constructor() { - this.name = 'registry21610277585759'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "registry_item" ADD "value" jsonb NOT NULL DEFAULT '{}'`); - await queryRunner.query(`COMMENT ON COLUMN "registry_item"."value" IS 'The value of the RegistryItem.'`); - } - async down(queryRunner) { - await queryRunner.query(`COMMENT ON COLUMN "registry_item"."value" IS 'The value of the RegistryItem.'`); - await queryRunner.query(`ALTER TABLE "registry_item" DROP COLUMN "value"`); - } + constructor() { + this.name = "registry21610277585759"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "registry_item" ADD "value" jsonb NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "registry_item"."value" IS 'The value of the RegistryItem.'`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `COMMENT ON COLUMN "registry_item"."value" IS 'The value of the RegistryItem.'`, + ); + await queryRunner.query(`ALTER TABLE "registry_item" DROP COLUMN "value"`); + } } diff --git a/packages/backend/migration/1610283021566-registry3.js b/packages/backend/migration/1610283021566-registry3.js index e0289f17e..a1d55b2dc 100644 --- a/packages/backend/migration/1610283021566-registry3.js +++ b/packages/backend/migration/1610283021566-registry3.js @@ -1,13 +1,15 @@ - - export class registry31610283021566 { - constructor() { - this.name = 'registry31610283021566'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "registry_item" ALTER COLUMN "value" DROP NOT NULL`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "registry_item" ALTER COLUMN "value" SET NOT NULL`); - } + constructor() { + this.name = "registry31610283021566"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "registry_item" ALTER COLUMN "value" DROP NOT NULL`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "registry_item" ALTER COLUMN "value" SET NOT NULL`, + ); + } } diff --git a/packages/backend/migration/1611354329133-followersUri.js b/packages/backend/migration/1611354329133-followersUri.js index 669ddb480..c7ca5c895 100644 --- a/packages/backend/migration/1611354329133-followersUri.js +++ b/packages/backend/migration/1611354329133-followersUri.js @@ -1,15 +1,19 @@ - - export class followersUri1611354329133 { - constructor() { - this.name = 'followersUri1611354329133'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user" ADD "followersUri" varchar(512) DEFAULT NULL`); - await queryRunner.query(`COMMENT ON COLUMN "user"."followersUri" IS 'The URI of the user Follower Collection. It will be null if the origin of the user is local.'`); - } - async down(queryRunner) { - await queryRunner.query(`COMMENT ON COLUMN "user"."followersUri" IS 'The URI of the user Follower Collection. It will be null if the origin of the user is local.'`); - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "followersUri"`); - } + constructor() { + this.name = "followersUri1611354329133"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user" ADD "followersUri" varchar(512) DEFAULT NULL`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."followersUri" IS 'The URI of the user Follower Collection. It will be null if the origin of the user is local.'`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `COMMENT ON COLUMN "user"."followersUri" IS 'The URI of the user Follower Collection. It will be null if the origin of the user is local.'`, + ); + await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "followersUri"`); + } } diff --git a/packages/backend/migration/1611397665007-gallery.js b/packages/backend/migration/1611397665007-gallery.js index f49b2df46..1f36acbc1 100644 --- a/packages/backend/migration/1611397665007-gallery.js +++ b/packages/backend/migration/1611397665007-gallery.js @@ -1,39 +1,71 @@ - - export class gallery1611397665007 { - constructor() { - this.name = 'gallery1611397665007'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "gallery_post" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, "title" character varying(256) NOT NULL, "description" character varying(2048), "userId" character varying(32) NOT NULL, "fileIds" character varying(32) array NOT NULL DEFAULT '{}'::varchar[], "isSensitive" boolean NOT NULL DEFAULT false, "likedCount" integer NOT NULL DEFAULT '0', "tags" character varying(128) array NOT NULL DEFAULT '{}'::varchar[], CONSTRAINT "PK_8e90d7b6015f2c4518881b14753" PRIMARY KEY ("id")); COMMENT ON COLUMN "gallery_post"."createdAt" IS 'The created date of the GalleryPost.'; COMMENT ON COLUMN "gallery_post"."updatedAt" IS 'The updated date of the GalleryPost.'; COMMENT ON COLUMN "gallery_post"."userId" IS 'The ID of author.'; COMMENT ON COLUMN "gallery_post"."isSensitive" IS 'Whether the post is sensitive.'`); - await queryRunner.query(`CREATE INDEX "IDX_8f1a239bd077c8864a20c62c2c" ON "gallery_post" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_f631d37835adb04792e361807c" ON "gallery_post" ("updatedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_985b836dddd8615e432d7043dd" ON "gallery_post" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_3ca50563facd913c425e7a89ee" ON "gallery_post" ("fileIds") `); - await queryRunner.query(`CREATE INDEX "IDX_f2d744d9a14d0dfb8b96cb7fc5" ON "gallery_post" ("isSensitive") `); - await queryRunner.query(`CREATE INDEX "IDX_1a165c68a49d08f11caffbd206" ON "gallery_post" ("likedCount") `); - await queryRunner.query(`CREATE INDEX "IDX_05cca34b985d1b8edc1d1e28df" ON "gallery_post" ("tags") `); - await queryRunner.query(`CREATE TABLE "gallery_like" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "postId" character varying(32) NOT NULL, CONSTRAINT "PK_853ab02be39b8de45cd720cc15f" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_8fd5215095473061855ceb948c" ON "gallery_like" ("userId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_df1b5f4099e99fb0bc5eae53b6" ON "gallery_like" ("userId", "postId") `); - await queryRunner.query(`ALTER TABLE "gallery_post" ADD CONSTRAINT "FK_985b836dddd8615e432d7043ddb" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "gallery_like" ADD CONSTRAINT "FK_8fd5215095473061855ceb948cf" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "gallery_like" ADD CONSTRAINT "FK_b1cb568bfe569e47b7051699fc8" FOREIGN KEY ("postId") REFERENCES "gallery_post"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "gallery_like" DROP CONSTRAINT "FK_b1cb568bfe569e47b7051699fc8"`); - await queryRunner.query(`ALTER TABLE "gallery_like" DROP CONSTRAINT "FK_8fd5215095473061855ceb948cf"`); - await queryRunner.query(`ALTER TABLE "gallery_post" DROP CONSTRAINT "FK_985b836dddd8615e432d7043ddb"`); - await queryRunner.query(`DROP INDEX "IDX_df1b5f4099e99fb0bc5eae53b6"`); - await queryRunner.query(`DROP INDEX "IDX_8fd5215095473061855ceb948c"`); - await queryRunner.query(`DROP TABLE "gallery_like"`); - await queryRunner.query(`DROP INDEX "IDX_05cca34b985d1b8edc1d1e28df"`); - await queryRunner.query(`DROP INDEX "IDX_1a165c68a49d08f11caffbd206"`); - await queryRunner.query(`DROP INDEX "IDX_f2d744d9a14d0dfb8b96cb7fc5"`); - await queryRunner.query(`DROP INDEX "IDX_3ca50563facd913c425e7a89ee"`); - await queryRunner.query(`DROP INDEX "IDX_985b836dddd8615e432d7043dd"`); - await queryRunner.query(`DROP INDEX "IDX_f631d37835adb04792e361807c"`); - await queryRunner.query(`DROP INDEX "IDX_8f1a239bd077c8864a20c62c2c"`); - await queryRunner.query(`DROP TABLE "gallery_post"`); - } + constructor() { + this.name = "gallery1611397665007"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "gallery_post" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, "title" character varying(256) NOT NULL, "description" character varying(2048), "userId" character varying(32) NOT NULL, "fileIds" character varying(32) array NOT NULL DEFAULT '{}'::varchar[], "isSensitive" boolean NOT NULL DEFAULT false, "likedCount" integer NOT NULL DEFAULT '0', "tags" character varying(128) array NOT NULL DEFAULT '{}'::varchar[], CONSTRAINT "PK_8e90d7b6015f2c4518881b14753" PRIMARY KEY ("id")); COMMENT ON COLUMN "gallery_post"."createdAt" IS 'The created date of the GalleryPost.'; COMMENT ON COLUMN "gallery_post"."updatedAt" IS 'The updated date of the GalleryPost.'; COMMENT ON COLUMN "gallery_post"."userId" IS 'The ID of author.'; COMMENT ON COLUMN "gallery_post"."isSensitive" IS 'Whether the post is sensitive.'`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_8f1a239bd077c8864a20c62c2c" ON "gallery_post" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f631d37835adb04792e361807c" ON "gallery_post" ("updatedAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_985b836dddd8615e432d7043dd" ON "gallery_post" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_3ca50563facd913c425e7a89ee" ON "gallery_post" ("fileIds") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f2d744d9a14d0dfb8b96cb7fc5" ON "gallery_post" ("isSensitive") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_1a165c68a49d08f11caffbd206" ON "gallery_post" ("likedCount") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_05cca34b985d1b8edc1d1e28df" ON "gallery_post" ("tags") `, + ); + await queryRunner.query( + `CREATE TABLE "gallery_like" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "postId" character varying(32) NOT NULL, CONSTRAINT "PK_853ab02be39b8de45cd720cc15f" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_8fd5215095473061855ceb948c" ON "gallery_like" ("userId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_df1b5f4099e99fb0bc5eae53b6" ON "gallery_like" ("userId", "postId") `, + ); + await queryRunner.query( + `ALTER TABLE "gallery_post" ADD CONSTRAINT "FK_985b836dddd8615e432d7043ddb" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "gallery_like" ADD CONSTRAINT "FK_8fd5215095473061855ceb948cf" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "gallery_like" ADD CONSTRAINT "FK_b1cb568bfe569e47b7051699fc8" FOREIGN KEY ("postId") REFERENCES "gallery_post"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "gallery_like" DROP CONSTRAINT "FK_b1cb568bfe569e47b7051699fc8"`, + ); + await queryRunner.query( + `ALTER TABLE "gallery_like" DROP CONSTRAINT "FK_8fd5215095473061855ceb948cf"`, + ); + await queryRunner.query( + `ALTER TABLE "gallery_post" DROP CONSTRAINT "FK_985b836dddd8615e432d7043ddb"`, + ); + await queryRunner.query(`DROP INDEX "IDX_df1b5f4099e99fb0bc5eae53b6"`); + await queryRunner.query(`DROP INDEX "IDX_8fd5215095473061855ceb948c"`); + await queryRunner.query(`DROP TABLE "gallery_like"`); + await queryRunner.query(`DROP INDEX "IDX_05cca34b985d1b8edc1d1e28df"`); + await queryRunner.query(`DROP INDEX "IDX_1a165c68a49d08f11caffbd206"`); + await queryRunner.query(`DROP INDEX "IDX_f2d744d9a14d0dfb8b96cb7fc5"`); + await queryRunner.query(`DROP INDEX "IDX_3ca50563facd913c425e7a89ee"`); + await queryRunner.query(`DROP INDEX "IDX_985b836dddd8615e432d7043dd"`); + await queryRunner.query(`DROP INDEX "IDX_f631d37835adb04792e361807c"`); + await queryRunner.query(`DROP INDEX "IDX_8f1a239bd077c8864a20c62c2c"`); + await queryRunner.query(`DROP TABLE "gallery_post"`); + } } diff --git a/packages/backend/migration/1611547387175-objectStorageS3ForcePathStyle.js b/packages/backend/migration/1611547387175-objectStorageS3ForcePathStyle.js index e4d3c0e8e..b65ca2a57 100644 --- a/packages/backend/migration/1611547387175-objectStorageS3ForcePathStyle.js +++ b/packages/backend/migration/1611547387175-objectStorageS3ForcePathStyle.js @@ -1,13 +1,15 @@ - - export class objectStorageS3ForcePathStyle1611547387175 { - constructor() { - this.name = 'objectStorageS3ForcePathStyle1611547387175'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "objectStorageS3ForcePathStyle" boolean NOT NULL DEFAULT true`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "objectStorageS3ForcePathStyle"`); - } + constructor() { + this.name = "objectStorageS3ForcePathStyle1611547387175"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "objectStorageS3ForcePathStyle" boolean NOT NULL DEFAULT true`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "objectStorageS3ForcePathStyle"`, + ); + } } diff --git a/packages/backend/migration/1612619156584-announcement-email.js b/packages/backend/migration/1612619156584-announcement-email.js index bcc718d1c..a3b7292f8 100644 --- a/packages/backend/migration/1612619156584-announcement-email.js +++ b/packages/backend/migration/1612619156584-announcement-email.js @@ -1,13 +1,15 @@ - - export class announcementEmail1612619156584 { - constructor() { - this.name = 'announcementEmail1612619156584'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" ADD "receiveAnnouncementEmail" boolean NOT NULL DEFAULT true`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "receiveAnnouncementEmail"`); - } + constructor() { + this.name = "announcementEmail1612619156584"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "receiveAnnouncementEmail" boolean NOT NULL DEFAULT true`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "receiveAnnouncementEmail"`, + ); + } } diff --git a/packages/backend/migration/1613155914446-emailNotificationTypes.js b/packages/backend/migration/1613155914446-emailNotificationTypes.js index cd49924d2..e64aada7b 100644 --- a/packages/backend/migration/1613155914446-emailNotificationTypes.js +++ b/packages/backend/migration/1613155914446-emailNotificationTypes.js @@ -1,13 +1,15 @@ - - export class emailNotificationTypes1613155914446 { - constructor() { - this.name = 'emailNotificationTypes1613155914446'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" ADD "emailNotificationTypes" jsonb NOT NULL DEFAULT '["follow","receiveFollowRequest","groupInvited"]'`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "emailNotificationTypes"`); - } + constructor() { + this.name = "emailNotificationTypes1613155914446"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "emailNotificationTypes" jsonb NOT NULL DEFAULT '["follow","receiveFollowRequest","groupInvited"]'`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "emailNotificationTypes"`, + ); + } } diff --git a/packages/backend/migration/1613181457597-user-lang.js b/packages/backend/migration/1613181457597-user-lang.js index d2cd06848..aa5bf7de8 100644 --- a/packages/backend/migration/1613181457597-user-lang.js +++ b/packages/backend/migration/1613181457597-user-lang.js @@ -1,13 +1,13 @@ - - export class userLang1613181457597 { - constructor() { - this.name = 'userLang1613181457597'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" ADD "lang" character varying(32)`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "lang"`); - } + constructor() { + this.name = "userLang1613181457597"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "lang" character varying(32)`, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "lang"`); + } } diff --git a/packages/backend/migration/1613503367223-use-bigint-for-driveUsage.js b/packages/backend/migration/1613503367223-use-bigint-for-driveUsage.js index f2e2c5d35..a8f1e33bf 100644 --- a/packages/backend/migration/1613503367223-use-bigint-for-driveUsage.js +++ b/packages/backend/migration/1613503367223-use-bigint-for-driveUsage.js @@ -1,14 +1,16 @@ - - export class useBigintForDriveUsage1613503367223 { - constructor() { - this.name = 'useBigintForDriveUsage1613503367223'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "driveUsage" TYPE bigint`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "driveUsage"`); - await queryRunner.query(`ALTER TABLE "instance" ADD "driveUsage" integer NOT NULL DEFAULT 0`); - } + constructor() { + this.name = "useBigintForDriveUsage1613503367223"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "instance" ALTER COLUMN "driveUsage" TYPE bigint`, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "driveUsage"`); + await queryRunner.query( + `ALTER TABLE "instance" ADD "driveUsage" integer NOT NULL DEFAULT 0`, + ); + } } diff --git a/packages/backend/migration/1615965918224-chart-v2.js b/packages/backend/migration/1615965918224-chart-v2.js index 86fa5b0c0..0460a57f5 100644 --- a/packages/backend/migration/1615965918224-chart-v2.js +++ b/packages/backend/migration/1615965918224-chart-v2.js @@ -1,216 +1,508 @@ - - export class chartV21615965918224 { - constructor() { - this.name = 'chartV21615965918224'; - } - async up(queryRunner) { - await queryRunner.query(`DELETE FROM "__chart__active_users" WHERE "span" = 'day'`); - await queryRunner.query(`DELETE FROM "__chart__drive" WHERE "span" = 'day'`); - await queryRunner.query(`DELETE FROM "__chart__federation" WHERE "span" = 'day'`); - await queryRunner.query(`DELETE FROM "__chart__hashtag" WHERE "span" = 'day'`); - await queryRunner.query(`DELETE FROM "__chart__instance" WHERE "span" = 'day'`); - await queryRunner.query(`DELETE FROM "__chart__network" WHERE "span" = 'day'`); - await queryRunner.query(`DELETE FROM "__chart__notes" WHERE "span" = 'day'`); - await queryRunner.query(`DELETE FROM "__chart__per_user_drive" WHERE "span" = 'day'`); - await queryRunner.query(`DELETE FROM "__chart__per_user_following" WHERE "span" = 'day'`); - await queryRunner.query(`DELETE FROM "__chart__per_user_notes" WHERE "span" = 'day'`); - await queryRunner.query(`DELETE FROM "__chart__per_user_reaction" WHERE "span" = 'day'`); - await queryRunner.query(`DELETE FROM "__chart__test" WHERE "span" = 'day'`); - await queryRunner.query(`DELETE FROM "__chart__test_grouped" WHERE "span" = 'day'`); - await queryRunner.query(`DELETE FROM "__chart__test_unique" WHERE "span" = 'day'`); - await queryRunner.query(`DELETE FROM "__chart__users" WHERE "span" = 'day'`); - await queryRunner.query(`DROP INDEX "IDX_15e91a03aeeac9dbccdf43fc06"`); - await queryRunner.query(`DROP INDEX "IDX_20f57cc8f142c131340ee16742"`); - await queryRunner.query(`DROP INDEX "IDX_c26e2c1cbb6e911e0554b27416"`); - await queryRunner.query(`DROP INDEX "IDX_3fa0d0f17ca72e3dc80999a032"`); - await queryRunner.query(`DROP INDEX "IDX_6e1df243476e20cbf86572ecc0"`); - await queryRunner.query(`DROP INDEX "IDX_06690fc959f1c9fdaf21928222"`); - await queryRunner.query(`DROP INDEX "IDX_e447064455928cf627590ef527"`); - await queryRunner.query(`DROP INDEX "IDX_2d416e6af791a82e338c79d480"`); - await queryRunner.query(`DROP INDEX "IDX_e9cd07672b37d8966cf3709283"`); - await queryRunner.query(`DROP INDEX "IDX_fcc181fb8283009c61cc4083ef"`); - await queryRunner.query(`DROP INDEX "IDX_49975586f50ed7b800fdd88fbd"`); - await queryRunner.query(`DROP INDEX "IDX_6d6f156ceefc6bc5f273a0e370"`); - await queryRunner.query(`DROP INDEX "IDX_c12f0af4a66cdd30c2287ce8aa"`); - await queryRunner.query(`DROP INDEX "IDX_d0a4f79af5a97b08f37b547197"`); - await queryRunner.query(`DROP INDEX "IDX_f5448d9633cff74208d850aabe"`); - await queryRunner.query(`DROP INDEX "IDX_f8dd01baeded2ffa833e0a610a"`); - await queryRunner.query(`DROP INDEX "IDX_08fac0eb3b11f04c200c0b40dd"`); - await queryRunner.query(`DROP INDEX "IDX_9ff6944f01acb756fdc92d7563"`); - await queryRunner.query(`DROP INDEX "IDX_e69096589f11e3baa98ddd64d0"`); - await queryRunner.query(`DROP INDEX "IDX_0c9a159c5082cbeef3ca6706b5"`); - await queryRunner.query(`DROP INDEX "IDX_924fc196c80ca24bae01dd37e4"`); - await queryRunner.query(`DROP INDEX "IDX_328f259961e60c4fa0bfcf55ca"`); - await queryRunner.query(`DROP INDEX "IDX_42ea9381f0fda8dfe0fa1c8b53"`); - await queryRunner.query(`DROP INDEX "IDX_f2aeafde2ae6fbad38e857631b"`); - await queryRunner.query(`DROP INDEX "IDX_f92dd6d03f8d994f29987f6214"`); - await queryRunner.query(`DROP INDEX "IDX_57b5458d0d3d6d1e7f13d4e57f"`); - await queryRunner.query(`DROP INDEX "IDX_4db3b84c7be0d3464714f3e0b1"`); - await queryRunner.query(`DROP INDEX "IDX_8d2cbbc8114d90d19b44d626b6"`); - await queryRunner.query(`DROP INDEX "IDX_046feeb12e9ef5f783f409866a"`); - await queryRunner.query(`DROP INDEX "IDX_f68a5ab958f9f5fa17a32ac23b"`); - await queryRunner.query(`DROP INDEX "IDX_65633a106bce43fc7c5c30a5c7"`); - await queryRunner.query(`DROP INDEX "IDX_edeb73c09c3143a81bcb34d569"`); - await queryRunner.query(`DROP INDEX "IDX_e316f01a6d24eb31db27f88262"`); - await queryRunner.query(`DROP INDEX "IDX_2be7ec6cebddc14dc11e206686"`); - await queryRunner.query(`DROP INDEX "IDX_a5133470f4825902e170328ca5"`); - await queryRunner.query(`DROP INDEX "IDX_84e661abb7bd1e51b690d4b017"`); - await queryRunner.query(`DROP INDEX "IDX_5c73bf61da4f6e6f15bae88ed1"`); - await queryRunner.query(`DROP INDEX "IDX_d70c86baedc68326be11f9c0ce"`); - await queryRunner.query(`DROP INDEX "IDX_66e1e1ecd2f29e57778af35b59"`); - await queryRunner.query(`DROP INDEX "IDX_92255988735563f0fe4aba1f05"`); - await queryRunner.query(`DROP INDEX "IDX_c5870993e25c3d5771f91f5003"`); - await queryRunner.query(`DROP INDEX "IDX_f170de677ea75ad4533de2723e"`); - await queryRunner.query(`DROP INDEX "IDX_7c184198ecf66a8d3ecb253ab3"`); - await queryRunner.query(`DROP INDEX "IDX_f091abb24193d50c653c6b77fc"`); - await queryRunner.query(`DROP INDEX "IDX_a770a57c70e668cc61590c9161"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "span"`); - await queryRunner.query(`DROP TYPE "public"."__chart__active_users_span_enum"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "unique"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___local_count"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___remote_count"`); - await queryRunner.query(`ALTER TABLE "__chart__drive" DROP COLUMN "span"`); - await queryRunner.query(`DROP TYPE "public"."__chart__drive_span_enum"`); - await queryRunner.query(`ALTER TABLE "__chart__drive" DROP COLUMN "unique"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "span"`); - await queryRunner.query(`DROP TYPE "public"."__chart__federation_span_enum"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "unique"`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" DROP COLUMN "span"`); - await queryRunner.query(`DROP TYPE "public"."__chart__hashtag_span_enum"`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" DROP COLUMN "unique"`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" DROP COLUMN "___local_count"`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" DROP COLUMN "___remote_count"`); - await queryRunner.query(`ALTER TABLE "__chart__instance" DROP COLUMN "span"`); - await queryRunner.query(`DROP TYPE "public"."__chart__instance_span_enum"`); - await queryRunner.query(`ALTER TABLE "__chart__instance" DROP COLUMN "unique"`); - await queryRunner.query(`ALTER TABLE "__chart__network" DROP COLUMN "span"`); - await queryRunner.query(`DROP TYPE "public"."__chart__network_span_enum"`); - await queryRunner.query(`ALTER TABLE "__chart__network" DROP COLUMN "unique"`); - await queryRunner.query(`ALTER TABLE "__chart__notes" DROP COLUMN "span"`); - await queryRunner.query(`DROP TYPE "public"."__chart__notes_span_enum"`); - await queryRunner.query(`ALTER TABLE "__chart__notes" DROP COLUMN "unique"`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" DROP COLUMN "span"`); - await queryRunner.query(`DROP TYPE "public"."__chart__per_user_drive_span_enum"`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" DROP COLUMN "unique"`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" DROP COLUMN "span"`); - await queryRunner.query(`DROP TYPE "public"."__chart__per_user_following_span_enum"`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" DROP COLUMN "unique"`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" DROP COLUMN "span"`); - await queryRunner.query(`DROP TYPE "public"."__chart__per_user_notes_span_enum"`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" DROP COLUMN "unique"`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" DROP COLUMN "span"`); - await queryRunner.query(`DROP TYPE "public"."__chart__per_user_reaction_span_enum"`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" DROP COLUMN "unique"`); - await queryRunner.query(`ALTER TABLE "__chart__test_grouped" DROP COLUMN "span"`); - await queryRunner.query(`DROP TYPE "public"."__chart__test_grouped_span_enum"`); - await queryRunner.query(`ALTER TABLE "__chart__test_grouped" DROP COLUMN "unique"`); - await queryRunner.query(`ALTER TABLE "__chart__test_unique" DROP COLUMN "span"`); - await queryRunner.query(`DROP TYPE "public"."__chart__test_unique_span_enum"`); - await queryRunner.query(`ALTER TABLE "__chart__test_unique" DROP COLUMN "unique"`); - await queryRunner.query(`ALTER TABLE "__chart__test_unique" DROP COLUMN "___foo"`); - await queryRunner.query(`ALTER TABLE "__chart__test" DROP COLUMN "span"`); - await queryRunner.query(`DROP TYPE "public"."__chart__test_span_enum"`); - await queryRunner.query(`ALTER TABLE "__chart__test" DROP COLUMN "unique"`); - await queryRunner.query(`ALTER TABLE "__chart__users" DROP COLUMN "span"`); - await queryRunner.query(`DROP TYPE "public"."__chart__users_span_enum"`); - await queryRunner.query(`ALTER TABLE "__chart__users" DROP COLUMN "unique"`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart__users" ADD "unique" jsonb NOT NULL DEFAULT '{}'`); - await queryRunner.query(`CREATE TYPE "public"."__chart__users_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`ALTER TABLE "__chart__users" ADD "span" "__chart__users_span_enum" NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__test" ADD "unique" jsonb NOT NULL DEFAULT '{}'`); - await queryRunner.query(`CREATE TYPE "public"."__chart__test_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`ALTER TABLE "__chart__test" ADD "span" "__chart__test_span_enum" NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__test_unique" ADD "___foo" bigint NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__test_unique" ADD "unique" jsonb NOT NULL DEFAULT '{}'`); - await queryRunner.query(`CREATE TYPE "public"."__chart__test_unique_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`ALTER TABLE "__chart__test_unique" ADD "span" "__chart__test_unique_span_enum" NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__test_grouped" ADD "unique" jsonb NOT NULL DEFAULT '{}'`); - await queryRunner.query(`CREATE TYPE "public"."__chart__test_grouped_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`ALTER TABLE "__chart__test_grouped" ADD "span" "__chart__test_grouped_span_enum" NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ADD "unique" jsonb NOT NULL DEFAULT '{}'`); - await queryRunner.query(`CREATE TYPE "public"."__chart__per_user_reaction_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ADD "span" "__chart__per_user_reaction_span_enum" NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ADD "unique" jsonb NOT NULL DEFAULT '{}'`); - await queryRunner.query(`CREATE TYPE "public"."__chart__per_user_notes_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ADD "span" "__chart__per_user_notes_span_enum" NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ADD "unique" jsonb NOT NULL DEFAULT '{}'`); - await queryRunner.query(`CREATE TYPE "public"."__chart__per_user_following_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ADD "span" "__chart__per_user_following_span_enum" NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ADD "unique" jsonb NOT NULL DEFAULT '{}'`); - await queryRunner.query(`CREATE TYPE "public"."__chart__per_user_drive_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ADD "span" "__chart__per_user_drive_span_enum" NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ADD "unique" jsonb NOT NULL DEFAULT '{}'`); - await queryRunner.query(`CREATE TYPE "public"."__chart__notes_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ADD "span" "__chart__notes_span_enum" NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__network" ADD "unique" jsonb NOT NULL DEFAULT '{}'`); - await queryRunner.query(`CREATE TYPE "public"."__chart__network_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`ALTER TABLE "__chart__network" ADD "span" "__chart__network_span_enum" NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ADD "unique" jsonb NOT NULL DEFAULT '{}'`); - await queryRunner.query(`CREATE TYPE "public"."__chart__instance_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ADD "span" "__chart__instance_span_enum" NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ADD "___remote_count" bigint NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ADD "___local_count" bigint NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ADD "unique" jsonb NOT NULL DEFAULT '{}'`); - await queryRunner.query(`CREATE TYPE "public"."__chart__hashtag_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ADD "span" "__chart__hashtag_span_enum" NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "unique" jsonb NOT NULL DEFAULT '{}'`); - await queryRunner.query(`CREATE TYPE "public"."__chart__federation_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "span" "__chart__federation_span_enum" NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ADD "unique" jsonb NOT NULL DEFAULT '{}'`); - await queryRunner.query(`CREATE TYPE "public"."__chart__drive_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ADD "span" "__chart__drive_span_enum" NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___remote_count" bigint NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___local_count" bigint NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "unique" jsonb NOT NULL DEFAULT '{}'`); - await queryRunner.query(`CREATE TYPE "public"."__chart__active_users_span_enum" AS ENUM('hour', 'day')`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "span" "__chart__active_users_span_enum" NOT NULL`); - await queryRunner.query(`CREATE INDEX "IDX_a770a57c70e668cc61590c9161" ON "__chart__users" ("date", "group", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_f091abb24193d50c653c6b77fc" ON "__chart__users" ("date", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_7c184198ecf66a8d3ecb253ab3" ON "__chart__users" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_f170de677ea75ad4533de2723e" ON "__chart__test" ("date", "group", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_c5870993e25c3d5771f91f5003" ON "__chart__test" ("date", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_92255988735563f0fe4aba1f05" ON "__chart__test" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_66e1e1ecd2f29e57778af35b59" ON "__chart__test_unique" ("date", "group", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_d70c86baedc68326be11f9c0ce" ON "__chart__test_unique" ("date", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_5c73bf61da4f6e6f15bae88ed1" ON "__chart__test_unique" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_84e661abb7bd1e51b690d4b017" ON "__chart__test_grouped" ("date", "group", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_a5133470f4825902e170328ca5" ON "__chart__test_grouped" ("date", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_2be7ec6cebddc14dc11e206686" ON "__chart__test_grouped" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_e316f01a6d24eb31db27f88262" ON "__chart__per_user_reaction" ("date", "group", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_edeb73c09c3143a81bcb34d569" ON "__chart__per_user_reaction" ("date", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_65633a106bce43fc7c5c30a5c7" ON "__chart__per_user_reaction" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_f68a5ab958f9f5fa17a32ac23b" ON "__chart__per_user_notes" ("date", "group", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_046feeb12e9ef5f783f409866a" ON "__chart__per_user_notes" ("date", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_8d2cbbc8114d90d19b44d626b6" ON "__chart__per_user_notes" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_4db3b84c7be0d3464714f3e0b1" ON "__chart__per_user_following" ("date", "group", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_57b5458d0d3d6d1e7f13d4e57f" ON "__chart__per_user_following" ("date", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_f92dd6d03f8d994f29987f6214" ON "__chart__per_user_following" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_f2aeafde2ae6fbad38e857631b" ON "__chart__per_user_drive" ("date", "group", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_42ea9381f0fda8dfe0fa1c8b53" ON "__chart__per_user_drive" ("date", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_328f259961e60c4fa0bfcf55ca" ON "__chart__per_user_drive" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_924fc196c80ca24bae01dd37e4" ON "__chart__notes" ("date", "group", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_0c9a159c5082cbeef3ca6706b5" ON "__chart__notes" ("date", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_e69096589f11e3baa98ddd64d0" ON "__chart__notes" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_9ff6944f01acb756fdc92d7563" ON "__chart__network" ("date", "group", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_08fac0eb3b11f04c200c0b40dd" ON "__chart__network" ("date", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_f8dd01baeded2ffa833e0a610a" ON "__chart__network" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_f5448d9633cff74208d850aabe" ON "__chart__instance" ("date", "group", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_d0a4f79af5a97b08f37b547197" ON "__chart__instance" ("date", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_c12f0af4a66cdd30c2287ce8aa" ON "__chart__instance" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_6d6f156ceefc6bc5f273a0e370" ON "__chart__hashtag" ("date", "group", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_49975586f50ed7b800fdd88fbd" ON "__chart__hashtag" ("date", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_fcc181fb8283009c61cc4083ef" ON "__chart__hashtag" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_e9cd07672b37d8966cf3709283" ON "__chart__federation" ("date", "group", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_2d416e6af791a82e338c79d480" ON "__chart__federation" ("date", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_e447064455928cf627590ef527" ON "__chart__federation" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_06690fc959f1c9fdaf21928222" ON "__chart__drive" ("date", "group", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_6e1df243476e20cbf86572ecc0" ON "__chart__drive" ("date", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_3fa0d0f17ca72e3dc80999a032" ON "__chart__drive" ("span") `); - await queryRunner.query(`CREATE INDEX "IDX_c26e2c1cbb6e911e0554b27416" ON "__chart__active_users" ("date", "group", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_20f57cc8f142c131340ee16742" ON "__chart__active_users" ("date", "span") `); - await queryRunner.query(`CREATE INDEX "IDX_15e91a03aeeac9dbccdf43fc06" ON "__chart__active_users" ("span") `); - } + constructor() { + this.name = "chartV21615965918224"; + } + async up(queryRunner) { + await queryRunner.query( + `DELETE FROM "__chart__active_users" WHERE "span" = 'day'`, + ); + await queryRunner.query( + `DELETE FROM "__chart__drive" WHERE "span" = 'day'`, + ); + await queryRunner.query( + `DELETE FROM "__chart__federation" WHERE "span" = 'day'`, + ); + await queryRunner.query( + `DELETE FROM "__chart__hashtag" WHERE "span" = 'day'`, + ); + await queryRunner.query( + `DELETE FROM "__chart__instance" WHERE "span" = 'day'`, + ); + await queryRunner.query( + `DELETE FROM "__chart__network" WHERE "span" = 'day'`, + ); + await queryRunner.query( + `DELETE FROM "__chart__notes" WHERE "span" = 'day'`, + ); + await queryRunner.query( + `DELETE FROM "__chart__per_user_drive" WHERE "span" = 'day'`, + ); + await queryRunner.query( + `DELETE FROM "__chart__per_user_following" WHERE "span" = 'day'`, + ); + await queryRunner.query( + `DELETE FROM "__chart__per_user_notes" WHERE "span" = 'day'`, + ); + await queryRunner.query( + `DELETE FROM "__chart__per_user_reaction" WHERE "span" = 'day'`, + ); + await queryRunner.query(`DELETE FROM "__chart__test" WHERE "span" = 'day'`); + await queryRunner.query( + `DELETE FROM "__chart__test_grouped" WHERE "span" = 'day'`, + ); + await queryRunner.query( + `DELETE FROM "__chart__test_unique" WHERE "span" = 'day'`, + ); + await queryRunner.query( + `DELETE FROM "__chart__users" WHERE "span" = 'day'`, + ); + await queryRunner.query(`DROP INDEX "IDX_15e91a03aeeac9dbccdf43fc06"`); + await queryRunner.query(`DROP INDEX "IDX_20f57cc8f142c131340ee16742"`); + await queryRunner.query(`DROP INDEX "IDX_c26e2c1cbb6e911e0554b27416"`); + await queryRunner.query(`DROP INDEX "IDX_3fa0d0f17ca72e3dc80999a032"`); + await queryRunner.query(`DROP INDEX "IDX_6e1df243476e20cbf86572ecc0"`); + await queryRunner.query(`DROP INDEX "IDX_06690fc959f1c9fdaf21928222"`); + await queryRunner.query(`DROP INDEX "IDX_e447064455928cf627590ef527"`); + await queryRunner.query(`DROP INDEX "IDX_2d416e6af791a82e338c79d480"`); + await queryRunner.query(`DROP INDEX "IDX_e9cd07672b37d8966cf3709283"`); + await queryRunner.query(`DROP INDEX "IDX_fcc181fb8283009c61cc4083ef"`); + await queryRunner.query(`DROP INDEX "IDX_49975586f50ed7b800fdd88fbd"`); + await queryRunner.query(`DROP INDEX "IDX_6d6f156ceefc6bc5f273a0e370"`); + await queryRunner.query(`DROP INDEX "IDX_c12f0af4a66cdd30c2287ce8aa"`); + await queryRunner.query(`DROP INDEX "IDX_d0a4f79af5a97b08f37b547197"`); + await queryRunner.query(`DROP INDEX "IDX_f5448d9633cff74208d850aabe"`); + await queryRunner.query(`DROP INDEX "IDX_f8dd01baeded2ffa833e0a610a"`); + await queryRunner.query(`DROP INDEX "IDX_08fac0eb3b11f04c200c0b40dd"`); + await queryRunner.query(`DROP INDEX "IDX_9ff6944f01acb756fdc92d7563"`); + await queryRunner.query(`DROP INDEX "IDX_e69096589f11e3baa98ddd64d0"`); + await queryRunner.query(`DROP INDEX "IDX_0c9a159c5082cbeef3ca6706b5"`); + await queryRunner.query(`DROP INDEX "IDX_924fc196c80ca24bae01dd37e4"`); + await queryRunner.query(`DROP INDEX "IDX_328f259961e60c4fa0bfcf55ca"`); + await queryRunner.query(`DROP INDEX "IDX_42ea9381f0fda8dfe0fa1c8b53"`); + await queryRunner.query(`DROP INDEX "IDX_f2aeafde2ae6fbad38e857631b"`); + await queryRunner.query(`DROP INDEX "IDX_f92dd6d03f8d994f29987f6214"`); + await queryRunner.query(`DROP INDEX "IDX_57b5458d0d3d6d1e7f13d4e57f"`); + await queryRunner.query(`DROP INDEX "IDX_4db3b84c7be0d3464714f3e0b1"`); + await queryRunner.query(`DROP INDEX "IDX_8d2cbbc8114d90d19b44d626b6"`); + await queryRunner.query(`DROP INDEX "IDX_046feeb12e9ef5f783f409866a"`); + await queryRunner.query(`DROP INDEX "IDX_f68a5ab958f9f5fa17a32ac23b"`); + await queryRunner.query(`DROP INDEX "IDX_65633a106bce43fc7c5c30a5c7"`); + await queryRunner.query(`DROP INDEX "IDX_edeb73c09c3143a81bcb34d569"`); + await queryRunner.query(`DROP INDEX "IDX_e316f01a6d24eb31db27f88262"`); + await queryRunner.query(`DROP INDEX "IDX_2be7ec6cebddc14dc11e206686"`); + await queryRunner.query(`DROP INDEX "IDX_a5133470f4825902e170328ca5"`); + await queryRunner.query(`DROP INDEX "IDX_84e661abb7bd1e51b690d4b017"`); + await queryRunner.query(`DROP INDEX "IDX_5c73bf61da4f6e6f15bae88ed1"`); + await queryRunner.query(`DROP INDEX "IDX_d70c86baedc68326be11f9c0ce"`); + await queryRunner.query(`DROP INDEX "IDX_66e1e1ecd2f29e57778af35b59"`); + await queryRunner.query(`DROP INDEX "IDX_92255988735563f0fe4aba1f05"`); + await queryRunner.query(`DROP INDEX "IDX_c5870993e25c3d5771f91f5003"`); + await queryRunner.query(`DROP INDEX "IDX_f170de677ea75ad4533de2723e"`); + await queryRunner.query(`DROP INDEX "IDX_7c184198ecf66a8d3ecb253ab3"`); + await queryRunner.query(`DROP INDEX "IDX_f091abb24193d50c653c6b77fc"`); + await queryRunner.query(`DROP INDEX "IDX_a770a57c70e668cc61590c9161"`); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "span"`, + ); + await queryRunner.query( + `DROP TYPE "public"."__chart__active_users_span_enum"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "unique"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___local_count"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___remote_count"`, + ); + await queryRunner.query(`ALTER TABLE "__chart__drive" DROP COLUMN "span"`); + await queryRunner.query(`DROP TYPE "public"."__chart__drive_span_enum"`); + await queryRunner.query( + `ALTER TABLE "__chart__drive" DROP COLUMN "unique"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP COLUMN "span"`, + ); + await queryRunner.query( + `DROP TYPE "public"."__chart__federation_span_enum"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP COLUMN "unique"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" DROP COLUMN "span"`, + ); + await queryRunner.query(`DROP TYPE "public"."__chart__hashtag_span_enum"`); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" DROP COLUMN "unique"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" DROP COLUMN "___local_count"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" DROP COLUMN "___remote_count"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" DROP COLUMN "span"`, + ); + await queryRunner.query(`DROP TYPE "public"."__chart__instance_span_enum"`); + await queryRunner.query( + `ALTER TABLE "__chart__instance" DROP COLUMN "unique"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" DROP COLUMN "span"`, + ); + await queryRunner.query(`DROP TYPE "public"."__chart__network_span_enum"`); + await queryRunner.query( + `ALTER TABLE "__chart__network" DROP COLUMN "unique"`, + ); + await queryRunner.query(`ALTER TABLE "__chart__notes" DROP COLUMN "span"`); + await queryRunner.query(`DROP TYPE "public"."__chart__notes_span_enum"`); + await queryRunner.query( + `ALTER TABLE "__chart__notes" DROP COLUMN "unique"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" DROP COLUMN "span"`, + ); + await queryRunner.query( + `DROP TYPE "public"."__chart__per_user_drive_span_enum"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" DROP COLUMN "unique"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" DROP COLUMN "span"`, + ); + await queryRunner.query( + `DROP TYPE "public"."__chart__per_user_following_span_enum"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" DROP COLUMN "unique"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" DROP COLUMN "span"`, + ); + await queryRunner.query( + `DROP TYPE "public"."__chart__per_user_notes_span_enum"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" DROP COLUMN "unique"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_reaction" DROP COLUMN "span"`, + ); + await queryRunner.query( + `DROP TYPE "public"."__chart__per_user_reaction_span_enum"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_reaction" DROP COLUMN "unique"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__test_grouped" DROP COLUMN "span"`, + ); + await queryRunner.query( + `DROP TYPE "public"."__chart__test_grouped_span_enum"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__test_grouped" DROP COLUMN "unique"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__test_unique" DROP COLUMN "span"`, + ); + await queryRunner.query( + `DROP TYPE "public"."__chart__test_unique_span_enum"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__test_unique" DROP COLUMN "unique"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__test_unique" DROP COLUMN "___foo"`, + ); + await queryRunner.query(`ALTER TABLE "__chart__test" DROP COLUMN "span"`); + await queryRunner.query(`DROP TYPE "public"."__chart__test_span_enum"`); + await queryRunner.query(`ALTER TABLE "__chart__test" DROP COLUMN "unique"`); + await queryRunner.query(`ALTER TABLE "__chart__users" DROP COLUMN "span"`); + await queryRunner.query(`DROP TYPE "public"."__chart__users_span_enum"`); + await queryRunner.query( + `ALTER TABLE "__chart__users" DROP COLUMN "unique"`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart__users" ADD "unique" jsonb NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `CREATE TYPE "public"."__chart__users_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ADD "span" "__chart__users_span_enum" NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__test" ADD "unique" jsonb NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `CREATE TYPE "public"."__chart__test_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__test" ADD "span" "__chart__test_span_enum" NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__test_unique" ADD "___foo" bigint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__test_unique" ADD "unique" jsonb NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `CREATE TYPE "public"."__chart__test_unique_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__test_unique" ADD "span" "__chart__test_unique_span_enum" NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__test_grouped" ADD "unique" jsonb NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `CREATE TYPE "public"."__chart__test_grouped_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__test_grouped" ADD "span" "__chart__test_grouped_span_enum" NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_reaction" ADD "unique" jsonb NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `CREATE TYPE "public"."__chart__per_user_reaction_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_reaction" ADD "span" "__chart__per_user_reaction_span_enum" NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ADD "unique" jsonb NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `CREATE TYPE "public"."__chart__per_user_notes_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ADD "span" "__chart__per_user_notes_span_enum" NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ADD "unique" jsonb NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `CREATE TYPE "public"."__chart__per_user_following_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ADD "span" "__chart__per_user_following_span_enum" NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ADD "unique" jsonb NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `CREATE TYPE "public"."__chart__per_user_drive_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ADD "span" "__chart__per_user_drive_span_enum" NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ADD "unique" jsonb NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `CREATE TYPE "public"."__chart__notes_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ADD "span" "__chart__notes_span_enum" NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ADD "unique" jsonb NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `CREATE TYPE "public"."__chart__network_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ADD "span" "__chart__network_span_enum" NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ADD "unique" jsonb NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `CREATE TYPE "public"."__chart__instance_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ADD "span" "__chart__instance_span_enum" NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ADD "___remote_count" bigint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ADD "___local_count" bigint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ADD "unique" jsonb NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `CREATE TYPE "public"."__chart__hashtag_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ADD "span" "__chart__hashtag_span_enum" NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD "unique" jsonb NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `CREATE TYPE "public"."__chart__federation_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD "span" "__chart__federation_span_enum" NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ADD "unique" jsonb NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `CREATE TYPE "public"."__chart__drive_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ADD "span" "__chart__drive_span_enum" NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___remote_count" bigint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___local_count" bigint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "unique" jsonb NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `CREATE TYPE "public"."__chart__active_users_span_enum" AS ENUM('hour', 'day')`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "span" "__chart__active_users_span_enum" NOT NULL`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_a770a57c70e668cc61590c9161" ON "__chart__users" ("date", "group", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f091abb24193d50c653c6b77fc" ON "__chart__users" ("date", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_7c184198ecf66a8d3ecb253ab3" ON "__chart__users" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f170de677ea75ad4533de2723e" ON "__chart__test" ("date", "group", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_c5870993e25c3d5771f91f5003" ON "__chart__test" ("date", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_92255988735563f0fe4aba1f05" ON "__chart__test" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_66e1e1ecd2f29e57778af35b59" ON "__chart__test_unique" ("date", "group", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_d70c86baedc68326be11f9c0ce" ON "__chart__test_unique" ("date", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_5c73bf61da4f6e6f15bae88ed1" ON "__chart__test_unique" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_84e661abb7bd1e51b690d4b017" ON "__chart__test_grouped" ("date", "group", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_a5133470f4825902e170328ca5" ON "__chart__test_grouped" ("date", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_2be7ec6cebddc14dc11e206686" ON "__chart__test_grouped" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_e316f01a6d24eb31db27f88262" ON "__chart__per_user_reaction" ("date", "group", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_edeb73c09c3143a81bcb34d569" ON "__chart__per_user_reaction" ("date", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_65633a106bce43fc7c5c30a5c7" ON "__chart__per_user_reaction" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f68a5ab958f9f5fa17a32ac23b" ON "__chart__per_user_notes" ("date", "group", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_046feeb12e9ef5f783f409866a" ON "__chart__per_user_notes" ("date", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_8d2cbbc8114d90d19b44d626b6" ON "__chart__per_user_notes" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_4db3b84c7be0d3464714f3e0b1" ON "__chart__per_user_following" ("date", "group", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_57b5458d0d3d6d1e7f13d4e57f" ON "__chart__per_user_following" ("date", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f92dd6d03f8d994f29987f6214" ON "__chart__per_user_following" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f2aeafde2ae6fbad38e857631b" ON "__chart__per_user_drive" ("date", "group", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_42ea9381f0fda8dfe0fa1c8b53" ON "__chart__per_user_drive" ("date", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_328f259961e60c4fa0bfcf55ca" ON "__chart__per_user_drive" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_924fc196c80ca24bae01dd37e4" ON "__chart__notes" ("date", "group", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0c9a159c5082cbeef3ca6706b5" ON "__chart__notes" ("date", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_e69096589f11e3baa98ddd64d0" ON "__chart__notes" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_9ff6944f01acb756fdc92d7563" ON "__chart__network" ("date", "group", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_08fac0eb3b11f04c200c0b40dd" ON "__chart__network" ("date", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f8dd01baeded2ffa833e0a610a" ON "__chart__network" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f5448d9633cff74208d850aabe" ON "__chart__instance" ("date", "group", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_d0a4f79af5a97b08f37b547197" ON "__chart__instance" ("date", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_c12f0af4a66cdd30c2287ce8aa" ON "__chart__instance" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_6d6f156ceefc6bc5f273a0e370" ON "__chart__hashtag" ("date", "group", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_49975586f50ed7b800fdd88fbd" ON "__chart__hashtag" ("date", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_fcc181fb8283009c61cc4083ef" ON "__chart__hashtag" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_e9cd07672b37d8966cf3709283" ON "__chart__federation" ("date", "group", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_2d416e6af791a82e338c79d480" ON "__chart__federation" ("date", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_e447064455928cf627590ef527" ON "__chart__federation" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_06690fc959f1c9fdaf21928222" ON "__chart__drive" ("date", "group", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_6e1df243476e20cbf86572ecc0" ON "__chart__drive" ("date", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_3fa0d0f17ca72e3dc80999a032" ON "__chart__drive" ("span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_c26e2c1cbb6e911e0554b27416" ON "__chart__active_users" ("date", "group", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_20f57cc8f142c131340ee16742" ON "__chart__active_users" ("date", "span") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_15e91a03aeeac9dbccdf43fc06" ON "__chart__active_users" ("span") `, + ); + } } diff --git a/packages/backend/migration/1615966519402-chart-v2-2.js b/packages/backend/migration/1615966519402-chart-v2-2.js index c62f1b875..ce7596103 100644 --- a/packages/backend/migration/1615966519402-chart-v2-2.js +++ b/packages/backend/migration/1615966519402-chart-v2-2.js @@ -1,21 +1,39 @@ - - export class chartV221615966519402 { - constructor() { - this.name = 'chartV221615966519402'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___local_users" character varying array NOT NULL DEFAULT '{}'::varchar[]`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___remote_users" character varying array NOT NULL DEFAULT '{}'::varchar[]`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ADD "___local_users" character varying array NOT NULL DEFAULT '{}'::varchar[]`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ADD "___remote_users" character varying array NOT NULL DEFAULT '{}'::varchar[]`); - await queryRunner.query(`ALTER TABLE "__chart__test_unique" ADD "___foo" character varying array NOT NULL DEFAULT '{}'::varchar[]`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart__test_unique" DROP COLUMN "___foo"`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" DROP COLUMN "___remote_users"`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" DROP COLUMN "___local_users"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___remote_users"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___local_users"`); - } + constructor() { + this.name = "chartV221615966519402"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___local_users" character varying array NOT NULL DEFAULT '{}'::varchar[]`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___remote_users" character varying array NOT NULL DEFAULT '{}'::varchar[]`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ADD "___local_users" character varying array NOT NULL DEFAULT '{}'::varchar[]`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ADD "___remote_users" character varying array NOT NULL DEFAULT '{}'::varchar[]`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__test_unique" ADD "___foo" character varying array NOT NULL DEFAULT '{}'::varchar[]`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart__test_unique" DROP COLUMN "___foo"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" DROP COLUMN "___remote_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" DROP COLUMN "___local_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___remote_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___local_users"`, + ); + } } diff --git a/packages/backend/migration/1618637372000-user-last-active-date.js b/packages/backend/migration/1618637372000-user-last-active-date.js index 6c77ace46..0211c256b 100644 --- a/packages/backend/migration/1618637372000-user-last-active-date.js +++ b/packages/backend/migration/1618637372000-user-last-active-date.js @@ -1,15 +1,17 @@ - - export class userLastActiveDate1618637372000 { - constructor() { - this.name = 'userLastActiveDate1618637372000'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user" ADD "lastActiveDate" TIMESTAMP WITH TIME ZONE DEFAULT NULL`); - await queryRunner.query(`CREATE INDEX "IDX_seoignmeoprigmkpodgrjmkpormg" ON "user" ("lastActiveDate") `); - } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "IDX_seoignmeoprigmkpodgrjmkpormg"`); - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "lastActiveDate"`); - } + constructor() { + this.name = "userLastActiveDate1618637372000"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user" ADD "lastActiveDate" TIMESTAMP WITH TIME ZONE DEFAULT NULL`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_seoignmeoprigmkpodgrjmkpormg" ON "user" ("lastActiveDate") `, + ); + } + async down(queryRunner) { + await queryRunner.query(`DROP INDEX "IDX_seoignmeoprigmkpodgrjmkpormg"`); + await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "lastActiveDate"`); + } } diff --git a/packages/backend/migration/1618639857000-user-hide-online-status.js b/packages/backend/migration/1618639857000-user-hide-online-status.js index e63c8ae11..8d7632608 100644 --- a/packages/backend/migration/1618639857000-user-hide-online-status.js +++ b/packages/backend/migration/1618639857000-user-hide-online-status.js @@ -1,13 +1,15 @@ - - export class userHideOnlineStatus1618639857000 { - constructor() { - this.name = 'userHideOnlineStatus1618639857000'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user" ADD "hideOnlineStatus" boolean NOT NULL DEFAULT false`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "hideOnlineStatus"`); - } + constructor() { + this.name = "userHideOnlineStatus1618639857000"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user" ADD "hideOnlineStatus" boolean NOT NULL DEFAULT false`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user" DROP COLUMN "hideOnlineStatus"`, + ); + } } diff --git a/packages/backend/migration/1619942102890-password-reset.js b/packages/backend/migration/1619942102890-password-reset.js index 922d225dc..e3adeb95e 100644 --- a/packages/backend/migration/1619942102890-password-reset.js +++ b/packages/backend/migration/1619942102890-password-reset.js @@ -1,19 +1,27 @@ - - export class passwordReset1619942102890 { - constructor() { - this.name = 'passwordReset1619942102890'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "password_reset_request" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "token" character varying(256) NOT NULL, "userId" character varying(32) NOT NULL, CONSTRAINT "PK_fcf4b02eae1403a2edaf87fd074" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_0b575fa9a4cfe638a925949285" ON "password_reset_request" ("token") `); - await queryRunner.query(`CREATE INDEX "IDX_4bb7fd4a34492ae0e6cc8d30ac" ON "password_reset_request" ("userId") `); - await queryRunner.query(`ALTER TABLE "password_reset_request" ADD CONSTRAINT "FK_4bb7fd4a34492ae0e6cc8d30ac8" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "password_reset_request" DROP CONSTRAINT "FK_4bb7fd4a34492ae0e6cc8d30ac8"`); - await queryRunner.query(`DROP INDEX "IDX_4bb7fd4a34492ae0e6cc8d30ac"`); - await queryRunner.query(`DROP INDEX "IDX_0b575fa9a4cfe638a925949285"`); - await queryRunner.query(`DROP TABLE "password_reset_request"`); - } + constructor() { + this.name = "passwordReset1619942102890"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "password_reset_request" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "token" character varying(256) NOT NULL, "userId" character varying(32) NOT NULL, CONSTRAINT "PK_fcf4b02eae1403a2edaf87fd074" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_0b575fa9a4cfe638a925949285" ON "password_reset_request" ("token") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_4bb7fd4a34492ae0e6cc8d30ac" ON "password_reset_request" ("userId") `, + ); + await queryRunner.query( + `ALTER TABLE "password_reset_request" ADD CONSTRAINT "FK_4bb7fd4a34492ae0e6cc8d30ac8" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "password_reset_request" DROP CONSTRAINT "FK_4bb7fd4a34492ae0e6cc8d30ac8"`, + ); + await queryRunner.query(`DROP INDEX "IDX_4bb7fd4a34492ae0e6cc8d30ac"`); + await queryRunner.query(`DROP INDEX "IDX_0b575fa9a4cfe638a925949285"`); + await queryRunner.query(`DROP TABLE "password_reset_request"`); + } } diff --git a/packages/backend/migration/1620019354680-ad.js b/packages/backend/migration/1620019354680-ad.js index c96d2bfb3..e39b38101 100644 --- a/packages/backend/migration/1620019354680-ad.js +++ b/packages/backend/migration/1620019354680-ad.js @@ -1,17 +1,21 @@ - - export class ad1620019354680 { - constructor() { - this.name = 'ad1620019354680'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "ad" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "expiresAt" TIMESTAMP WITH TIME ZONE NOT NULL, "place" character varying(32) NOT NULL, "priority" character varying(32) NOT NULL, "url" character varying(1024) NOT NULL, "imageUrl" character varying(1024) NOT NULL, "memo" character varying(8192) NOT NULL, CONSTRAINT "PK_0193d5ef09746e88e9ea92c634d" PRIMARY KEY ("id")); COMMENT ON COLUMN "ad"."createdAt" IS 'The created date of the Ad.'; COMMENT ON COLUMN "ad"."expiresAt" IS 'The expired date of the Ad.'`); - await queryRunner.query(`CREATE INDEX "IDX_1129c2ef687fc272df040bafaa" ON "ad" ("createdAt") `); - await queryRunner.query(`CREATE INDEX "IDX_2da24ce20ad209f1d9dc032457" ON "ad" ("expiresAt") `); - } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "IDX_2da24ce20ad209f1d9dc032457"`); - await queryRunner.query(`DROP INDEX "IDX_1129c2ef687fc272df040bafaa"`); - await queryRunner.query(`DROP TABLE "ad"`); - } + constructor() { + this.name = "ad1620019354680"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "ad" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "expiresAt" TIMESTAMP WITH TIME ZONE NOT NULL, "place" character varying(32) NOT NULL, "priority" character varying(32) NOT NULL, "url" character varying(1024) NOT NULL, "imageUrl" character varying(1024) NOT NULL, "memo" character varying(8192) NOT NULL, CONSTRAINT "PK_0193d5ef09746e88e9ea92c634d" PRIMARY KEY ("id")); COMMENT ON COLUMN "ad"."createdAt" IS 'The created date of the Ad.'; COMMENT ON COLUMN "ad"."expiresAt" IS 'The expired date of the Ad.'`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_1129c2ef687fc272df040bafaa" ON "ad" ("createdAt") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_2da24ce20ad209f1d9dc032457" ON "ad" ("expiresAt") `, + ); + } + async down(queryRunner) { + await queryRunner.query(`DROP INDEX "IDX_2da24ce20ad209f1d9dc032457"`); + await queryRunner.query(`DROP INDEX "IDX_1129c2ef687fc272df040bafaa"`); + await queryRunner.query(`DROP TABLE "ad"`); + } } diff --git a/packages/backend/migration/1620364649428-ad2.js b/packages/backend/migration/1620364649428-ad2.js index db1c3e1de..a61c3ef08 100644 --- a/packages/backend/migration/1620364649428-ad2.js +++ b/packages/backend/migration/1620364649428-ad2.js @@ -1,13 +1,13 @@ - - export class ad21620364649428 { - constructor() { - this.name = 'ad21620364649428'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "ad" ADD "ratio" integer NOT NULL DEFAULT '1'`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "ad" DROP COLUMN "ratio"`); - } + constructor() { + this.name = "ad21620364649428"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "ad" ADD "ratio" integer NOT NULL DEFAULT '1'`, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "ad" DROP COLUMN "ratio"`); + } } diff --git a/packages/backend/migration/1621479946000-add-note-indexes.js b/packages/backend/migration/1621479946000-add-note-indexes.js index dcf97fa4d..f9ffbbff1 100644 --- a/packages/backend/migration/1621479946000-add-note-indexes.js +++ b/packages/backend/migration/1621479946000-add-note-indexes.js @@ -1,15 +1,22 @@ - - export class addNoteIndexes1621479946000 { - constructor() { - this.name = 'addNoteIndexes1621479946000'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE INDEX "IDX_NOTE_MENTIONS" ON "note" USING gin ("mentions")`, undefined); - await queryRunner.query(`CREATE INDEX "IDX_NOTE_VISIBLE_USER_IDS" ON "note" USING gin ("visibleUserIds")`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "IDX_NOTE_MENTIONS"`, undefined); - await queryRunner.query(`DROP INDEX "IDX_NOTE_VISIBLE_USER_IDS"`, undefined); - } + constructor() { + this.name = "addNoteIndexes1621479946000"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE INDEX "IDX_NOTE_MENTIONS" ON "note" USING gin ("mentions")`, + undefined, + ); + await queryRunner.query( + `CREATE INDEX "IDX_NOTE_VISIBLE_USER_IDS" ON "note" USING gin ("visibleUserIds")`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query(`DROP INDEX "IDX_NOTE_MENTIONS"`, undefined); + await queryRunner.query( + `DROP INDEX "IDX_NOTE_VISIBLE_USER_IDS"`, + undefined, + ); + } } diff --git a/packages/backend/migration/1622679304522-user-profile-description-length.js b/packages/backend/migration/1622679304522-user-profile-description-length.js index 22f6c1c5d..7c761c92a 100644 --- a/packages/backend/migration/1622679304522-user-profile-description-length.js +++ b/packages/backend/migration/1622679304522-user-profile-description-length.js @@ -1,13 +1,17 @@ - - export class userProfileDescriptionLength1622679304522 { - constructor() { - this.name = 'userProfileDescriptionLength1622679304522'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "description" TYPE character varying(2048)`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "description" TYPE character varying(1024)`, undefined); - } + constructor() { + this.name = "userProfileDescriptionLength1622679304522"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" ALTER COLUMN "description" TYPE character varying(2048)`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" ALTER COLUMN "description" TYPE character varying(1024)`, + undefined, + ); + } } diff --git a/packages/backend/migration/1622681548499-log-message-length.js b/packages/backend/migration/1622681548499-log-message-length.js index ac16c0e1b..9dfb7ed3d 100644 --- a/packages/backend/migration/1622681548499-log-message-length.js +++ b/packages/backend/migration/1622681548499-log-message-length.js @@ -1,13 +1,17 @@ - - export class logMessageLength1622681548499 { - constructor() { - this.name = 'logMessageLength1622681548499'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "log" ALTER COLUMN "message" TYPE character varying(2048)`, undefined); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "log" ALTER COLUMN "message" TYPE character varying(1024)`, undefined); - } + constructor() { + this.name = "logMessageLength1622681548499"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "log" ALTER COLUMN "message" TYPE character varying(2048)`, + undefined, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "log" ALTER COLUMN "message" TYPE character varying(1024)`, + undefined, + ); + } } diff --git a/packages/backend/migration/1626509500668-fix-remote-file-proxy.js b/packages/backend/migration/1626509500668-fix-remote-file-proxy.js index 30c562007..f79cfb006 100644 --- a/packages/backend/migration/1626509500668-fix-remote-file-proxy.js +++ b/packages/backend/migration/1626509500668-fix-remote-file-proxy.js @@ -1,22 +1,31 @@ - - export class fixRemoteFileProxy1626509500668 { - constructor() { - this.name = 'fixRemoteFileProxy1626509500668'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "avatarUrl"`); - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "bannerUrl"`); - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "avatarBlurhash"`); - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "bannerBlurhash"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "proxyRemoteFiles"`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "proxyRemoteFiles" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`ALTER TABLE "user" ADD "bannerBlurhash" character varying(128)`); - await queryRunner.query(`ALTER TABLE "user" ADD "avatarBlurhash" character varying(128)`); - await queryRunner.query(`ALTER TABLE "user" ADD "bannerUrl" character varying(512)`); - await queryRunner.query(`ALTER TABLE "user" ADD "avatarUrl" character varying(512)`); - } + constructor() { + this.name = "fixRemoteFileProxy1626509500668"; + } + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "avatarUrl"`); + await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "bannerUrl"`); + await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "avatarBlurhash"`); + await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "bannerBlurhash"`); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "proxyRemoteFiles"`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "proxyRemoteFiles" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `ALTER TABLE "user" ADD "bannerBlurhash" character varying(128)`, + ); + await queryRunner.query( + `ALTER TABLE "user" ADD "avatarBlurhash" character varying(128)`, + ); + await queryRunner.query( + `ALTER TABLE "user" ADD "bannerUrl" character varying(512)`, + ); + await queryRunner.query( + `ALTER TABLE "user" ADD "avatarUrl" character varying(512)`, + ); + } } - diff --git a/packages/backend/migration/1626733991004-allowlist-secure-mode.js b/packages/backend/migration/1626733991004-allowlist-secure-mode.js index aa3fcf875..6d2dd6842 100644 --- a/packages/backend/migration/1626733991004-allowlist-secure-mode.js +++ b/packages/backend/migration/1626733991004-allowlist-secure-mode.js @@ -1,11 +1,15 @@ - - -export class allowlistSecureMode1626733991004 { - name = 'allowlistSecureMode1626733991004'; +export class allowlistSecureMode1626733991004 { + name = "allowlistSecureMode1626733991004"; async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "allowedHosts" character varying(256) [] default '{}'`); - await queryRunner.query(`ALTER TABLE "meta" ADD "secureMode" bool default false`); - await queryRunner.query(`ALTER TABLE "meta" ADD "privateMode" bool default false`); + await queryRunner.query( + `ALTER TABLE "meta" ADD "allowedHosts" character varying(256) [] default '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "secureMode" bool default false`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "privateMode" bool default false`, + ); } async down(queryRunner) { @@ -14,4 +18,3 @@ export class allowlistSecureMode1626733991004 { await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "privateMode"`); } } - diff --git a/packages/backend/migration/1629004542760-chart-reindex.js b/packages/backend/migration/1629004542760-chart-reindex.js index a7d459276..8cc564b32 100644 --- a/packages/backend/migration/1629004542760-chart-reindex.js +++ b/packages/backend/migration/1629004542760-chart-reindex.js @@ -1,181 +1,357 @@ - - export class chartReindex1629004542760 { - constructor() { - this.name = 'chartReindex1629004542760'; - } - async up(queryRunner) { - await queryRunner.query(`DELETE FROM "__chart__active_users" a USING "__chart__active_users" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`); - await queryRunner.query(`DELETE FROM "__chart__drive" a USING "__chart__drive" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`); - await queryRunner.query(`DELETE FROM "__chart__federation" a USING "__chart__federation" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`); - await queryRunner.query(`DELETE FROM "__chart__hashtag" a USING "__chart__hashtag" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`); - await queryRunner.query(`DELETE FROM "__chart__instance" a USING "__chart__instance" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`); - await queryRunner.query(`DELETE FROM "__chart__network" a USING "__chart__network" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`); - await queryRunner.query(`DELETE FROM "__chart__notes" a USING "__chart__notes" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`); - await queryRunner.query(`DELETE FROM "__chart__per_user_drive" a USING "__chart__per_user_drive" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`); - await queryRunner.query(`DELETE FROM "__chart__per_user_following" a USING "__chart__per_user_following" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`); - await queryRunner.query(`DELETE FROM "__chart__per_user_notes" a USING "__chart__per_user_notes" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`); - await queryRunner.query(`DELETE FROM "__chart__per_user_reaction" a USING "__chart__per_user_reaction" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`); - await queryRunner.query(`DELETE FROM "__chart__test_grouped" a USING "__chart__test_grouped" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`); - await queryRunner.query(`DELETE FROM "__chart__test_unique" a USING "__chart__test_unique" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`); - await queryRunner.query(`DELETE FROM "__chart__users" a USING "__chart__users" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`); - await queryRunner.query(`DROP INDEX "IDX_0ad37b7ef50f4ddc84363d7ccc"`); - await queryRunner.query(`DROP INDEX "IDX_00ed5f86db1f7efafb1978bf21"`); - await queryRunner.query(`DROP INDEX "IDX_9a3ed15a30ab7e3a37702e6e08"`); - await queryRunner.query(`DROP INDEX "IDX_13565815f618a1ff53886c5b28"`); - await queryRunner.query(`DROP INDEX "IDX_7a170f67425e62a8fabb76c872"`); - await queryRunner.query(`DROP INDEX "IDX_3313d7288855ec105b5bbf6c21"`); - await queryRunner.query(`DROP INDEX "IDX_36cb699c49580d4e6c2e6159f9"`); - await queryRunner.query(`DROP INDEX "IDX_76e87c7bfc5d925fcbba405d84"`); - await queryRunner.query(`DROP INDEX "IDX_dd907becf76104e4b656659e6b"`); - await queryRunner.query(`DROP INDEX "IDX_07747a1038c05f532a718fe1de"`); - await queryRunner.query(`DROP INDEX "IDX_99a7d2faaef84a6f728d714ad6"`); - await queryRunner.query(`DROP INDEX "IDX_25a97c02003338124b2b75fdbc"`); - await queryRunner.query(`DROP INDEX "IDX_6b8f34a1a64b06014b6fb66824"`); - await queryRunner.query(`DROP INDEX "IDX_da8a46ba84ca1d8bb5a29bfb63"`); - await queryRunner.query(`DROP INDEX "IDX_39ee857ab2f23493037c6b6631"`); - await queryRunner.query(`DROP INDEX "IDX_a1efd3e0048a5f2793a47360dc"`); - await queryRunner.query(`DROP INDEX "IDX_7b5da130992ec9df96712d4290"`); - await queryRunner.query(`DROP INDEX "IDX_0a905b992fecd2b5c3fb98759e"`); - await queryRunner.query(`DROP INDEX "IDX_42eb716a37d381cdf566192b2b"`); - await queryRunner.query(`DROP INDEX "IDX_7036f2957151588b813185c794"`); - await queryRunner.query(`DROP INDEX "IDX_f09d543e3acb16c5976bdb31fa"`); - await queryRunner.query(`DROP INDEX "IDX_5f86db6492274e07c1a3cdf286"`); - await queryRunner.query(`DROP INDEX "IDX_e496ca8096d28f6b9b509264dc"`); - await queryRunner.query(`DROP INDEX "IDX_30bf67687f483ace115c5ca642"`); - await queryRunner.query(`DROP INDEX "IDX_7af07790712aa3438ff6773f3b"`); - await queryRunner.query(`DROP INDEX "IDX_4b3593098b6edc9c5afe36b18b"`); - await queryRunner.query(`DROP INDEX "IDX_b77d4dd9562c3a899d9a286fcd"`); - await queryRunner.query(`DROP INDEX "IDX_84234bd1abb873f07329681c83"`); - await queryRunner.query(`DROP INDEX "IDX_55bf20f366979f2436de99206b"`); - await queryRunner.query(`DROP INDEX "IDX_5048e9daccbbbc6d567bb142d3"`); - await queryRunner.query(`DROP INDEX "IDX_f7bf4c62059764c2c2bb40fdab"`); - await queryRunner.query(`DROP INDEX "IDX_8cf3156fd7a6b15c43459c6e3b"`); - await queryRunner.query(`DROP INDEX "IDX_229a41ad465f9205f1f5703291"`); - await queryRunner.query(`DROP INDEX "IDX_0c641990ecf47d2545df4edb75"`); - await queryRunner.query(`DROP INDEX "IDX_234dff3c0b56a6150b95431ab9"`); - await queryRunner.query(`DROP INDEX "IDX_b14489029e4b3aaf4bba5fb524"`); - await queryRunner.query(`DROP INDEX "IDX_437bab3c6061d90f6bb65fd2cc"`); - await queryRunner.query(`DROP INDEX "IDX_bbfa573a8181018851ed0b6357"`); - await queryRunner.query(`DROP INDEX "IDX_a0cd75442dd10d0643a17c4a49"`); - await queryRunner.query(`DROP INDEX "IDX_b070a906db04b44c67c6c2144d"`); - await queryRunner.query(`DROP INDEX "IDX_d41cce6aee1a50bfc062038f9b"`); - await queryRunner.query(`DROP INDEX "IDX_a319e5dbf47e8a17497623beae"`); - await queryRunner.query(`DROP INDEX "IDX_845254b3eaf708ae8a6cac3026"`); - await queryRunner.query(`DROP INDEX "IDX_ed9b95919c672a13008e9487ee"`); - await queryRunner.query(`DROP INDEX "IDX_337e9599f278bd7537fe30876f"`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_9a3ed15a30ab7e3a37702e6e08" ON "__chart__active_users" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_60c5c6e7e538c09aa274ecd1cf" ON "__chart__active_users" ("date") WHERE "group" IS NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_3313d7288855ec105b5bbf6c21" ON "__chart__drive" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_ceab80a6729f8e2e6f5b8a1a3d" ON "__chart__drive" ("date") WHERE "group" IS NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_dd907becf76104e4b656659e6b" ON "__chart__federation" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_eddfed8fb40305a04c6f941050" ON "__chart__federation" ("date") WHERE "group" IS NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_25a97c02003338124b2b75fdbc" ON "__chart__hashtag" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_53a3604b939e2b479eb2cfaac8" ON "__chart__hashtag" ("date") WHERE "group" IS NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_39ee857ab2f23493037c6b6631" ON "__chart__instance" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_8111b817b9818c04d7eb8475b1" ON "__chart__instance" ("date") WHERE "group" IS NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_0a905b992fecd2b5c3fb98759e" ON "__chart__network" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_2082327b2699ce924fa654afc5" ON "__chart__network" ("date") WHERE "group" IS NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_f09d543e3acb16c5976bdb31fa" ON "__chart__notes" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_e60c358aaced5aab8900a4af31" ON "__chart__notes" ("date") WHERE "group" IS NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_30bf67687f483ace115c5ca642" ON "__chart__per_user_drive" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_a9a806d466b314f253a1a611c4" ON "__chart__per_user_drive" ("date") WHERE "group" IS NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_b77d4dd9562c3a899d9a286fcd" ON "__chart__per_user_following" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_dabbb38a51ab86ee3cab291326" ON "__chart__per_user_following" ("date") WHERE "group" IS NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_5048e9daccbbbc6d567bb142d3" ON "__chart__per_user_notes" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_583a157ed0cf0ed1b5ec2a833f" ON "__chart__per_user_notes" ("date") WHERE "group" IS NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_229a41ad465f9205f1f5703291" ON "__chart__per_user_reaction" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_3b7697a96f522d0478972e6d6f" ON "__chart__per_user_reaction" ("date") WHERE "group" IS NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_b14489029e4b3aaf4bba5fb524" ON "__chart__test_grouped" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_da522b4008a9f5d7743b87ad55" ON "__chart__test_grouped" ("date") WHERE "group" IS NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_a0cd75442dd10d0643a17c4a49" ON "__chart__test_unique" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_16effb2e888f6763673b579f80" ON "__chart__test_unique" ("date") WHERE "group" IS NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_a319e5dbf47e8a17497623beae" ON "__chart__test" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_dab383a36f3c9db4a0c9b02cf3" ON "__chart__test" ("date") WHERE "group" IS NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_337e9599f278bd7537fe30876f" ON "__chart__users" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_66feba81e1795d176d06c0b1e6" ON "__chart__users" ("date") WHERE "group" IS NULL`); - } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "IDX_66feba81e1795d176d06c0b1e6"`); - await queryRunner.query(`DROP INDEX "IDX_337e9599f278bd7537fe30876f"`); - await queryRunner.query(`DROP INDEX "IDX_dab383a36f3c9db4a0c9b02cf3"`); - await queryRunner.query(`DROP INDEX "IDX_a319e5dbf47e8a17497623beae"`); - await queryRunner.query(`DROP INDEX "IDX_16effb2e888f6763673b579f80"`); - await queryRunner.query(`DROP INDEX "IDX_a0cd75442dd10d0643a17c4a49"`); - await queryRunner.query(`DROP INDEX "IDX_da522b4008a9f5d7743b87ad55"`); - await queryRunner.query(`DROP INDEX "IDX_b14489029e4b3aaf4bba5fb524"`); - await queryRunner.query(`DROP INDEX "IDX_3b7697a96f522d0478972e6d6f"`); - await queryRunner.query(`DROP INDEX "IDX_229a41ad465f9205f1f5703291"`); - await queryRunner.query(`DROP INDEX "IDX_583a157ed0cf0ed1b5ec2a833f"`); - await queryRunner.query(`DROP INDEX "IDX_5048e9daccbbbc6d567bb142d3"`); - await queryRunner.query(`DROP INDEX "IDX_dabbb38a51ab86ee3cab291326"`); - await queryRunner.query(`DROP INDEX "IDX_b77d4dd9562c3a899d9a286fcd"`); - await queryRunner.query(`DROP INDEX "IDX_a9a806d466b314f253a1a611c4"`); - await queryRunner.query(`DROP INDEX "IDX_30bf67687f483ace115c5ca642"`); - await queryRunner.query(`DROP INDEX "IDX_e60c358aaced5aab8900a4af31"`); - await queryRunner.query(`DROP INDEX "IDX_f09d543e3acb16c5976bdb31fa"`); - await queryRunner.query(`DROP INDEX "IDX_2082327b2699ce924fa654afc5"`); - await queryRunner.query(`DROP INDEX "IDX_0a905b992fecd2b5c3fb98759e"`); - await queryRunner.query(`DROP INDEX "IDX_8111b817b9818c04d7eb8475b1"`); - await queryRunner.query(`DROP INDEX "IDX_39ee857ab2f23493037c6b6631"`); - await queryRunner.query(`DROP INDEX "IDX_53a3604b939e2b479eb2cfaac8"`); - await queryRunner.query(`DROP INDEX "IDX_25a97c02003338124b2b75fdbc"`); - await queryRunner.query(`DROP INDEX "IDX_eddfed8fb40305a04c6f941050"`); - await queryRunner.query(`DROP INDEX "IDX_dd907becf76104e4b656659e6b"`); - await queryRunner.query(`DROP INDEX "IDX_ceab80a6729f8e2e6f5b8a1a3d"`); - await queryRunner.query(`DROP INDEX "IDX_3313d7288855ec105b5bbf6c21"`); - await queryRunner.query(`DROP INDEX "IDX_60c5c6e7e538c09aa274ecd1cf"`); - await queryRunner.query(`DROP INDEX "IDX_9a3ed15a30ab7e3a37702e6e08"`); - await queryRunner.query(`DROP INDEX "IDX_a9021cc2e1feb5f72d3db6e9f5"`); - await queryRunner.query(`DROP INDEX "IDX_f22169eb10657bded6d875ac8f"`); - await queryRunner.query(`DROP INDEX "IDX_c8cc87bd0f2f4487d17c651fbf"`); - await queryRunner.query(`DROP INDEX "IDX_754499f9b2642336433769518d"`); - await queryRunner.query(`DROP INDEX "IDX_315c779174fe8247ab324f036e"`); - await queryRunner.query(`DROP INDEX "IDX_c5d46cbfda48b1c33ed852e21b"`); - await queryRunner.query(`CREATE INDEX "IDX_337e9599f278bd7537fe30876f" ON "__chart__users" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_ed9b95919c672a13008e9487ee" ON "__chart__users" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_845254b3eaf708ae8a6cac3026" ON "__chart__users" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_a319e5dbf47e8a17497623beae" ON "__chart__test" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_d41cce6aee1a50bfc062038f9b" ON "__chart__test" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_b070a906db04b44c67c6c2144d" ON "__chart__test" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_a0cd75442dd10d0643a17c4a49" ON "__chart__test_unique" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_bbfa573a8181018851ed0b6357" ON "__chart__test_unique" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_437bab3c6061d90f6bb65fd2cc" ON "__chart__test_unique" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_b14489029e4b3aaf4bba5fb524" ON "__chart__test_grouped" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_234dff3c0b56a6150b95431ab9" ON "__chart__test_grouped" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_0c641990ecf47d2545df4edb75" ON "__chart__test_grouped" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_229a41ad465f9205f1f5703291" ON "__chart__per_user_reaction" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_8cf3156fd7a6b15c43459c6e3b" ON "__chart__per_user_reaction" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_f7bf4c62059764c2c2bb40fdab" ON "__chart__per_user_reaction" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_5048e9daccbbbc6d567bb142d3" ON "__chart__per_user_notes" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_55bf20f366979f2436de99206b" ON "__chart__per_user_notes" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_84234bd1abb873f07329681c83" ON "__chart__per_user_notes" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_b77d4dd9562c3a899d9a286fcd" ON "__chart__per_user_following" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_4b3593098b6edc9c5afe36b18b" ON "__chart__per_user_following" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_7af07790712aa3438ff6773f3b" ON "__chart__per_user_following" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_30bf67687f483ace115c5ca642" ON "__chart__per_user_drive" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_e496ca8096d28f6b9b509264dc" ON "__chart__per_user_drive" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_5f86db6492274e07c1a3cdf286" ON "__chart__per_user_drive" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_f09d543e3acb16c5976bdb31fa" ON "__chart__notes" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_7036f2957151588b813185c794" ON "__chart__notes" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_42eb716a37d381cdf566192b2b" ON "__chart__notes" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_0a905b992fecd2b5c3fb98759e" ON "__chart__network" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_7b5da130992ec9df96712d4290" ON "__chart__network" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_a1efd3e0048a5f2793a47360dc" ON "__chart__network" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_39ee857ab2f23493037c6b6631" ON "__chart__instance" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_da8a46ba84ca1d8bb5a29bfb63" ON "__chart__instance" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_6b8f34a1a64b06014b6fb66824" ON "__chart__instance" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_25a97c02003338124b2b75fdbc" ON "__chart__hashtag" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_99a7d2faaef84a6f728d714ad6" ON "__chart__hashtag" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_07747a1038c05f532a718fe1de" ON "__chart__hashtag" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_dd907becf76104e4b656659e6b" ON "__chart__federation" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_76e87c7bfc5d925fcbba405d84" ON "__chart__federation" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_36cb699c49580d4e6c2e6159f9" ON "__chart__federation" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_3313d7288855ec105b5bbf6c21" ON "__chart__drive" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_7a170f67425e62a8fabb76c872" ON "__chart__drive" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_13565815f618a1ff53886c5b28" ON "__chart__drive" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_9a3ed15a30ab7e3a37702e6e08" ON "__chart__active_users" ("date", "group") `); - await queryRunner.query(`CREATE INDEX "IDX_00ed5f86db1f7efafb1978bf21" ON "__chart__active_users" ("group") `); - await queryRunner.query(`CREATE INDEX "IDX_0ad37b7ef50f4ddc84363d7ccc" ON "__chart__active_users" ("date") `); - } + constructor() { + this.name = "chartReindex1629004542760"; + } + async up(queryRunner) { + await queryRunner.query( + `DELETE FROM "__chart__active_users" a USING "__chart__active_users" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`, + ); + await queryRunner.query( + `DELETE FROM "__chart__drive" a USING "__chart__drive" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`, + ); + await queryRunner.query( + `DELETE FROM "__chart__federation" a USING "__chart__federation" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`, + ); + await queryRunner.query( + `DELETE FROM "__chart__hashtag" a USING "__chart__hashtag" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`, + ); + await queryRunner.query( + `DELETE FROM "__chart__instance" a USING "__chart__instance" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`, + ); + await queryRunner.query( + `DELETE FROM "__chart__network" a USING "__chart__network" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`, + ); + await queryRunner.query( + `DELETE FROM "__chart__notes" a USING "__chart__notes" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`, + ); + await queryRunner.query( + `DELETE FROM "__chart__per_user_drive" a USING "__chart__per_user_drive" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`, + ); + await queryRunner.query( + `DELETE FROM "__chart__per_user_following" a USING "__chart__per_user_following" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`, + ); + await queryRunner.query( + `DELETE FROM "__chart__per_user_notes" a USING "__chart__per_user_notes" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`, + ); + await queryRunner.query( + `DELETE FROM "__chart__per_user_reaction" a USING "__chart__per_user_reaction" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`, + ); + await queryRunner.query( + `DELETE FROM "__chart__test_grouped" a USING "__chart__test_grouped" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`, + ); + await queryRunner.query( + `DELETE FROM "__chart__test_unique" a USING "__chart__test_unique" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`, + ); + await queryRunner.query( + `DELETE FROM "__chart__users" a USING "__chart__users" b WHERE a.id < b.id AND ((a.group IS NULL AND b.group IS NULL) OR a.group = b.group) AND a.date = b.date;`, + ); + await queryRunner.query(`DROP INDEX "IDX_0ad37b7ef50f4ddc84363d7ccc"`); + await queryRunner.query(`DROP INDEX "IDX_00ed5f86db1f7efafb1978bf21"`); + await queryRunner.query(`DROP INDEX "IDX_9a3ed15a30ab7e3a37702e6e08"`); + await queryRunner.query(`DROP INDEX "IDX_13565815f618a1ff53886c5b28"`); + await queryRunner.query(`DROP INDEX "IDX_7a170f67425e62a8fabb76c872"`); + await queryRunner.query(`DROP INDEX "IDX_3313d7288855ec105b5bbf6c21"`); + await queryRunner.query(`DROP INDEX "IDX_36cb699c49580d4e6c2e6159f9"`); + await queryRunner.query(`DROP INDEX "IDX_76e87c7bfc5d925fcbba405d84"`); + await queryRunner.query(`DROP INDEX "IDX_dd907becf76104e4b656659e6b"`); + await queryRunner.query(`DROP INDEX "IDX_07747a1038c05f532a718fe1de"`); + await queryRunner.query(`DROP INDEX "IDX_99a7d2faaef84a6f728d714ad6"`); + await queryRunner.query(`DROP INDEX "IDX_25a97c02003338124b2b75fdbc"`); + await queryRunner.query(`DROP INDEX "IDX_6b8f34a1a64b06014b6fb66824"`); + await queryRunner.query(`DROP INDEX "IDX_da8a46ba84ca1d8bb5a29bfb63"`); + await queryRunner.query(`DROP INDEX "IDX_39ee857ab2f23493037c6b6631"`); + await queryRunner.query(`DROP INDEX "IDX_a1efd3e0048a5f2793a47360dc"`); + await queryRunner.query(`DROP INDEX "IDX_7b5da130992ec9df96712d4290"`); + await queryRunner.query(`DROP INDEX "IDX_0a905b992fecd2b5c3fb98759e"`); + await queryRunner.query(`DROP INDEX "IDX_42eb716a37d381cdf566192b2b"`); + await queryRunner.query(`DROP INDEX "IDX_7036f2957151588b813185c794"`); + await queryRunner.query(`DROP INDEX "IDX_f09d543e3acb16c5976bdb31fa"`); + await queryRunner.query(`DROP INDEX "IDX_5f86db6492274e07c1a3cdf286"`); + await queryRunner.query(`DROP INDEX "IDX_e496ca8096d28f6b9b509264dc"`); + await queryRunner.query(`DROP INDEX "IDX_30bf67687f483ace115c5ca642"`); + await queryRunner.query(`DROP INDEX "IDX_7af07790712aa3438ff6773f3b"`); + await queryRunner.query(`DROP INDEX "IDX_4b3593098b6edc9c5afe36b18b"`); + await queryRunner.query(`DROP INDEX "IDX_b77d4dd9562c3a899d9a286fcd"`); + await queryRunner.query(`DROP INDEX "IDX_84234bd1abb873f07329681c83"`); + await queryRunner.query(`DROP INDEX "IDX_55bf20f366979f2436de99206b"`); + await queryRunner.query(`DROP INDEX "IDX_5048e9daccbbbc6d567bb142d3"`); + await queryRunner.query(`DROP INDEX "IDX_f7bf4c62059764c2c2bb40fdab"`); + await queryRunner.query(`DROP INDEX "IDX_8cf3156fd7a6b15c43459c6e3b"`); + await queryRunner.query(`DROP INDEX "IDX_229a41ad465f9205f1f5703291"`); + await queryRunner.query(`DROP INDEX "IDX_0c641990ecf47d2545df4edb75"`); + await queryRunner.query(`DROP INDEX "IDX_234dff3c0b56a6150b95431ab9"`); + await queryRunner.query(`DROP INDEX "IDX_b14489029e4b3aaf4bba5fb524"`); + await queryRunner.query(`DROP INDEX "IDX_437bab3c6061d90f6bb65fd2cc"`); + await queryRunner.query(`DROP INDEX "IDX_bbfa573a8181018851ed0b6357"`); + await queryRunner.query(`DROP INDEX "IDX_a0cd75442dd10d0643a17c4a49"`); + await queryRunner.query(`DROP INDEX "IDX_b070a906db04b44c67c6c2144d"`); + await queryRunner.query(`DROP INDEX "IDX_d41cce6aee1a50bfc062038f9b"`); + await queryRunner.query(`DROP INDEX "IDX_a319e5dbf47e8a17497623beae"`); + await queryRunner.query(`DROP INDEX "IDX_845254b3eaf708ae8a6cac3026"`); + await queryRunner.query(`DROP INDEX "IDX_ed9b95919c672a13008e9487ee"`); + await queryRunner.query(`DROP INDEX "IDX_337e9599f278bd7537fe30876f"`); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_9a3ed15a30ab7e3a37702e6e08" ON "__chart__active_users" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_60c5c6e7e538c09aa274ecd1cf" ON "__chart__active_users" ("date") WHERE "group" IS NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_3313d7288855ec105b5bbf6c21" ON "__chart__drive" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_ceab80a6729f8e2e6f5b8a1a3d" ON "__chart__drive" ("date") WHERE "group" IS NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_dd907becf76104e4b656659e6b" ON "__chart__federation" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_eddfed8fb40305a04c6f941050" ON "__chart__federation" ("date") WHERE "group" IS NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_25a97c02003338124b2b75fdbc" ON "__chart__hashtag" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_53a3604b939e2b479eb2cfaac8" ON "__chart__hashtag" ("date") WHERE "group" IS NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_39ee857ab2f23493037c6b6631" ON "__chart__instance" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_8111b817b9818c04d7eb8475b1" ON "__chart__instance" ("date") WHERE "group" IS NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_0a905b992fecd2b5c3fb98759e" ON "__chart__network" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_2082327b2699ce924fa654afc5" ON "__chart__network" ("date") WHERE "group" IS NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_f09d543e3acb16c5976bdb31fa" ON "__chart__notes" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_e60c358aaced5aab8900a4af31" ON "__chart__notes" ("date") WHERE "group" IS NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_30bf67687f483ace115c5ca642" ON "__chart__per_user_drive" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_a9a806d466b314f253a1a611c4" ON "__chart__per_user_drive" ("date") WHERE "group" IS NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_b77d4dd9562c3a899d9a286fcd" ON "__chart__per_user_following" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_dabbb38a51ab86ee3cab291326" ON "__chart__per_user_following" ("date") WHERE "group" IS NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_5048e9daccbbbc6d567bb142d3" ON "__chart__per_user_notes" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_583a157ed0cf0ed1b5ec2a833f" ON "__chart__per_user_notes" ("date") WHERE "group" IS NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_229a41ad465f9205f1f5703291" ON "__chart__per_user_reaction" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_3b7697a96f522d0478972e6d6f" ON "__chart__per_user_reaction" ("date") WHERE "group" IS NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_b14489029e4b3aaf4bba5fb524" ON "__chart__test_grouped" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_da522b4008a9f5d7743b87ad55" ON "__chart__test_grouped" ("date") WHERE "group" IS NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_a0cd75442dd10d0643a17c4a49" ON "__chart__test_unique" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_16effb2e888f6763673b579f80" ON "__chart__test_unique" ("date") WHERE "group" IS NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_a319e5dbf47e8a17497623beae" ON "__chart__test" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_dab383a36f3c9db4a0c9b02cf3" ON "__chart__test" ("date") WHERE "group" IS NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_337e9599f278bd7537fe30876f" ON "__chart__users" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_66feba81e1795d176d06c0b1e6" ON "__chart__users" ("date") WHERE "group" IS NULL`, + ); + } + async down(queryRunner) { + await queryRunner.query(`DROP INDEX "IDX_66feba81e1795d176d06c0b1e6"`); + await queryRunner.query(`DROP INDEX "IDX_337e9599f278bd7537fe30876f"`); + await queryRunner.query(`DROP INDEX "IDX_dab383a36f3c9db4a0c9b02cf3"`); + await queryRunner.query(`DROP INDEX "IDX_a319e5dbf47e8a17497623beae"`); + await queryRunner.query(`DROP INDEX "IDX_16effb2e888f6763673b579f80"`); + await queryRunner.query(`DROP INDEX "IDX_a0cd75442dd10d0643a17c4a49"`); + await queryRunner.query(`DROP INDEX "IDX_da522b4008a9f5d7743b87ad55"`); + await queryRunner.query(`DROP INDEX "IDX_b14489029e4b3aaf4bba5fb524"`); + await queryRunner.query(`DROP INDEX "IDX_3b7697a96f522d0478972e6d6f"`); + await queryRunner.query(`DROP INDEX "IDX_229a41ad465f9205f1f5703291"`); + await queryRunner.query(`DROP INDEX "IDX_583a157ed0cf0ed1b5ec2a833f"`); + await queryRunner.query(`DROP INDEX "IDX_5048e9daccbbbc6d567bb142d3"`); + await queryRunner.query(`DROP INDEX "IDX_dabbb38a51ab86ee3cab291326"`); + await queryRunner.query(`DROP INDEX "IDX_b77d4dd9562c3a899d9a286fcd"`); + await queryRunner.query(`DROP INDEX "IDX_a9a806d466b314f253a1a611c4"`); + await queryRunner.query(`DROP INDEX "IDX_30bf67687f483ace115c5ca642"`); + await queryRunner.query(`DROP INDEX "IDX_e60c358aaced5aab8900a4af31"`); + await queryRunner.query(`DROP INDEX "IDX_f09d543e3acb16c5976bdb31fa"`); + await queryRunner.query(`DROP INDEX "IDX_2082327b2699ce924fa654afc5"`); + await queryRunner.query(`DROP INDEX "IDX_0a905b992fecd2b5c3fb98759e"`); + await queryRunner.query(`DROP INDEX "IDX_8111b817b9818c04d7eb8475b1"`); + await queryRunner.query(`DROP INDEX "IDX_39ee857ab2f23493037c6b6631"`); + await queryRunner.query(`DROP INDEX "IDX_53a3604b939e2b479eb2cfaac8"`); + await queryRunner.query(`DROP INDEX "IDX_25a97c02003338124b2b75fdbc"`); + await queryRunner.query(`DROP INDEX "IDX_eddfed8fb40305a04c6f941050"`); + await queryRunner.query(`DROP INDEX "IDX_dd907becf76104e4b656659e6b"`); + await queryRunner.query(`DROP INDEX "IDX_ceab80a6729f8e2e6f5b8a1a3d"`); + await queryRunner.query(`DROP INDEX "IDX_3313d7288855ec105b5bbf6c21"`); + await queryRunner.query(`DROP INDEX "IDX_60c5c6e7e538c09aa274ecd1cf"`); + await queryRunner.query(`DROP INDEX "IDX_9a3ed15a30ab7e3a37702e6e08"`); + await queryRunner.query(`DROP INDEX "IDX_a9021cc2e1feb5f72d3db6e9f5"`); + await queryRunner.query(`DROP INDEX "IDX_f22169eb10657bded6d875ac8f"`); + await queryRunner.query(`DROP INDEX "IDX_c8cc87bd0f2f4487d17c651fbf"`); + await queryRunner.query(`DROP INDEX "IDX_754499f9b2642336433769518d"`); + await queryRunner.query(`DROP INDEX "IDX_315c779174fe8247ab324f036e"`); + await queryRunner.query(`DROP INDEX "IDX_c5d46cbfda48b1c33ed852e21b"`); + await queryRunner.query( + `CREATE INDEX "IDX_337e9599f278bd7537fe30876f" ON "__chart__users" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_ed9b95919c672a13008e9487ee" ON "__chart__users" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_845254b3eaf708ae8a6cac3026" ON "__chart__users" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_a319e5dbf47e8a17497623beae" ON "__chart__test" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_d41cce6aee1a50bfc062038f9b" ON "__chart__test" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_b070a906db04b44c67c6c2144d" ON "__chart__test" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_a0cd75442dd10d0643a17c4a49" ON "__chart__test_unique" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_bbfa573a8181018851ed0b6357" ON "__chart__test_unique" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_437bab3c6061d90f6bb65fd2cc" ON "__chart__test_unique" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_b14489029e4b3aaf4bba5fb524" ON "__chart__test_grouped" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_234dff3c0b56a6150b95431ab9" ON "__chart__test_grouped" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0c641990ecf47d2545df4edb75" ON "__chart__test_grouped" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_229a41ad465f9205f1f5703291" ON "__chart__per_user_reaction" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_8cf3156fd7a6b15c43459c6e3b" ON "__chart__per_user_reaction" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f7bf4c62059764c2c2bb40fdab" ON "__chart__per_user_reaction" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_5048e9daccbbbc6d567bb142d3" ON "__chart__per_user_notes" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_55bf20f366979f2436de99206b" ON "__chart__per_user_notes" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_84234bd1abb873f07329681c83" ON "__chart__per_user_notes" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_b77d4dd9562c3a899d9a286fcd" ON "__chart__per_user_following" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_4b3593098b6edc9c5afe36b18b" ON "__chart__per_user_following" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_7af07790712aa3438ff6773f3b" ON "__chart__per_user_following" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_30bf67687f483ace115c5ca642" ON "__chart__per_user_drive" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_e496ca8096d28f6b9b509264dc" ON "__chart__per_user_drive" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_5f86db6492274e07c1a3cdf286" ON "__chart__per_user_drive" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f09d543e3acb16c5976bdb31fa" ON "__chart__notes" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_7036f2957151588b813185c794" ON "__chart__notes" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_42eb716a37d381cdf566192b2b" ON "__chart__notes" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0a905b992fecd2b5c3fb98759e" ON "__chart__network" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_7b5da130992ec9df96712d4290" ON "__chart__network" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_a1efd3e0048a5f2793a47360dc" ON "__chart__network" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_39ee857ab2f23493037c6b6631" ON "__chart__instance" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_da8a46ba84ca1d8bb5a29bfb63" ON "__chart__instance" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b8f34a1a64b06014b6fb66824" ON "__chart__instance" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_25a97c02003338124b2b75fdbc" ON "__chart__hashtag" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_99a7d2faaef84a6f728d714ad6" ON "__chart__hashtag" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_07747a1038c05f532a718fe1de" ON "__chart__hashtag" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_dd907becf76104e4b656659e6b" ON "__chart__federation" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_76e87c7bfc5d925fcbba405d84" ON "__chart__federation" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_36cb699c49580d4e6c2e6159f9" ON "__chart__federation" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_3313d7288855ec105b5bbf6c21" ON "__chart__drive" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_7a170f67425e62a8fabb76c872" ON "__chart__drive" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_13565815f618a1ff53886c5b28" ON "__chart__drive" ("date") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_9a3ed15a30ab7e3a37702e6e08" ON "__chart__active_users" ("date", "group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_00ed5f86db1f7efafb1978bf21" ON "__chart__active_users" ("group") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_0ad37b7ef50f4ddc84363d7ccc" ON "__chart__active_users" ("date") `, + ); + } } diff --git a/packages/backend/migration/1629024377804-deepl-integration.js b/packages/backend/migration/1629024377804-deepl-integration.js index 19c49ffcd..1dd5465fb 100644 --- a/packages/backend/migration/1629024377804-deepl-integration.js +++ b/packages/backend/migration/1629024377804-deepl-integration.js @@ -1,13 +1,13 @@ - - export class deeplIntegration1629024377804 { - constructor() { - this.name = 'deeplIntegration1629024377804'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "deeplAuthKey" character varying(128)`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "deeplAuthKey"`); - } + constructor() { + this.name = "deeplIntegration1629024377804"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "deeplAuthKey" character varying(128)`, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "deeplAuthKey"`); + } } diff --git a/packages/backend/migration/1629288472000-fix-channel-userId.js b/packages/backend/migration/1629288472000-fix-channel-userId.js index 02a1199b0..e02549b11 100644 --- a/packages/backend/migration/1629288472000-fix-channel-userId.js +++ b/packages/backend/migration/1629288472000-fix-channel-userId.js @@ -1,13 +1,15 @@ - - export class fixChannelUserId1629288472000 { - constructor() { - this.name = 'fixChannelUserId1629288472000'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "channel" ALTER COLUMN "userId" DROP NOT NULL;`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "channel" ALTER COLUMN "userId" SET NOT NULL;`); - } + constructor() { + this.name = "fixChannelUserId1629288472000"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "channel" ALTER COLUMN "userId" DROP NOT NULL;`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "channel" ALTER COLUMN "userId" SET NOT NULL;`, + ); + } } diff --git a/packages/backend/migration/1629512953000-user-is-deleted.js b/packages/backend/migration/1629512953000-user-is-deleted.js index a7848d569..448535276 100644 --- a/packages/backend/migration/1629512953000-user-is-deleted.js +++ b/packages/backend/migration/1629512953000-user-is-deleted.js @@ -1,14 +1,16 @@ - - export class isUserDeleted1629512953000 { - constructor() { - this.name = 'isUserDeleted1629512953000'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user" ADD "isDeleted" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`COMMENT ON COLUMN "user"."isDeleted" IS 'Whether the User is deleted.'`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "isDeleted"`); - } + constructor() { + this.name = "isUserDeleted1629512953000"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user" ADD "isDeleted" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."isDeleted" IS 'Whether the User is deleted.'`, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "isDeleted"`); + } } diff --git a/packages/backend/migration/1629778475000-deepl-integration2.js b/packages/backend/migration/1629778475000-deepl-integration2.js index 699f06c76..138e00d24 100644 --- a/packages/backend/migration/1629778475000-deepl-integration2.js +++ b/packages/backend/migration/1629778475000-deepl-integration2.js @@ -1,13 +1,13 @@ - - export class deeplIntegration21629778475000 { - constructor() { - this.name = 'deeplIntegration21629778475000'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "deeplIsPro" boolean NOT NULL DEFAULT false`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "deeplIsPro"`); - } + constructor() { + this.name = "deeplIntegration21629778475000"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "deeplIsPro" boolean NOT NULL DEFAULT false`, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "deeplIsPro"`); + } } diff --git a/packages/backend/migration/1629833361000-AddShowTLReplies.js b/packages/backend/migration/1629833361000-AddShowTLReplies.js index 5d4c938a7..78e9f417b 100644 --- a/packages/backend/migration/1629833361000-AddShowTLReplies.js +++ b/packages/backend/migration/1629833361000-AddShowTLReplies.js @@ -1,14 +1,18 @@ - - export class addShowTLReplies1629833361000 { constructor() { - this.name = 'addShowTLReplies1629833361000'; + this.name = "addShowTLReplies1629833361000"; } async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user" ADD "showTimelineReplies" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`COMMENT ON COLUMN "user"."showTimelineReplies" IS 'Whether to show users replying to other users in the timeline.'`); + await queryRunner.query( + `ALTER TABLE "user" ADD "showTimelineReplies" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."showTimelineReplies" IS 'Whether to show users replying to other users in the timeline.'`, + ); } async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "showTimelineReplies"`); + await queryRunner.query( + `ALTER TABLE "user" DROP COLUMN "showTimelineReplies"`, + ); } } diff --git a/packages/backend/migration/1629968054000_userInstanceBlocks.js b/packages/backend/migration/1629968054000_userInstanceBlocks.js index 1f202d9f6..666aaba28 100644 --- a/packages/backend/migration/1629968054000_userInstanceBlocks.js +++ b/packages/backend/migration/1629968054000_userInstanceBlocks.js @@ -1,14 +1,18 @@ - - export class userInstanceBlocks1629968054000 { constructor() { - this.name = 'userInstanceBlocks1629968054000'; + this.name = "userInstanceBlocks1629968054000"; } async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" ADD "mutedInstances" jsonb NOT NULL DEFAULT '[]'`); - await queryRunner.query(`COMMENT ON COLUMN "user_profile"."mutedInstances" IS 'List of instances muted by the user.'`); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "mutedInstances" jsonb NOT NULL DEFAULT '[]'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user_profile"."mutedInstances" IS 'List of instances muted by the user.'`, + ); } async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "mutedInstances"`); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "mutedInstances"`, + ); } } diff --git a/packages/backend/migration/1633068642000-email-required-for-signup.js b/packages/backend/migration/1633068642000-email-required-for-signup.js index d592f3ca2..45c0894a7 100644 --- a/packages/backend/migration/1633068642000-email-required-for-signup.js +++ b/packages/backend/migration/1633068642000-email-required-for-signup.js @@ -1,13 +1,15 @@ - - export class emailRequiredForSignup1633068642000 { - constructor() { - this.name = 'emailRequiredForSignup1633068642000'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "emailRequiredForSignup" boolean NOT NULL DEFAULT false`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "emailRequiredForSignup"`); - } + constructor() { + this.name = "emailRequiredForSignup1633068642000"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "emailRequiredForSignup" boolean NOT NULL DEFAULT false`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "emailRequiredForSignup"`, + ); + } } diff --git a/packages/backend/migration/1633071909016-user-pending.js b/packages/backend/migration/1633071909016-user-pending.js index 17cf5c11b..b37e51629 100644 --- a/packages/backend/migration/1633071909016-user-pending.js +++ b/packages/backend/migration/1633071909016-user-pending.js @@ -1,15 +1,17 @@ - - export class userPending1633071909016 { - constructor() { - this.name = 'userPending1633071909016'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "user_pending" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "code" character varying(128) NOT NULL, "username" character varying(128) NOT NULL, "email" character varying(128) NOT NULL, "password" character varying(128) NOT NULL, CONSTRAINT "PK_d4c84e013c98ec02d19b8fbbafa" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_4e5c4c99175638ec0761714ab0" ON "user_pending" ("code") `); - } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "IDX_4e5c4c99175638ec0761714ab0"`); - await queryRunner.query(`DROP TABLE "user_pending"`); - } + constructor() { + this.name = "userPending1633071909016"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "user_pending" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "code" character varying(128) NOT NULL, "username" character varying(128) NOT NULL, "email" character varying(128) NOT NULL, "password" character varying(128) NOT NULL, CONSTRAINT "PK_d4c84e013c98ec02d19b8fbbafa" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_4e5c4c99175638ec0761714ab0" ON "user_pending" ("code") `, + ); + } + async down(queryRunner) { + await queryRunner.query(`DROP INDEX "IDX_4e5c4c99175638ec0761714ab0"`); + await queryRunner.query(`DROP TABLE "user_pending"`); + } } diff --git a/packages/backend/migration/1634486652000-user-public-reactions.js b/packages/backend/migration/1634486652000-user-public-reactions.js index e74112249..95b957f11 100644 --- a/packages/backend/migration/1634486652000-user-public-reactions.js +++ b/packages/backend/migration/1634486652000-user-public-reactions.js @@ -1,13 +1,15 @@ - - export class userPublicReactions1634486652000 { - constructor() { - this.name = 'userPublicReactions1634486652000'; - } - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" ADD "publicReactions" boolean NOT NULL DEFAULT false`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "publicReactions"`); - } + constructor() { + this.name = "userPublicReactions1634486652000"; + } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "publicReactions" boolean NOT NULL DEFAULT false`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "publicReactions"`, + ); + } } diff --git a/packages/backend/migration/1634902659689-delete-log.js b/packages/backend/migration/1634902659689-delete-log.js index 555a0020c..fc148f098 100644 --- a/packages/backend/migration/1634902659689-delete-log.js +++ b/packages/backend/migration/1634902659689-delete-log.js @@ -1,12 +1,9 @@ - - export class deleteLog1634902659689 { - constructor() { - this.name = 'deleteLog1634902659689'; - } - async up(queryRunner) { - await queryRunner.query(`DROP TABLE "log"`); - } - async down(queryRunner) { - } + constructor() { + this.name = "deleteLog1634902659689"; + } + async up(queryRunner) { + await queryRunner.query(`DROP TABLE "log"`); + } + async down(queryRunner) {} } diff --git a/packages/backend/migration/1635500777168-note-thread-mute.js b/packages/backend/migration/1635500777168-note-thread-mute.js index a790cace3..5fcfa40c0 100644 --- a/packages/backend/migration/1635500777168-note-thread-mute.js +++ b/packages/backend/migration/1635500777168-note-thread-mute.js @@ -1,25 +1,47 @@ - - export class noteThreadMute1635500777168 { - constructor() { - this.name = 'noteThreadMute1635500777168'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "note_thread_muting" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "threadId" character varying(256) NOT NULL, CONSTRAINT "PK_ec5936d94d1a0369646d12a3a47" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_29c11c7deb06615076f8c95b80" ON "note_thread_muting" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_c426394644267453e76f036926" ON "note_thread_muting" ("threadId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_ae7aab18a2641d3e5f25e0c4ea" ON "note_thread_muting" ("userId", "threadId") `); - await queryRunner.query(`ALTER TABLE "note" ADD "threadId" character varying(256)`); - await queryRunner.query(`CREATE INDEX "IDX_d4ebdef929896d6dc4a3c5bb48" ON "note" ("threadId") `); - await queryRunner.query(`ALTER TABLE "note_thread_muting" ADD CONSTRAINT "FK_29c11c7deb06615076f8c95b80a" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "note_thread_muting" DROP CONSTRAINT "FK_29c11c7deb06615076f8c95b80a"`); - await queryRunner.query(`DROP INDEX "public"."IDX_d4ebdef929896d6dc4a3c5bb48"`); - await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "threadId"`); - await queryRunner.query(`DROP INDEX "public"."IDX_ae7aab18a2641d3e5f25e0c4ea"`); - await queryRunner.query(`DROP INDEX "public"."IDX_c426394644267453e76f036926"`); - await queryRunner.query(`DROP INDEX "public"."IDX_29c11c7deb06615076f8c95b80"`); - await queryRunner.query(`DROP TABLE "note_thread_muting"`); - } + constructor() { + this.name = "noteThreadMute1635500777168"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "note_thread_muting" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "threadId" character varying(256) NOT NULL, CONSTRAINT "PK_ec5936d94d1a0369646d12a3a47" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_29c11c7deb06615076f8c95b80" ON "note_thread_muting" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_c426394644267453e76f036926" ON "note_thread_muting" ("threadId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_ae7aab18a2641d3e5f25e0c4ea" ON "note_thread_muting" ("userId", "threadId") `, + ); + await queryRunner.query( + `ALTER TABLE "note" ADD "threadId" character varying(256)`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_d4ebdef929896d6dc4a3c5bb48" ON "note" ("threadId") `, + ); + await queryRunner.query( + `ALTER TABLE "note_thread_muting" ADD CONSTRAINT "FK_29c11c7deb06615076f8c95b80a" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "note_thread_muting" DROP CONSTRAINT "FK_29c11c7deb06615076f8c95b80a"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_d4ebdef929896d6dc4a3c5bb48"`, + ); + await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "threadId"`); + await queryRunner.query( + `DROP INDEX "public"."IDX_ae7aab18a2641d3e5f25e0c4ea"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_c426394644267453e76f036926"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_29c11c7deb06615076f8c95b80"`, + ); + await queryRunner.query(`DROP TABLE "note_thread_muting"`); + } } diff --git a/packages/backend/migration/1636197624383-ff-visibility.js b/packages/backend/migration/1636197624383-ff-visibility.js index 89028f3c2..a3af8f718 100644 --- a/packages/backend/migration/1636197624383-ff-visibility.js +++ b/packages/backend/migration/1636197624383-ff-visibility.js @@ -1,15 +1,21 @@ - - export class ffVisibility1636197624383 { - constructor() { - this.name = 'ffVisibility1636197624383'; - } - async up(queryRunner) { - await queryRunner.query(`CREATE TYPE "public"."user_profile_ffvisibility_enum" AS ENUM('public', 'followers', 'private')`); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "ffVisibility" "public"."user_profile_ffvisibility_enum" NOT NULL DEFAULT 'public'`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "ffVisibility"`); - await queryRunner.query(`DROP TYPE "public"."user_profile_ffvisibility_enum"`); - } + constructor() { + this.name = "ffVisibility1636197624383"; + } + async up(queryRunner) { + await queryRunner.query( + `CREATE TYPE "public"."user_profile_ffvisibility_enum" AS ENUM('public', 'followers', 'private')`, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "ffVisibility" "public"."user_profile_ffvisibility_enum" NOT NULL DEFAULT 'public'`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "ffVisibility"`, + ); + await queryRunner.query( + `DROP TYPE "public"."user_profile_ffvisibility_enum"`, + ); + } } diff --git a/packages/backend/migration/1636697408073-remove-via-mobile.js b/packages/backend/migration/1636697408073-remove-via-mobile.js index 36e96fd21..f86276024 100644 --- a/packages/backend/migration/1636697408073-remove-via-mobile.js +++ b/packages/backend/migration/1636697408073-remove-via-mobile.js @@ -1,13 +1,13 @@ - - export class removeViaMobile1636697408073 { - name = 'removeViaMobile1636697408073' + name = "removeViaMobile1636697408073"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "viaMobile"`); - } + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "viaMobile"`); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "note" ADD "viaMobile" boolean NOT NULL DEFAULT false`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "note" ADD "viaMobile" boolean NOT NULL DEFAULT false`, + ); + } } diff --git a/packages/backend/migration/1637320813000-forwarded-report.js b/packages/backend/migration/1637320813000-forwarded-report.js index 1e39bd5c3..18ec17206 100644 --- a/packages/backend/migration/1637320813000-forwarded-report.js +++ b/packages/backend/migration/1637320813000-forwarded-report.js @@ -1,13 +1,15 @@ - - export class forwardedReport1637320813000 { - name = 'forwardedReport1637320813000'; + name = "forwardedReport1637320813000"; async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "abuse_user_report" ADD "forwarded" boolean NOT NULL DEFAULT false`); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" ADD "forwarded" boolean NOT NULL DEFAULT false`, + ); } async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "abuse_user_report" DROP COLUMN "forwarded"`); + await queryRunner.query( + `ALTER TABLE "abuse_user_report" DROP COLUMN "forwarded"`, + ); } -}; +} diff --git a/packages/backend/migration/1639325650583-chart-v3.js b/packages/backend/migration/1639325650583-chart-v3.js index e2a4e920c..011708c0f 100644 --- a/packages/backend/migration/1639325650583-chart-v3.js +++ b/packages/backend/migration/1639325650583-chart-v3.js @@ -1,189 +1,511 @@ - - export class chartV31639325650583 { - name = 'chartV31639325650583' + name = "chartV31639325650583"; - async up(queryRunner) { - await queryRunner.query(`DELETE FROM "__chart__per_user_drive" WHERE "group" IS NULL`); + async up(queryRunner) { + await queryRunner.query( + `DELETE FROM "__chart__per_user_drive" WHERE "group" IS NULL`, + ); - await queryRunner.query(`DROP INDEX "public"."IDX_dd907becf76104e4b656659e6b"`); - await queryRunner.query(`DROP INDEX "public"."IDX_eddfed8fb40305a04c6f941050"`); - await queryRunner.query(`DROP INDEX "public"."IDX_f09d543e3acb16c5976bdb31fa"`); - await queryRunner.query(`DROP INDEX "public"."IDX_e60c358aaced5aab8900a4af31"`); - await queryRunner.query(`DROP INDEX "public"."IDX_337e9599f278bd7537fe30876f"`); - await queryRunner.query(`DROP INDEX "public"."IDX_66feba81e1795d176d06c0b1e6"`); - await queryRunner.query(`DROP INDEX "public"."IDX_0a905b992fecd2b5c3fb98759e"`); - await queryRunner.query(`DROP INDEX "public"."IDX_2082327b2699ce924fa654afc5"`); - await queryRunner.query(`DROP INDEX "public"."IDX_9a3ed15a30ab7e3a37702e6e08"`); - await queryRunner.query(`DROP INDEX "public"."IDX_60c5c6e7e538c09aa274ecd1cf"`); - await queryRunner.query(`DROP INDEX "public"."IDX_8111b817b9818c04d7eb8475b1"`); - await queryRunner.query(`DROP INDEX "public"."IDX_583a157ed0cf0ed1b5ec2a833f"`); - await queryRunner.query(`DROP INDEX "public"."IDX_3313d7288855ec105b5bbf6c21"`); - await queryRunner.query(`DROP INDEX "public"."IDX_ceab80a6729f8e2e6f5b8a1a3d"`); - await queryRunner.query(`DROP INDEX "public"."IDX_3b7697a96f522d0478972e6d6f"`); - await queryRunner.query(`DROP INDEX "public"."IDX_53a3604b939e2b479eb2cfaac8"`); - await queryRunner.query(`DROP INDEX "public"."IDX_dabbb38a51ab86ee3cab291326"`); - await queryRunner.query(`DROP INDEX "public"."IDX_a9a806d466b314f253a1a611c4"`); - await queryRunner.query(`CREATE TABLE "__chart_day__federation" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "___instance_total" bigint NOT NULL, "___instance_inc" bigint NOT NULL, "___instance_dec" bigint NOT NULL, CONSTRAINT "UQ_617a8fe225a6e701d89e02d2c74" UNIQUE ("date"), CONSTRAINT "PK_7ca721c769f31698e0e1331e8e6" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_617a8fe225a6e701d89e02d2c7" ON "__chart_day__federation" ("date") `); - await queryRunner.query(`CREATE TABLE "__chart_day__notes" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "___local_total" bigint NOT NULL, "___local_inc" bigint NOT NULL, "___local_dec" bigint NOT NULL, "___local_diffs_normal" bigint NOT NULL, "___local_diffs_reply" bigint NOT NULL, "___local_diffs_renote" bigint NOT NULL, "___remote_total" bigint NOT NULL, "___remote_inc" bigint NOT NULL, "___remote_dec" bigint NOT NULL, "___remote_diffs_normal" bigint NOT NULL, "___remote_diffs_reply" bigint NOT NULL, "___remote_diffs_renote" bigint NOT NULL, CONSTRAINT "UQ_1a527b423ad0858a1af5a056d43" UNIQUE ("date"), CONSTRAINT "PK_1fa4139e1f338272b758d05e090" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_1a527b423ad0858a1af5a056d4" ON "__chart_day__notes" ("date") `); - await queryRunner.query(`CREATE TABLE "__chart_day__users" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "___local_total" bigint NOT NULL, "___local_inc" bigint NOT NULL, "___local_dec" bigint NOT NULL, "___remote_total" bigint NOT NULL, "___remote_inc" bigint NOT NULL, "___remote_dec" bigint NOT NULL, CONSTRAINT "UQ_cad6e07c20037f31cdba8a350c3" UNIQUE ("date"), CONSTRAINT "PK_d7f7185abb9851f70c4726c54bd" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_cad6e07c20037f31cdba8a350c" ON "__chart_day__users" ("date") `); - await queryRunner.query(`CREATE TABLE "__chart_day__network" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "___incomingRequests" bigint NOT NULL, "___outgoingRequests" bigint NOT NULL, "___totalTime" bigint NOT NULL, "___incomingBytes" bigint NOT NULL, "___outgoingBytes" bigint NOT NULL, CONSTRAINT "UQ_8bfa548c2b31f9e07db113773ee" UNIQUE ("date"), CONSTRAINT "PK_cac499d6f471042dfed1e7e0132" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_8bfa548c2b31f9e07db113773e" ON "__chart_day__network" ("date") `); - await queryRunner.query(`CREATE TABLE "__chart_day__active_users" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "___local_users" character varying array NOT NULL, "___remote_users" character varying array NOT NULL, CONSTRAINT "UQ_d5954f3df5e5e3bdfc3c03f3906" UNIQUE ("date"), CONSTRAINT "PK_b1790489b14f005ae8f404f5795" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_d5954f3df5e5e3bdfc3c03f390" ON "__chart_day__active_users" ("date") `); - await queryRunner.query(`CREATE TABLE "__chart_day__instance" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128) NOT NULL, "___requests_failed" bigint NOT NULL, "___requests_succeeded" bigint NOT NULL, "___requests_received" bigint NOT NULL, "___notes_total" bigint NOT NULL, "___notes_inc" bigint NOT NULL, "___notes_dec" bigint NOT NULL, "___notes_diffs_normal" bigint NOT NULL, "___notes_diffs_reply" bigint NOT NULL, "___notes_diffs_renote" bigint NOT NULL, "___users_total" bigint NOT NULL, "___users_inc" bigint NOT NULL, "___users_dec" bigint NOT NULL, "___following_total" bigint NOT NULL, "___following_inc" bigint NOT NULL, "___following_dec" bigint NOT NULL, "___followers_total" bigint NOT NULL, "___followers_inc" bigint NOT NULL, "___followers_dec" bigint NOT NULL, "___drive_totalFiles" bigint NOT NULL, "___drive_totalUsage" bigint NOT NULL, "___drive_incFiles" bigint NOT NULL, "___drive_incUsage" bigint NOT NULL, "___drive_decFiles" bigint NOT NULL, "___drive_decUsage" bigint NOT NULL, CONSTRAINT "UQ_fea7c0278325a1a2492f2d6acbf" UNIQUE ("date", "group"), CONSTRAINT "PK_479a8ff9d959274981087043023" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_fea7c0278325a1a2492f2d6acb" ON "__chart_day__instance" ("date", "group") `); - await queryRunner.query(`CREATE TABLE "__chart_day__per_user_notes" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128) NOT NULL, "___total" bigint NOT NULL, "___inc" bigint NOT NULL, "___dec" bigint NOT NULL, "___diffs_normal" bigint NOT NULL, "___diffs_reply" bigint NOT NULL, "___diffs_renote" bigint NOT NULL, CONSTRAINT "UQ_c5545d4b31cdc684034e33b81c3" UNIQUE ("date", "group"), CONSTRAINT "PK_58bab6b6d3ad9310cbc7460fd28" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_c5545d4b31cdc684034e33b81c" ON "__chart_day__per_user_notes" ("date", "group") `); - await queryRunner.query(`CREATE TABLE "__chart_day__drive" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "___local_totalCount" bigint NOT NULL, "___local_totalSize" bigint NOT NULL, "___local_incCount" bigint NOT NULL, "___local_incSize" bigint NOT NULL, "___local_decCount" bigint NOT NULL, "___local_decSize" bigint NOT NULL, "___remote_totalCount" bigint NOT NULL, "___remote_totalSize" bigint NOT NULL, "___remote_incCount" bigint NOT NULL, "___remote_incSize" bigint NOT NULL, "___remote_decCount" bigint NOT NULL, "___remote_decSize" bigint NOT NULL, CONSTRAINT "UQ_0b60ebb3aa0065f10b0616c1171" UNIQUE ("date"), CONSTRAINT "PK_e7ec0de057c77c40fc8d8b62151" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_0b60ebb3aa0065f10b0616c117" ON "__chart_day__drive" ("date") `); - await queryRunner.query(`CREATE TABLE "__chart_day__per_user_reaction" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128) NOT NULL, "___local_count" bigint NOT NULL, "___remote_count" bigint NOT NULL, CONSTRAINT "UQ_d54b653660d808b118e36c184c0" UNIQUE ("date", "group"), CONSTRAINT "PK_8af24e2d51ff781a354fe595eda" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_d54b653660d808b118e36c184c" ON "__chart_day__per_user_reaction" ("date", "group") `); - await queryRunner.query(`CREATE TABLE "__chart_day__hashtag" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128) NOT NULL, "___local_users" character varying array NOT NULL, "___remote_users" character varying array NOT NULL, CONSTRAINT "UQ_8f589cf056ff51f09d6096f6450" UNIQUE ("date", "group"), CONSTRAINT "PK_13d5a3b089344e5557f8e0980b4" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_8f589cf056ff51f09d6096f645" ON "__chart_day__hashtag" ("date", "group") `); - await queryRunner.query(`CREATE TABLE "__chart_day__per_user_following" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128) NOT NULL, "___local_followings_total" bigint NOT NULL, "___local_followings_inc" bigint NOT NULL, "___local_followings_dec" bigint NOT NULL, "___local_followers_total" bigint NOT NULL, "___local_followers_inc" bigint NOT NULL, "___local_followers_dec" bigint NOT NULL, "___remote_followings_total" bigint NOT NULL, "___remote_followings_inc" bigint NOT NULL, "___remote_followings_dec" bigint NOT NULL, "___remote_followers_total" bigint NOT NULL, "___remote_followers_inc" bigint NOT NULL, "___remote_followers_dec" bigint NOT NULL, CONSTRAINT "UQ_e4849a3231f38281280ea4c0eee" UNIQUE ("date", "group"), CONSTRAINT "PK_68ce6b67da57166da66fc8fb27e" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_e4849a3231f38281280ea4c0ee" ON "__chart_day__per_user_following" ("date", "group") `); - await queryRunner.query(`CREATE TABLE "__chart_day__per_user_drive" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128) NOT NULL, "___totalCount" bigint NOT NULL, "___totalSize" bigint NOT NULL, "___incCount" bigint NOT NULL, "___incSize" bigint NOT NULL, "___decCount" bigint NOT NULL, "___decSize" bigint NOT NULL, CONSTRAINT "UQ_62aa5047b5aec92524f24c701d7" UNIQUE ("date", "group"), CONSTRAINT "PK_1ae135254c137011645da7f4045" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_62aa5047b5aec92524f24c701d" ON "__chart_day__per_user_drive" ("date", "group") `); - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "group"`); - await queryRunner.query(`ALTER TABLE "__chart__notes" DROP COLUMN "group"`); - await queryRunner.query(`ALTER TABLE "__chart__users" DROP COLUMN "group"`); - await queryRunner.query(`ALTER TABLE "__chart__network" DROP COLUMN "group"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "group"`); - await queryRunner.query(`ALTER TABLE "__chart__drive" DROP COLUMN "group"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD CONSTRAINT "UQ_36cb699c49580d4e6c2e6159f97" UNIQUE ("date")`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ADD CONSTRAINT "UQ_42eb716a37d381cdf566192b2be" UNIQUE ("date")`); - await queryRunner.query(`ALTER TABLE "__chart__users" ADD CONSTRAINT "UQ_845254b3eaf708ae8a6cac30265" UNIQUE ("date")`); - await queryRunner.query(`ALTER TABLE "__chart__network" ADD CONSTRAINT "UQ_a1efd3e0048a5f2793a47360dc6" UNIQUE ("date")`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD CONSTRAINT "UQ_0ad37b7ef50f4ddc84363d7ccca" UNIQUE ("date")`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___local_users" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___remote_users" DROP DEFAULT`); - await queryRunner.query(`DROP INDEX "public"."IDX_39ee857ab2f23493037c6b6631"`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "group" SET NOT NULL`); - await queryRunner.query(`DROP INDEX "public"."IDX_5048e9daccbbbc6d567bb142d3"`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "group" SET NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ADD CONSTRAINT "UQ_13565815f618a1ff53886c5b28a" UNIQUE ("date")`); - await queryRunner.query(`DROP INDEX "public"."IDX_229a41ad465f9205f1f5703291"`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "group" SET NOT NULL`); - await queryRunner.query(`DROP INDEX "public"."IDX_25a97c02003338124b2b75fdbc"`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ALTER COLUMN "group" SET NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ALTER COLUMN "___local_users" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ALTER COLUMN "___remote_users" DROP DEFAULT`); - await queryRunner.query(`DROP INDEX "public"."IDX_b77d4dd9562c3a899d9a286fcd"`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "group" SET NOT NULL`); - await queryRunner.query(`DROP INDEX "public"."IDX_30bf67687f483ace115c5ca642"`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "group" SET NOT NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_36cb699c49580d4e6c2e6159f9" ON "__chart__federation" ("date") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_42eb716a37d381cdf566192b2b" ON "__chart__notes" ("date") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_845254b3eaf708ae8a6cac3026" ON "__chart__users" ("date") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_a1efd3e0048a5f2793a47360dc" ON "__chart__network" ("date") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_0ad37b7ef50f4ddc84363d7ccc" ON "__chart__active_users" ("date") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_39ee857ab2f23493037c6b6631" ON "__chart__instance" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_5048e9daccbbbc6d567bb142d3" ON "__chart__per_user_notes" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_13565815f618a1ff53886c5b28" ON "__chart__drive" ("date") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_229a41ad465f9205f1f5703291" ON "__chart__per_user_reaction" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_25a97c02003338124b2b75fdbc" ON "__chart__hashtag" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_b77d4dd9562c3a899d9a286fcd" ON "__chart__per_user_following" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_30bf67687f483ace115c5ca642" ON "__chart__per_user_drive" ("date", "group") `); - await queryRunner.query(`ALTER TABLE "__chart__instance" ADD CONSTRAINT "UQ_39ee857ab2f23493037c6b66311" UNIQUE ("date", "group")`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ADD CONSTRAINT "UQ_5048e9daccbbbc6d567bb142d34" UNIQUE ("date", "group")`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ADD CONSTRAINT "UQ_229a41ad465f9205f1f57032910" UNIQUE ("date", "group")`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ADD CONSTRAINT "UQ_25a97c02003338124b2b75fdbc8" UNIQUE ("date", "group")`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ADD CONSTRAINT "UQ_b77d4dd9562c3a899d9a286fcd7" UNIQUE ("date", "group")`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ADD CONSTRAINT "UQ_30bf67687f483ace115c5ca6429" UNIQUE ("date", "group")`); - } + await queryRunner.query( + `DROP INDEX "public"."IDX_dd907becf76104e4b656659e6b"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_eddfed8fb40305a04c6f941050"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_f09d543e3acb16c5976bdb31fa"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_e60c358aaced5aab8900a4af31"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_337e9599f278bd7537fe30876f"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_66feba81e1795d176d06c0b1e6"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_0a905b992fecd2b5c3fb98759e"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_2082327b2699ce924fa654afc5"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_9a3ed15a30ab7e3a37702e6e08"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_60c5c6e7e538c09aa274ecd1cf"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_8111b817b9818c04d7eb8475b1"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_583a157ed0cf0ed1b5ec2a833f"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_3313d7288855ec105b5bbf6c21"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_ceab80a6729f8e2e6f5b8a1a3d"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_3b7697a96f522d0478972e6d6f"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_53a3604b939e2b479eb2cfaac8"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_dabbb38a51ab86ee3cab291326"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_a9a806d466b314f253a1a611c4"`, + ); + await queryRunner.query( + `CREATE TABLE "__chart_day__federation" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "___instance_total" bigint NOT NULL, "___instance_inc" bigint NOT NULL, "___instance_dec" bigint NOT NULL, CONSTRAINT "UQ_617a8fe225a6e701d89e02d2c74" UNIQUE ("date"), CONSTRAINT "PK_7ca721c769f31698e0e1331e8e6" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_617a8fe225a6e701d89e02d2c7" ON "__chart_day__federation" ("date") `, + ); + await queryRunner.query( + `CREATE TABLE "__chart_day__notes" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "___local_total" bigint NOT NULL, "___local_inc" bigint NOT NULL, "___local_dec" bigint NOT NULL, "___local_diffs_normal" bigint NOT NULL, "___local_diffs_reply" bigint NOT NULL, "___local_diffs_renote" bigint NOT NULL, "___remote_total" bigint NOT NULL, "___remote_inc" bigint NOT NULL, "___remote_dec" bigint NOT NULL, "___remote_diffs_normal" bigint NOT NULL, "___remote_diffs_reply" bigint NOT NULL, "___remote_diffs_renote" bigint NOT NULL, CONSTRAINT "UQ_1a527b423ad0858a1af5a056d43" UNIQUE ("date"), CONSTRAINT "PK_1fa4139e1f338272b758d05e090" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_1a527b423ad0858a1af5a056d4" ON "__chart_day__notes" ("date") `, + ); + await queryRunner.query( + `CREATE TABLE "__chart_day__users" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "___local_total" bigint NOT NULL, "___local_inc" bigint NOT NULL, "___local_dec" bigint NOT NULL, "___remote_total" bigint NOT NULL, "___remote_inc" bigint NOT NULL, "___remote_dec" bigint NOT NULL, CONSTRAINT "UQ_cad6e07c20037f31cdba8a350c3" UNIQUE ("date"), CONSTRAINT "PK_d7f7185abb9851f70c4726c54bd" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_cad6e07c20037f31cdba8a350c" ON "__chart_day__users" ("date") `, + ); + await queryRunner.query( + `CREATE TABLE "__chart_day__network" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "___incomingRequests" bigint NOT NULL, "___outgoingRequests" bigint NOT NULL, "___totalTime" bigint NOT NULL, "___incomingBytes" bigint NOT NULL, "___outgoingBytes" bigint NOT NULL, CONSTRAINT "UQ_8bfa548c2b31f9e07db113773ee" UNIQUE ("date"), CONSTRAINT "PK_cac499d6f471042dfed1e7e0132" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_8bfa548c2b31f9e07db113773e" ON "__chart_day__network" ("date") `, + ); + await queryRunner.query( + `CREATE TABLE "__chart_day__active_users" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "___local_users" character varying array NOT NULL, "___remote_users" character varying array NOT NULL, CONSTRAINT "UQ_d5954f3df5e5e3bdfc3c03f3906" UNIQUE ("date"), CONSTRAINT "PK_b1790489b14f005ae8f404f5795" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_d5954f3df5e5e3bdfc3c03f390" ON "__chart_day__active_users" ("date") `, + ); + await queryRunner.query( + `CREATE TABLE "__chart_day__instance" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128) NOT NULL, "___requests_failed" bigint NOT NULL, "___requests_succeeded" bigint NOT NULL, "___requests_received" bigint NOT NULL, "___notes_total" bigint NOT NULL, "___notes_inc" bigint NOT NULL, "___notes_dec" bigint NOT NULL, "___notes_diffs_normal" bigint NOT NULL, "___notes_diffs_reply" bigint NOT NULL, "___notes_diffs_renote" bigint NOT NULL, "___users_total" bigint NOT NULL, "___users_inc" bigint NOT NULL, "___users_dec" bigint NOT NULL, "___following_total" bigint NOT NULL, "___following_inc" bigint NOT NULL, "___following_dec" bigint NOT NULL, "___followers_total" bigint NOT NULL, "___followers_inc" bigint NOT NULL, "___followers_dec" bigint NOT NULL, "___drive_totalFiles" bigint NOT NULL, "___drive_totalUsage" bigint NOT NULL, "___drive_incFiles" bigint NOT NULL, "___drive_incUsage" bigint NOT NULL, "___drive_decFiles" bigint NOT NULL, "___drive_decUsage" bigint NOT NULL, CONSTRAINT "UQ_fea7c0278325a1a2492f2d6acbf" UNIQUE ("date", "group"), CONSTRAINT "PK_479a8ff9d959274981087043023" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_fea7c0278325a1a2492f2d6acb" ON "__chart_day__instance" ("date", "group") `, + ); + await queryRunner.query( + `CREATE TABLE "__chart_day__per_user_notes" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128) NOT NULL, "___total" bigint NOT NULL, "___inc" bigint NOT NULL, "___dec" bigint NOT NULL, "___diffs_normal" bigint NOT NULL, "___diffs_reply" bigint NOT NULL, "___diffs_renote" bigint NOT NULL, CONSTRAINT "UQ_c5545d4b31cdc684034e33b81c3" UNIQUE ("date", "group"), CONSTRAINT "PK_58bab6b6d3ad9310cbc7460fd28" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_c5545d4b31cdc684034e33b81c" ON "__chart_day__per_user_notes" ("date", "group") `, + ); + await queryRunner.query( + `CREATE TABLE "__chart_day__drive" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "___local_totalCount" bigint NOT NULL, "___local_totalSize" bigint NOT NULL, "___local_incCount" bigint NOT NULL, "___local_incSize" bigint NOT NULL, "___local_decCount" bigint NOT NULL, "___local_decSize" bigint NOT NULL, "___remote_totalCount" bigint NOT NULL, "___remote_totalSize" bigint NOT NULL, "___remote_incCount" bigint NOT NULL, "___remote_incSize" bigint NOT NULL, "___remote_decCount" bigint NOT NULL, "___remote_decSize" bigint NOT NULL, CONSTRAINT "UQ_0b60ebb3aa0065f10b0616c1171" UNIQUE ("date"), CONSTRAINT "PK_e7ec0de057c77c40fc8d8b62151" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_0b60ebb3aa0065f10b0616c117" ON "__chart_day__drive" ("date") `, + ); + await queryRunner.query( + `CREATE TABLE "__chart_day__per_user_reaction" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128) NOT NULL, "___local_count" bigint NOT NULL, "___remote_count" bigint NOT NULL, CONSTRAINT "UQ_d54b653660d808b118e36c184c0" UNIQUE ("date", "group"), CONSTRAINT "PK_8af24e2d51ff781a354fe595eda" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_d54b653660d808b118e36c184c" ON "__chart_day__per_user_reaction" ("date", "group") `, + ); + await queryRunner.query( + `CREATE TABLE "__chart_day__hashtag" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128) NOT NULL, "___local_users" character varying array NOT NULL, "___remote_users" character varying array NOT NULL, CONSTRAINT "UQ_8f589cf056ff51f09d6096f6450" UNIQUE ("date", "group"), CONSTRAINT "PK_13d5a3b089344e5557f8e0980b4" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_8f589cf056ff51f09d6096f645" ON "__chart_day__hashtag" ("date", "group") `, + ); + await queryRunner.query( + `CREATE TABLE "__chart_day__per_user_following" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128) NOT NULL, "___local_followings_total" bigint NOT NULL, "___local_followings_inc" bigint NOT NULL, "___local_followings_dec" bigint NOT NULL, "___local_followers_total" bigint NOT NULL, "___local_followers_inc" bigint NOT NULL, "___local_followers_dec" bigint NOT NULL, "___remote_followings_total" bigint NOT NULL, "___remote_followings_inc" bigint NOT NULL, "___remote_followings_dec" bigint NOT NULL, "___remote_followers_total" bigint NOT NULL, "___remote_followers_inc" bigint NOT NULL, "___remote_followers_dec" bigint NOT NULL, CONSTRAINT "UQ_e4849a3231f38281280ea4c0eee" UNIQUE ("date", "group"), CONSTRAINT "PK_68ce6b67da57166da66fc8fb27e" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_e4849a3231f38281280ea4c0ee" ON "__chart_day__per_user_following" ("date", "group") `, + ); + await queryRunner.query( + `CREATE TABLE "__chart_day__per_user_drive" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "group" character varying(128) NOT NULL, "___totalCount" bigint NOT NULL, "___totalSize" bigint NOT NULL, "___incCount" bigint NOT NULL, "___incSize" bigint NOT NULL, "___decCount" bigint NOT NULL, "___decSize" bigint NOT NULL, CONSTRAINT "UQ_62aa5047b5aec92524f24c701d7" UNIQUE ("date", "group"), CONSTRAINT "PK_1ae135254c137011645da7f4045" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_62aa5047b5aec92524f24c701d" ON "__chart_day__per_user_drive" ("date", "group") `, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP COLUMN "group"`, + ); + await queryRunner.query(`ALTER TABLE "__chart__notes" DROP COLUMN "group"`); + await queryRunner.query(`ALTER TABLE "__chart__users" DROP COLUMN "group"`); + await queryRunner.query( + `ALTER TABLE "__chart__network" DROP COLUMN "group"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "group"`, + ); + await queryRunner.query(`ALTER TABLE "__chart__drive" DROP COLUMN "group"`); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD CONSTRAINT "UQ_36cb699c49580d4e6c2e6159f97" UNIQUE ("date")`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ADD CONSTRAINT "UQ_42eb716a37d381cdf566192b2be" UNIQUE ("date")`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ADD CONSTRAINT "UQ_845254b3eaf708ae8a6cac30265" UNIQUE ("date")`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ADD CONSTRAINT "UQ_a1efd3e0048a5f2793a47360dc6" UNIQUE ("date")`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD CONSTRAINT "UQ_0ad37b7ef50f4ddc84363d7ccca" UNIQUE ("date")`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ALTER COLUMN "___local_users" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ALTER COLUMN "___remote_users" DROP DEFAULT`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_39ee857ab2f23493037c6b6631"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "group" SET NOT NULL`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_5048e9daccbbbc6d567bb142d3"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "group" SET NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ADD CONSTRAINT "UQ_13565815f618a1ff53886c5b28a" UNIQUE ("date")`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_229a41ad465f9205f1f5703291"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "group" SET NOT NULL`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_25a97c02003338124b2b75fdbc"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ALTER COLUMN "group" SET NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ALTER COLUMN "___local_users" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ALTER COLUMN "___remote_users" DROP DEFAULT`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_b77d4dd9562c3a899d9a286fcd"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "group" SET NOT NULL`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_30bf67687f483ace115c5ca642"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "group" SET NOT NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_36cb699c49580d4e6c2e6159f9" ON "__chart__federation" ("date") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_42eb716a37d381cdf566192b2b" ON "__chart__notes" ("date") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_845254b3eaf708ae8a6cac3026" ON "__chart__users" ("date") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_a1efd3e0048a5f2793a47360dc" ON "__chart__network" ("date") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_0ad37b7ef50f4ddc84363d7ccc" ON "__chart__active_users" ("date") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_39ee857ab2f23493037c6b6631" ON "__chart__instance" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_5048e9daccbbbc6d567bb142d3" ON "__chart__per_user_notes" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_13565815f618a1ff53886c5b28" ON "__chart__drive" ("date") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_229a41ad465f9205f1f5703291" ON "__chart__per_user_reaction" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_25a97c02003338124b2b75fdbc" ON "__chart__hashtag" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_b77d4dd9562c3a899d9a286fcd" ON "__chart__per_user_following" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_30bf67687f483ace115c5ca642" ON "__chart__per_user_drive" ("date", "group") `, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ADD CONSTRAINT "UQ_39ee857ab2f23493037c6b66311" UNIQUE ("date", "group")`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ADD CONSTRAINT "UQ_5048e9daccbbbc6d567bb142d34" UNIQUE ("date", "group")`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_reaction" ADD CONSTRAINT "UQ_229a41ad465f9205f1f57032910" UNIQUE ("date", "group")`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ADD CONSTRAINT "UQ_25a97c02003338124b2b75fdbc8" UNIQUE ("date", "group")`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ADD CONSTRAINT "UQ_b77d4dd9562c3a899d9a286fcd7" UNIQUE ("date", "group")`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ADD CONSTRAINT "UQ_30bf67687f483ace115c5ca6429" UNIQUE ("date", "group")`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" DROP CONSTRAINT "UQ_30bf67687f483ace115c5ca6429"`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" DROP CONSTRAINT "UQ_b77d4dd9562c3a899d9a286fcd7"`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" DROP CONSTRAINT "UQ_25a97c02003338124b2b75fdbc8"`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" DROP CONSTRAINT "UQ_229a41ad465f9205f1f57032910"`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" DROP CONSTRAINT "UQ_5048e9daccbbbc6d567bb142d34"`); - await queryRunner.query(`ALTER TABLE "__chart__instance" DROP CONSTRAINT "UQ_39ee857ab2f23493037c6b66311"`); - await queryRunner.query(`DROP INDEX "public"."IDX_30bf67687f483ace115c5ca642"`); - await queryRunner.query(`DROP INDEX "public"."IDX_b77d4dd9562c3a899d9a286fcd"`); - await queryRunner.query(`DROP INDEX "public"."IDX_25a97c02003338124b2b75fdbc"`); - await queryRunner.query(`DROP INDEX "public"."IDX_229a41ad465f9205f1f5703291"`); - await queryRunner.query(`DROP INDEX "public"."IDX_13565815f618a1ff53886c5b28"`); - await queryRunner.query(`DROP INDEX "public"."IDX_5048e9daccbbbc6d567bb142d3"`); - await queryRunner.query(`DROP INDEX "public"."IDX_39ee857ab2f23493037c6b6631"`); - await queryRunner.query(`DROP INDEX "public"."IDX_0ad37b7ef50f4ddc84363d7ccc"`); - await queryRunner.query(`DROP INDEX "public"."IDX_a1efd3e0048a5f2793a47360dc"`); - await queryRunner.query(`DROP INDEX "public"."IDX_845254b3eaf708ae8a6cac3026"`); - await queryRunner.query(`DROP INDEX "public"."IDX_42eb716a37d381cdf566192b2b"`); - await queryRunner.query(`DROP INDEX "public"."IDX_36cb699c49580d4e6c2e6159f9"`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "group" DROP NOT NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_30bf67687f483ace115c5ca642" ON "__chart__per_user_drive" ("date", "group") `); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "group" DROP NOT NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_b77d4dd9562c3a899d9a286fcd" ON "__chart__per_user_following" ("date", "group") `); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ALTER COLUMN "___remote_users" SET DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ALTER COLUMN "___local_users" SET DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ALTER COLUMN "group" DROP NOT NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_25a97c02003338124b2b75fdbc" ON "__chart__hashtag" ("date", "group") `); - await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "group" DROP NOT NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_229a41ad465f9205f1f5703291" ON "__chart__per_user_reaction" ("date", "group") `); - await queryRunner.query(`ALTER TABLE "__chart__drive" DROP CONSTRAINT "UQ_13565815f618a1ff53886c5b28a"`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "group" DROP NOT NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_5048e9daccbbbc6d567bb142d3" ON "__chart__per_user_notes" ("date", "group") `); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "group" DROP NOT NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_39ee857ab2f23493037c6b6631" ON "__chart__instance" ("date", "group") `); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___remote_users" SET DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___local_users" SET DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP CONSTRAINT "UQ_0ad37b7ef50f4ddc84363d7ccca"`); - await queryRunner.query(`ALTER TABLE "__chart__network" DROP CONSTRAINT "UQ_a1efd3e0048a5f2793a47360dc6"`); - await queryRunner.query(`ALTER TABLE "__chart__users" DROP CONSTRAINT "UQ_845254b3eaf708ae8a6cac30265"`); - await queryRunner.query(`ALTER TABLE "__chart__notes" DROP CONSTRAINT "UQ_42eb716a37d381cdf566192b2be"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP CONSTRAINT "UQ_36cb699c49580d4e6c2e6159f97"`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ADD "group" character varying(128)`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "group" character varying(128)`); - await queryRunner.query(`ALTER TABLE "__chart__network" ADD "group" character varying(128)`); - await queryRunner.query(`ALTER TABLE "__chart__users" ADD "group" character varying(128)`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ADD "group" character varying(128)`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "group" character varying(128)`); - await queryRunner.query(`DROP INDEX "public"."IDX_62aa5047b5aec92524f24c701d"`); - await queryRunner.query(`DROP TABLE "__chart_day__per_user_drive"`); - await queryRunner.query(`DROP INDEX "public"."IDX_e4849a3231f38281280ea4c0ee"`); - await queryRunner.query(`DROP TABLE "__chart_day__per_user_following"`); - await queryRunner.query(`DROP INDEX "public"."IDX_8f589cf056ff51f09d6096f645"`); - await queryRunner.query(`DROP TABLE "__chart_day__hashtag"`); - await queryRunner.query(`DROP INDEX "public"."IDX_d54b653660d808b118e36c184c"`); - await queryRunner.query(`DROP TABLE "__chart_day__per_user_reaction"`); - await queryRunner.query(`DROP INDEX "public"."IDX_0b60ebb3aa0065f10b0616c117"`); - await queryRunner.query(`DROP TABLE "__chart_day__drive"`); - await queryRunner.query(`DROP INDEX "public"."IDX_c5545d4b31cdc684034e33b81c"`); - await queryRunner.query(`DROP TABLE "__chart_day__per_user_notes"`); - await queryRunner.query(`DROP INDEX "public"."IDX_fea7c0278325a1a2492f2d6acb"`); - await queryRunner.query(`DROP TABLE "__chart_day__instance"`); - await queryRunner.query(`DROP INDEX "public"."IDX_d5954f3df5e5e3bdfc3c03f390"`); - await queryRunner.query(`DROP TABLE "__chart_day__active_users"`); - await queryRunner.query(`DROP INDEX "public"."IDX_8bfa548c2b31f9e07db113773e"`); - await queryRunner.query(`DROP TABLE "__chart_day__network"`); - await queryRunner.query(`DROP INDEX "public"."IDX_cad6e07c20037f31cdba8a350c"`); - await queryRunner.query(`DROP TABLE "__chart_day__users"`); - await queryRunner.query(`DROP INDEX "public"."IDX_1a527b423ad0858a1af5a056d4"`); - await queryRunner.query(`DROP TABLE "__chart_day__notes"`); - await queryRunner.query(`DROP INDEX "public"."IDX_617a8fe225a6e701d89e02d2c7"`); - await queryRunner.query(`DROP TABLE "__chart_day__federation"`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_a9a806d466b314f253a1a611c4" ON "__chart__per_user_drive" ("date") WHERE ("group" IS NULL)`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_dabbb38a51ab86ee3cab291326" ON "__chart__per_user_following" ("date") WHERE ("group" IS NULL)`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_53a3604b939e2b479eb2cfaac8" ON "__chart__hashtag" ("date") WHERE ("group" IS NULL)`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_3b7697a96f522d0478972e6d6f" ON "__chart__per_user_reaction" ("date") WHERE ("group" IS NULL)`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_ceab80a6729f8e2e6f5b8a1a3d" ON "__chart__drive" ("date") WHERE ("group" IS NULL)`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_3313d7288855ec105b5bbf6c21" ON "__chart__drive" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_583a157ed0cf0ed1b5ec2a833f" ON "__chart__per_user_notes" ("date") WHERE ("group" IS NULL)`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_8111b817b9818c04d7eb8475b1" ON "__chart__instance" ("date") WHERE ("group" IS NULL)`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_60c5c6e7e538c09aa274ecd1cf" ON "__chart__active_users" ("date") WHERE ("group" IS NULL)`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_9a3ed15a30ab7e3a37702e6e08" ON "__chart__active_users" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_2082327b2699ce924fa654afc5" ON "__chart__network" ("date") WHERE ("group" IS NULL)`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_0a905b992fecd2b5c3fb98759e" ON "__chart__network" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_66feba81e1795d176d06c0b1e6" ON "__chart__users" ("date") WHERE ("group" IS NULL)`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_337e9599f278bd7537fe30876f" ON "__chart__users" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_e60c358aaced5aab8900a4af31" ON "__chart__notes" ("date") WHERE ("group" IS NULL)`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_f09d543e3acb16c5976bdb31fa" ON "__chart__notes" ("date", "group") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_eddfed8fb40305a04c6f941050" ON "__chart__federation" ("date") WHERE ("group" IS NULL)`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_dd907becf76104e4b656659e6b" ON "__chart__federation" ("date", "group") `); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" DROP CONSTRAINT "UQ_30bf67687f483ace115c5ca6429"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" DROP CONSTRAINT "UQ_b77d4dd9562c3a899d9a286fcd7"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" DROP CONSTRAINT "UQ_25a97c02003338124b2b75fdbc8"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_reaction" DROP CONSTRAINT "UQ_229a41ad465f9205f1f57032910"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" DROP CONSTRAINT "UQ_5048e9daccbbbc6d567bb142d34"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" DROP CONSTRAINT "UQ_39ee857ab2f23493037c6b66311"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_30bf67687f483ace115c5ca642"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_b77d4dd9562c3a899d9a286fcd"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_25a97c02003338124b2b75fdbc"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_229a41ad465f9205f1f5703291"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_13565815f618a1ff53886c5b28"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_5048e9daccbbbc6d567bb142d3"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_39ee857ab2f23493037c6b6631"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_0ad37b7ef50f4ddc84363d7ccc"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_a1efd3e0048a5f2793a47360dc"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_845254b3eaf708ae8a6cac3026"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_42eb716a37d381cdf566192b2b"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_36cb699c49580d4e6c2e6159f9"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "group" DROP NOT NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_30bf67687f483ace115c5ca642" ON "__chart__per_user_drive" ("date", "group") `, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "group" DROP NOT NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_b77d4dd9562c3a899d9a286fcd" ON "__chart__per_user_following" ("date", "group") `, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ALTER COLUMN "___remote_users" SET DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ALTER COLUMN "___local_users" SET DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ALTER COLUMN "group" DROP NOT NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_25a97c02003338124b2b75fdbc" ON "__chart__hashtag" ("date", "group") `, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "group" DROP NOT NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_229a41ad465f9205f1f5703291" ON "__chart__per_user_reaction" ("date", "group") `, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" DROP CONSTRAINT "UQ_13565815f618a1ff53886c5b28a"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "group" DROP NOT NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_5048e9daccbbbc6d567bb142d3" ON "__chart__per_user_notes" ("date", "group") `, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "group" DROP NOT NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_39ee857ab2f23493037c6b6631" ON "__chart__instance" ("date", "group") `, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ALTER COLUMN "___remote_users" SET DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ALTER COLUMN "___local_users" SET DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP CONSTRAINT "UQ_0ad37b7ef50f4ddc84363d7ccca"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" DROP CONSTRAINT "UQ_a1efd3e0048a5f2793a47360dc6"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" DROP CONSTRAINT "UQ_845254b3eaf708ae8a6cac30265"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" DROP CONSTRAINT "UQ_42eb716a37d381cdf566192b2be"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP CONSTRAINT "UQ_36cb699c49580d4e6c2e6159f97"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ADD "group" character varying(128)`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "group" character varying(128)`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ADD "group" character varying(128)`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ADD "group" character varying(128)`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ADD "group" character varying(128)`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD "group" character varying(128)`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_62aa5047b5aec92524f24c701d"`, + ); + await queryRunner.query(`DROP TABLE "__chart_day__per_user_drive"`); + await queryRunner.query( + `DROP INDEX "public"."IDX_e4849a3231f38281280ea4c0ee"`, + ); + await queryRunner.query(`DROP TABLE "__chart_day__per_user_following"`); + await queryRunner.query( + `DROP INDEX "public"."IDX_8f589cf056ff51f09d6096f645"`, + ); + await queryRunner.query(`DROP TABLE "__chart_day__hashtag"`); + await queryRunner.query( + `DROP INDEX "public"."IDX_d54b653660d808b118e36c184c"`, + ); + await queryRunner.query(`DROP TABLE "__chart_day__per_user_reaction"`); + await queryRunner.query( + `DROP INDEX "public"."IDX_0b60ebb3aa0065f10b0616c117"`, + ); + await queryRunner.query(`DROP TABLE "__chart_day__drive"`); + await queryRunner.query( + `DROP INDEX "public"."IDX_c5545d4b31cdc684034e33b81c"`, + ); + await queryRunner.query(`DROP TABLE "__chart_day__per_user_notes"`); + await queryRunner.query( + `DROP INDEX "public"."IDX_fea7c0278325a1a2492f2d6acb"`, + ); + await queryRunner.query(`DROP TABLE "__chart_day__instance"`); + await queryRunner.query( + `DROP INDEX "public"."IDX_d5954f3df5e5e3bdfc3c03f390"`, + ); + await queryRunner.query(`DROP TABLE "__chart_day__active_users"`); + await queryRunner.query( + `DROP INDEX "public"."IDX_8bfa548c2b31f9e07db113773e"`, + ); + await queryRunner.query(`DROP TABLE "__chart_day__network"`); + await queryRunner.query( + `DROP INDEX "public"."IDX_cad6e07c20037f31cdba8a350c"`, + ); + await queryRunner.query(`DROP TABLE "__chart_day__users"`); + await queryRunner.query( + `DROP INDEX "public"."IDX_1a527b423ad0858a1af5a056d4"`, + ); + await queryRunner.query(`DROP TABLE "__chart_day__notes"`); + await queryRunner.query( + `DROP INDEX "public"."IDX_617a8fe225a6e701d89e02d2c7"`, + ); + await queryRunner.query(`DROP TABLE "__chart_day__federation"`); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_a9a806d466b314f253a1a611c4" ON "__chart__per_user_drive" ("date") WHERE ("group" IS NULL)`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_dabbb38a51ab86ee3cab291326" ON "__chart__per_user_following" ("date") WHERE ("group" IS NULL)`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_53a3604b939e2b479eb2cfaac8" ON "__chart__hashtag" ("date") WHERE ("group" IS NULL)`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_3b7697a96f522d0478972e6d6f" ON "__chart__per_user_reaction" ("date") WHERE ("group" IS NULL)`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_ceab80a6729f8e2e6f5b8a1a3d" ON "__chart__drive" ("date") WHERE ("group" IS NULL)`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_3313d7288855ec105b5bbf6c21" ON "__chart__drive" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_583a157ed0cf0ed1b5ec2a833f" ON "__chart__per_user_notes" ("date") WHERE ("group" IS NULL)`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_8111b817b9818c04d7eb8475b1" ON "__chart__instance" ("date") WHERE ("group" IS NULL)`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_60c5c6e7e538c09aa274ecd1cf" ON "__chart__active_users" ("date") WHERE ("group" IS NULL)`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_9a3ed15a30ab7e3a37702e6e08" ON "__chart__active_users" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_2082327b2699ce924fa654afc5" ON "__chart__network" ("date") WHERE ("group" IS NULL)`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_0a905b992fecd2b5c3fb98759e" ON "__chart__network" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_66feba81e1795d176d06c0b1e6" ON "__chart__users" ("date") WHERE ("group" IS NULL)`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_337e9599f278bd7537fe30876f" ON "__chart__users" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_e60c358aaced5aab8900a4af31" ON "__chart__notes" ("date") WHERE ("group" IS NULL)`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_f09d543e3acb16c5976bdb31fa" ON "__chart__notes" ("date", "group") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_eddfed8fb40305a04c6f941050" ON "__chart__federation" ("date") WHERE ("group" IS NULL)`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_dd907becf76104e4b656659e6b" ON "__chart__federation" ("date", "group") `, + ); + } } diff --git a/packages/backend/migration/1642611822809-emoji-url.js b/packages/backend/migration/1642611822809-emoji-url.js index d38f8cc08..e1852c002 100644 --- a/packages/backend/migration/1642611822809-emoji-url.js +++ b/packages/backend/migration/1642611822809-emoji-url.js @@ -1,15 +1,19 @@ - - export class emojiUrl1642611822809 { - name = 'emojiUrl1642611822809' + name = "emojiUrl1642611822809"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "emoji" RENAME COLUMN "url" TO "originalUrl"`); - await queryRunner.query(`ALTER TABLE "emoji" ADD "publicUrl" character varying(512) NOT NULL DEFAULT ''`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "emoji" RENAME COLUMN "url" TO "originalUrl"`, + ); + await queryRunner.query( + `ALTER TABLE "emoji" ADD "publicUrl" character varying(512) NOT NULL DEFAULT ''`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "emoji" DROP COLUMN "publicUrl"`); - await queryRunner.query(`ALTER TABLE "emoji" RENAME COLUMN "originalUrl" TO "url"`); - } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "emoji" DROP COLUMN "publicUrl"`); + await queryRunner.query( + `ALTER TABLE "emoji" RENAME COLUMN "originalUrl" TO "url"`, + ); + } } diff --git a/packages/backend/migration/1642613870898-drive-file-webpublic-type.js b/packages/backend/migration/1642613870898-drive-file-webpublic-type.js index 15434f7d0..df5ab7899 100644 --- a/packages/backend/migration/1642613870898-drive-file-webpublic-type.js +++ b/packages/backend/migration/1642613870898-drive-file-webpublic-type.js @@ -1,13 +1,15 @@ - - export class driveFileWebpublicType1642613870898 { - name = 'driveFileWebpublicType1642613870898' + name = "driveFileWebpublicType1642613870898"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "drive_file" ADD "webpublicType" character varying(128)`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "drive_file" ADD "webpublicType" character varying(128)`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "drive_file" DROP COLUMN "webpublicType"`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "drive_file" DROP COLUMN "webpublicType"`, + ); + } } diff --git a/packages/backend/migration/1643963705770-chart-v4.js b/packages/backend/migration/1643963705770-chart-v4.js index 8b320c2b4..1e7233cc7 100644 --- a/packages/backend/migration/1643963705770-chart-v4.js +++ b/packages/backend/migration/1643963705770-chart-v4.js @@ -1,63 +1,165 @@ - - export class chartV41643963705770 { - name = 'chartV41643963705770' + name = "chartV41643963705770"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart__instance" DROP COLUMN "___drive_totalUsage"`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" DROP COLUMN "___drive_totalUsage"`); - await queryRunner.query(`ALTER TABLE "__chart__drive" DROP COLUMN "___local_totalCount"`); - await queryRunner.query(`ALTER TABLE "__chart__drive" DROP COLUMN "___local_totalSize"`); - await queryRunner.query(`ALTER TABLE "__chart__drive" DROP COLUMN "___remote_totalCount"`); - await queryRunner.query(`ALTER TABLE "__chart__drive" DROP COLUMN "___remote_totalSize"`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" DROP COLUMN "___local_totalCount"`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" DROP COLUMN "___local_totalSize"`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" DROP COLUMN "___remote_totalCount"`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" DROP COLUMN "___remote_totalSize"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___local_users"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___local_users" bigint NOT NULL DEFAULT 0`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___remote_users"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___remote_users" bigint NOT NULL DEFAULT 0`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___local_users"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___local_users" bigint NOT NULL DEFAULT 0`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___remote_users"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___remote_users" bigint NOT NULL DEFAULT 0`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" DROP COLUMN "___local_users"`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ADD "___local_users" bigint NOT NULL DEFAULT 0`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" DROP COLUMN "___remote_users"`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ADD "___remote_users" bigint NOT NULL DEFAULT 0`); - await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" DROP COLUMN "___local_users"`); - await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ADD "___local_users" bigint NOT NULL DEFAULT 0`); - await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" DROP COLUMN "___remote_users"`); - await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ADD "___remote_users" bigint NOT NULL DEFAULT 0`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart__instance" DROP COLUMN "___drive_totalUsage"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" DROP COLUMN "___drive_totalUsage"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" DROP COLUMN "___local_totalCount"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" DROP COLUMN "___local_totalSize"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" DROP COLUMN "___remote_totalCount"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" DROP COLUMN "___remote_totalSize"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" DROP COLUMN "___local_totalCount"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" DROP COLUMN "___local_totalSize"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" DROP COLUMN "___remote_totalCount"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" DROP COLUMN "___remote_totalSize"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___local_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___local_users" bigint NOT NULL DEFAULT 0`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___remote_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___remote_users" bigint NOT NULL DEFAULT 0`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "___local_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "___local_users" bigint NOT NULL DEFAULT 0`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "___remote_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "___remote_users" bigint NOT NULL DEFAULT 0`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" DROP COLUMN "___local_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ADD "___local_users" bigint NOT NULL DEFAULT 0`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" DROP COLUMN "___remote_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ADD "___remote_users" bigint NOT NULL DEFAULT 0`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__hashtag" DROP COLUMN "___local_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__hashtag" ADD "___local_users" bigint NOT NULL DEFAULT 0`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__hashtag" DROP COLUMN "___remote_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__hashtag" ADD "___remote_users" bigint NOT NULL DEFAULT 0`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" DROP COLUMN "___remote_users"`); - await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ADD "___remote_users" character varying array NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" DROP COLUMN "___local_users"`); - await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ADD "___local_users" character varying array NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" DROP COLUMN "___remote_users"`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ADD "___remote_users" character varying array NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" DROP COLUMN "___local_users"`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ADD "___local_users" character varying array NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___remote_users"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___remote_users" character varying array NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___local_users"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___local_users" character varying array NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___remote_users"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___remote_users" character varying array NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___local_users"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___local_users" character varying array NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ADD "___remote_totalSize" bigint NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ADD "___remote_totalCount" bigint NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ADD "___local_totalSize" bigint NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ADD "___local_totalCount" bigint NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ADD "___remote_totalSize" bigint NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ADD "___remote_totalCount" bigint NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ADD "___local_totalSize" bigint NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ADD "___local_totalCount" bigint NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ADD "___drive_totalUsage" bigint NOT NULL`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ADD "___drive_totalUsage" bigint NOT NULL`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart_day__hashtag" DROP COLUMN "___remote_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__hashtag" ADD "___remote_users" character varying array NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__hashtag" DROP COLUMN "___local_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__hashtag" ADD "___local_users" character varying array NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" DROP COLUMN "___remote_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ADD "___remote_users" character varying array NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" DROP COLUMN "___local_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ADD "___local_users" character varying array NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "___remote_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "___remote_users" character varying array NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "___local_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "___local_users" character varying array NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___remote_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___remote_users" character varying array NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___local_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___local_users" character varying array NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ADD "___remote_totalSize" bigint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ADD "___remote_totalCount" bigint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ADD "___local_totalSize" bigint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ADD "___local_totalCount" bigint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ADD "___remote_totalSize" bigint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ADD "___remote_totalCount" bigint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ADD "___local_totalSize" bigint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ADD "___local_totalCount" bigint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ADD "___drive_totalUsage" bigint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ADD "___drive_totalUsage" bigint NOT NULL`, + ); + } } diff --git a/packages/backend/migration/1643966656277-chart-v5.js b/packages/backend/migration/1643966656277-chart-v5.js index df84002f7..826f28ee3 100644 --- a/packages/backend/migration/1643966656277-chart-v5.js +++ b/packages/backend/migration/1643966656277-chart-v5.js @@ -1,27 +1,57 @@ - - export class chartV51643966656277 { - name = 'chartV51643966656277' + name = "chartV51643966656277"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "unique_temp___local_users" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "unique_temp___remote_users" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "unique_temp___local_users" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "unique_temp___remote_users" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ADD "unique_temp___local_users" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ADD "unique_temp___remote_users" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ADD "unique_temp___local_users" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ADD "unique_temp___remote_users" character varying array NOT NULL DEFAULT '{}'`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "unique_temp___local_users" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "unique_temp___remote_users" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "unique_temp___local_users" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "unique_temp___remote_users" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ADD "unique_temp___local_users" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ADD "unique_temp___remote_users" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__hashtag" ADD "unique_temp___local_users" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__hashtag" ADD "unique_temp___remote_users" character varying array NOT NULL DEFAULT '{}'`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" DROP COLUMN "unique_temp___remote_users"`); - await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" DROP COLUMN "unique_temp___local_users"`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" DROP COLUMN "unique_temp___remote_users"`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" DROP COLUMN "unique_temp___local_users"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___remote_users"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___local_users"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___remote_users"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___local_users"`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart_day__hashtag" DROP COLUMN "unique_temp___remote_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__hashtag" DROP COLUMN "unique_temp___local_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" DROP COLUMN "unique_temp___remote_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" DROP COLUMN "unique_temp___local_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___remote_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___local_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___remote_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___local_users"`, + ); + } } diff --git a/packages/backend/migration/1643967331284-chart-v6.js b/packages/backend/migration/1643967331284-chart-v6.js index 119198f4a..9dfbf24be 100644 --- a/packages/backend/migration/1643967331284-chart-v6.js +++ b/packages/backend/migration/1643967331284-chart-v6.js @@ -1,343 +1,1005 @@ - - export class chartV61643967331284 { - name = 'chartV61643967331284' + name = "chartV61643967331284"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_normal" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_reply" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_renote" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_normal" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_reply" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_renote" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_normal" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_reply" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_renote" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_normal" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_reply" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_renote" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___incomingRequests" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingRequests" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___totalTime" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___incomingBytes" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingBytes" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingRequests" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingRequests" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___totalTime" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingBytes" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingBytes" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_failed" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_succeeded" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_received" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_normal" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_reply" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_renote" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_totalFiles" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incFiles" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decFiles" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incUsage" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decUsage" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_failed" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_succeeded" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_received" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_normal" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_reply" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_renote" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_totalFiles" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incFiles" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decFiles" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incUsage" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decUsage" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_normal" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_reply" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_renote" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_normal" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_reply" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_renote" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incCount" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incSize" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decCount" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decSize" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incCount" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incSize" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decCount" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decSize" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incCount" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incSize" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decCount" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decSize" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incCount" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incSize" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decCount" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decSize" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___local_count" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___remote_count" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___local_count" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___remote_count" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_total" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_inc" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_dec" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalCount" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalSize" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incCount" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incSize" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decCount" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decSize" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalCount" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalSize" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incCount" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incSize" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decCount" SET DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decSize" SET DEFAULT '0'`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_normal" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_reply" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_renote" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_normal" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_reply" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_renote" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_normal" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_reply" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_renote" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_normal" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_reply" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_renote" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___local_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___local_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___local_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___remote_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___remote_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___remote_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___incomingRequests" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingRequests" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___totalTime" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___incomingBytes" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingBytes" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingRequests" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingRequests" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___totalTime" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingBytes" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingBytes" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_failed" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_succeeded" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_received" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_normal" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_reply" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_renote" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___users_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___users_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___users_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___following_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___following_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___following_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_totalFiles" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incFiles" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decFiles" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incUsage" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decUsage" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_failed" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_succeeded" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_received" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_normal" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_reply" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_renote" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_totalFiles" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incFiles" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decFiles" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incUsage" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decUsage" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_normal" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_reply" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_renote" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_normal" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_reply" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_renote" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incCount" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incSize" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decCount" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decSize" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incCount" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incSize" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decCount" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decSize" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incCount" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incSize" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decCount" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decSize" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incCount" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incSize" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decCount" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decSize" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___local_count" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___remote_count" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___local_count" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___remote_count" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_total" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_inc" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_dec" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalCount" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalSize" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incCount" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incSize" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decCount" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decSize" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalCount" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalSize" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incCount" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incSize" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decCount" SET DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decSize" SET DEFAULT '0'`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decSize" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decCount" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incSize" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incCount" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalSize" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalCount" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decSize" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decCount" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incSize" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incCount" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalSize" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalCount" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___remote_count" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___local_count" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___remote_count" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___local_count" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decSize" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decCount" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incSize" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incCount" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decSize" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decCount" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incSize" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incCount" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decSize" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decCount" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incSize" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incCount" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decSize" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decCount" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incSize" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incCount" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_renote" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_reply" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_normal" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_renote" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_reply" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_normal" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decUsage" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incUsage" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decFiles" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incFiles" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_totalFiles" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_renote" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_reply" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_normal" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_received" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_succeeded" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_failed" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decUsage" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incUsage" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decFiles" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incFiles" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_totalFiles" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_renote" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_reply" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_normal" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_received" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_succeeded" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_failed" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingBytes" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingBytes" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___totalTime" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingRequests" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingRequests" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingBytes" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___incomingBytes" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___totalTime" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingRequests" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___incomingRequests" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_renote" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_reply" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_normal" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_renote" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_reply" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_normal" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_renote" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_reply" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_normal" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_renote" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_reply" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_normal" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_total" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_dec" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_inc" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_total" DROP DEFAULT`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decSize" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decCount" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incSize" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incCount" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalSize" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalCount" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decSize" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decCount" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incSize" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incCount" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalSize" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalCount" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___remote_count" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___local_count" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___remote_count" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___local_count" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decSize" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decCount" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incSize" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incCount" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decSize" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decCount" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incSize" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incCount" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decSize" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decCount" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incSize" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incCount" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decSize" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decCount" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incSize" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incCount" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_renote" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_reply" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_normal" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_renote" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_reply" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_normal" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decUsage" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incUsage" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decFiles" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incFiles" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_totalFiles" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_renote" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_reply" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_normal" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_received" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_succeeded" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_failed" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decUsage" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incUsage" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decFiles" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incFiles" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_totalFiles" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___following_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___following_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___following_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___users_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___users_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___users_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_renote" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_reply" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_normal" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_received" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_succeeded" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_failed" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingBytes" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingBytes" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___totalTime" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingRequests" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingRequests" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingBytes" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___incomingBytes" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___totalTime" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingRequests" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___incomingRequests" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___remote_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___remote_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___remote_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___local_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___local_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___local_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_renote" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_reply" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_normal" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_renote" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_reply" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_normal" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_renote" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_reply" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_normal" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_renote" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_reply" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_normal" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_total" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_dec" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_inc" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_total" DROP DEFAULT`, + ); + } } diff --git a/packages/backend/migration/1644010796173-convert-hard-mutes.js b/packages/backend/migration/1644010796173-convert-hard-mutes.js index 207a759b8..39c5b080f 100644 --- a/packages/backend/migration/1644010796173-convert-hard-mutes.js +++ b/packages/backend/migration/1644010796173-convert-hard-mutes.js @@ -1,65 +1,70 @@ -import RE2 from 're2'; - +import RE2 from "re2"; export class convertHardMutes1644010796173 { - name = 'convertHardMutes1644010796173' + name = "convertHardMutes1644010796173"; - async up(queryRunner) { - let entries = await queryRunner.query(`SELECT "userId", "mutedWords" FROM "user_profile" WHERE "userHost" IS NULL`); - for(let i = 0; i < entries.length; i++) { - let words = entries[i].mutedWords - .map(line => { - if (typeof line === 'string') return []; - const regexp = line.join(" ").match(/^\/(.+)\/(.*)$/); - if (regexp) { - // convert regexp's - try { - new RE2(regexp[1], regexp[2]); - return `/${regexp[1]}/${regexp[2]}`; - } catch (err) { - // invalid regex, ignore it - return []; - } - } else { - // remove empty segments - return line.filter(x => x !== ''); - } - }) - // remove empty lines - .filter(x => !(Array.isArray(x) && x.length === 0)); + async up(queryRunner) { + let entries = await queryRunner.query( + `SELECT "userId", "mutedWords" FROM "user_profile" WHERE "userHost" IS NULL`, + ); + for (let i = 0; i < entries.length; i++) { + let words = entries[i].mutedWords + .map((line) => { + if (typeof line === "string") return []; + const regexp = line.join(" ").match(/^\/(.+)\/(.*)$/); + if (regexp) { + // convert regexp's + try { + new RE2(regexp[1], regexp[2]); + return `/${regexp[1]}/${regexp[2]}`; + } catch (err) { + // invalid regex, ignore it + return []; + } + } else { + // remove empty segments + return line.filter((x) => x !== ""); + } + }) + // remove empty lines + .filter((x) => !(Array.isArray(x) && x.length === 0)); - await queryRunner.connection.createQueryBuilder() - .update('user_profile') - .set({ - mutedWords: words - }) - .where('userId = :id', { id: entries[i].userId }) - .execute(); - } - } + await queryRunner.connection + .createQueryBuilder() + .update("user_profile") + .set({ + mutedWords: words, + }) + .where("userId = :id", { id: entries[i].userId }) + .execute(); + } + } - async down(queryRunner) { - let entries = await queryRunner.query(`SELECT "userId", "mutedWords" FROM "user_profile"`); - for(let i = 0; i < entries.length; i++) { - let words = entries[i].mutedWords - .map(line => { - if (Array.isArray(line)) { - return line; - } else { - // do not split regex at spaces again - return [line]; - } - }) - // remove empty lines - .filter(x => !(Array.isArray(x) && x.length === 0)); + async down(queryRunner) { + let entries = await queryRunner.query( + `SELECT "userId", "mutedWords" FROM "user_profile"`, + ); + for (let i = 0; i < entries.length; i++) { + let words = entries[i].mutedWords + .map((line) => { + if (Array.isArray(line)) { + return line; + } else { + // do not split regex at spaces again + return [line]; + } + }) + // remove empty lines + .filter((x) => !(Array.isArray(x) && x.length === 0)); - await queryRunner.connection.createQueryBuilder() - .update('user_profile') - .set({ - mutedWords: words - }) - .where('userId = :id', { id: entries[i].userId }) - .execute(); - } - } + await queryRunner.connection + .createQueryBuilder() + .update("user_profile") + .set({ + mutedWords: words, + }) + .where("userId = :id", { id: entries[i].userId }) + .execute(); + } + } } diff --git a/packages/backend/migration/1644058404077-chart-v7.js b/packages/backend/migration/1644058404077-chart-v7.js index f05ad003d..ab48c9ab3 100644 --- a/packages/backend/migration/1644058404077-chart-v7.js +++ b/packages/backend/migration/1644058404077-chart-v7.js @@ -1,501 +1,1470 @@ - - export class chartV71644058404077 { - name = 'chartV71644058404077' + name = "chartV71644058404077"; async up(queryRunner) { - await queryRunner.query(`UPDATE "__chart__federation" SET "___instance_total"=2147483647 WHERE "___instance_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__federation" SET "___instance_inc"=32767 WHERE "___instance_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart__federation" SET "___instance_dec"=32767 WHERE "___instance_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__federation" SET "___instance_total"=2147483647 WHERE "___instance_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__federation" SET "___instance_inc"=32767 WHERE "___instance_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__federation" SET "___instance_dec"=32767 WHERE "___instance_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart__notes" SET "___local_total"=2147483647 WHERE "___local_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__notes" SET "___local_inc"=2147483647 WHERE "___local_inc" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__notes" SET "___local_dec"=2147483647 WHERE "___local_dec" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__notes" SET "___local_diffs_normal"=2147483647 WHERE "___local_diffs_normal" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__notes" SET "___local_diffs_reply"=2147483647 WHERE "___local_diffs_reply" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__notes" SET "___local_diffs_renote"=2147483647 WHERE "___local_diffs_renote" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__notes" SET "___remote_total"=2147483647 WHERE "___remote_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__notes" SET "___remote_inc"=2147483647 WHERE "___remote_inc" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__notes" SET "___remote_dec"=2147483647 WHERE "___remote_dec" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__notes" SET "___remote_diffs_normal"=2147483647 WHERE "___remote_diffs_normal" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__notes" SET "___remote_diffs_reply"=2147483647 WHERE "___remote_diffs_reply" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__notes" SET "___remote_diffs_renote"=2147483647 WHERE "___remote_diffs_renote" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__notes" SET "___local_total"=2147483647 WHERE "___local_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__notes" SET "___local_inc"=2147483647 WHERE "___local_inc" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__notes" SET "___local_dec"=2147483647 WHERE "___local_dec" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__notes" SET "___local_diffs_normal"=2147483647 WHERE "___local_diffs_normal" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__notes" SET "___local_diffs_reply"=2147483647 WHERE "___local_diffs_reply" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__notes" SET "___local_diffs_renote"=2147483647 WHERE "___local_diffs_renote" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__notes" SET "___remote_total"=2147483647 WHERE "___remote_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__notes" SET "___remote_inc"=2147483647 WHERE "___remote_inc" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__notes" SET "___remote_dec"=2147483647 WHERE "___remote_dec" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__notes" SET "___remote_diffs_normal"=2147483647 WHERE "___remote_diffs_normal" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__notes" SET "___remote_diffs_reply"=2147483647 WHERE "___remote_diffs_reply" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__notes" SET "___remote_diffs_renote"=2147483647 WHERE "___remote_diffs_renote" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__users" SET "___local_total"=2147483647 WHERE "___local_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__users" SET "___local_inc"=32767 WHERE "___local_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart__users" SET "___local_dec"=32767 WHERE "___local_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart__users" SET "___remote_total"=2147483647 WHERE "___remote_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__users" SET "___remote_inc"=32767 WHERE "___remote_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart__users" SET "___remote_dec"=32767 WHERE "___remote_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__users" SET "___local_total"=2147483647 WHERE "___local_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__users" SET "___local_inc"=32767 WHERE "___local_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__users" SET "___local_dec"=32767 WHERE "___local_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__users" SET "___remote_total"=2147483647 WHERE "___remote_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__users" SET "___remote_inc"=32767 WHERE "___remote_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__users" SET "___remote_dec"=32767 WHERE "___remote_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart__network" SET "___incomingRequests"=2147483647 WHERE "___incomingRequests" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__network" SET "___outgoingRequests"=2147483647 WHERE "___outgoingRequests" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__network" SET "___totalTime"=2147483647 WHERE "___totalTime" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__network" SET "___incomingBytes"=2147483647 WHERE "___incomingBytes" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__network" SET "___outgoingBytes"=2147483647 WHERE "___outgoingBytes" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__network" SET "___incomingRequests"=2147483647 WHERE "___incomingRequests" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__network" SET "___outgoingRequests"=2147483647 WHERE "___outgoingRequests" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__network" SET "___totalTime"=2147483647 WHERE "___totalTime" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__network" SET "___incomingBytes"=2147483647 WHERE "___incomingBytes" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__network" SET "___outgoingBytes"=2147483647 WHERE "___outgoingBytes" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___requests_failed"=32767 WHERE "___requests_failed" > 32767`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___requests_succeeded"=32767 WHERE "___requests_succeeded" > 32767`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___requests_received"=32767 WHERE "___requests_received" > 32767`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___notes_total"=2147483647 WHERE "___notes_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___notes_inc"=2147483647 WHERE "___notes_inc" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___notes_dec"=2147483647 WHERE "___notes_dec" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___notes_diffs_normal"=2147483647 WHERE "___notes_diffs_normal" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___notes_diffs_reply"=2147483647 WHERE "___notes_diffs_reply" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___notes_diffs_renote"=2147483647 WHERE "___notes_diffs_renote" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___users_total"=2147483647 WHERE "___users_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___users_inc"=32767 WHERE "___users_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___users_dec"=32767 WHERE "___users_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___following_total"=2147483647 WHERE "___following_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___following_inc"=32767 WHERE "___following_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___following_dec"=32767 WHERE "___following_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___followers_total"=2147483647 WHERE "___followers_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___followers_inc"=32767 WHERE "___followers_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___followers_dec"=32767 WHERE "___followers_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___drive_totalFiles"=2147483647 WHERE "___drive_totalFiles" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___drive_incFiles"=2147483647 WHERE "___drive_incFiles" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___drive_decFiles"=2147483647 WHERE "___drive_decFiles" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___drive_incUsage"=2147483647 WHERE "___drive_incUsage" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__instance" SET "___drive_decUsage"=2147483647 WHERE "___drive_decUsage" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___requests_failed"=32767 WHERE "___requests_failed" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___requests_succeeded"=32767 WHERE "___requests_succeeded" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___requests_received"=32767 WHERE "___requests_received" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___notes_total"=2147483647 WHERE "___notes_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___notes_inc"=2147483647 WHERE "___notes_inc" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___notes_dec"=2147483647 WHERE "___notes_dec" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___notes_diffs_normal"=2147483647 WHERE "___notes_diffs_normal" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___notes_diffs_reply"=2147483647 WHERE "___notes_diffs_reply" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___notes_diffs_renote"=2147483647 WHERE "___notes_diffs_renote" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___users_total"=2147483647 WHERE "___users_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___users_inc"=32767 WHERE "___users_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___users_dec"=32767 WHERE "___users_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___following_total"=2147483647 WHERE "___following_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___following_inc"=32767 WHERE "___following_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___following_dec"=32767 WHERE "___following_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___followers_total"=2147483647 WHERE "___followers_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___followers_inc"=32767 WHERE "___followers_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___followers_dec"=32767 WHERE "___followers_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___drive_totalFiles"=2147483647 WHERE "___drive_totalFiles" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___drive_incFiles"=2147483647 WHERE "___drive_incFiles" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___drive_decFiles"=2147483647 WHERE "___drive_decFiles" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___drive_incUsage"=2147483647 WHERE "___drive_incUsage" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__instance" SET "___drive_decUsage"=2147483647 WHERE "___drive_decUsage" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__per_user_notes" SET "___total"=2147483647 WHERE "___total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__per_user_notes" SET "___inc"=32767 WHERE "___inc" > 32767`); - await queryRunner.query(`UPDATE "__chart__per_user_notes" SET "___dec"=32767 WHERE "___dec" > 32767`); - await queryRunner.query(`UPDATE "__chart__per_user_notes" SET "___diffs_normal"=32767 WHERE "___diffs_normal" > 32767`); - await queryRunner.query(`UPDATE "__chart__per_user_notes" SET "___diffs_reply"=32767 WHERE "___diffs_reply" > 32767`); - await queryRunner.query(`UPDATE "__chart__per_user_notes" SET "___diffs_renote"=32767 WHERE "___diffs_renote" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__per_user_notes" SET "___total"=2147483647 WHERE "___total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__per_user_notes" SET "___inc"=32767 WHERE "___inc" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__per_user_notes" SET "___dec"=32767 WHERE "___dec" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__per_user_notes" SET "___diffs_normal"=32767 WHERE "___diffs_normal" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__per_user_notes" SET "___diffs_reply"=32767 WHERE "___diffs_reply" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__per_user_notes" SET "___diffs_renote"=32767 WHERE "___diffs_renote" > 32767`); - await queryRunner.query(`UPDATE "__chart__drive" SET "___local_incCount"=2147483647 WHERE "___local_incCount" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__drive" SET "___local_incSize"=2147483647 WHERE "___local_incSize" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__drive" SET "___local_decCount"=2147483647 WHERE "___local_decCount" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__drive" SET "___local_decSize"=2147483647 WHERE "___local_decSize" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__drive" SET "___remote_incCount"=2147483647 WHERE "___remote_incCount" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__drive" SET "___remote_incSize"=2147483647 WHERE "___remote_incSize" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__drive" SET "___remote_decCount"=2147483647 WHERE "___remote_decCount" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__drive" SET "___remote_decSize"=2147483647 WHERE "___remote_decSize" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__drive" SET "___local_incCount"=2147483647 WHERE "___local_incCount" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__drive" SET "___local_incSize"=2147483647 WHERE "___local_incSize" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__drive" SET "___local_decCount"=2147483647 WHERE "___local_decCount" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__drive" SET "___local_decSize"=2147483647 WHERE "___local_decSize" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__drive" SET "___remote_incCount"=2147483647 WHERE "___remote_incCount" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__drive" SET "___remote_incSize"=2147483647 WHERE "___remote_incSize" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__drive" SET "___remote_decCount"=2147483647 WHERE "___remote_decCount" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__drive" SET "___remote_decSize"=2147483647 WHERE "___remote_decSize" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__per_user_reaction" SET "___local_count"=32767 WHERE "___local_count" > 32767`); - await queryRunner.query(`UPDATE "__chart__per_user_reaction" SET "___remote_count"=32767 WHERE "___remote_count" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__per_user_reaction" SET "___local_count"=32767 WHERE "___local_count" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__per_user_reaction" SET "___remote_count"=32767 WHERE "___remote_count" > 32767`); - await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___local_followings_total"=2147483647 WHERE "___local_followings_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___local_followings_inc"=32767 WHERE "___local_followings_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___local_followings_dec"=32767 WHERE "___local_followings_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___local_followers_total"=2147483647 WHERE "___local_followers_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___local_followers_inc"=32767 WHERE "___local_followers_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___local_followers_dec"=32767 WHERE "___local_followers_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___remote_followings_total"=2147483647 WHERE "___remote_followings_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___remote_followings_inc"=32767 WHERE "___remote_followings_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___remote_followings_dec"=32767 WHERE "___remote_followings_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___remote_followers_total"=2147483647 WHERE "___remote_followers_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___remote_followers_inc"=32767 WHERE "___remote_followers_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___remote_followers_dec"=32767 WHERE "___remote_followers_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___local_followings_total"=2147483647 WHERE "___local_followings_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___local_followings_inc"=32767 WHERE "___local_followings_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___local_followings_dec"=32767 WHERE "___local_followings_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___local_followers_total"=2147483647 WHERE "___local_followers_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___local_followers_inc"=32767 WHERE "___local_followers_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___local_followers_dec"=32767 WHERE "___local_followers_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___remote_followings_total"=2147483647 WHERE "___remote_followings_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___remote_followings_inc"=32767 WHERE "___remote_followings_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___remote_followings_dec"=32767 WHERE "___remote_followings_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___remote_followers_total"=2147483647 WHERE "___remote_followers_total" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___remote_followers_inc"=32767 WHERE "___remote_followers_inc" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___remote_followers_dec"=32767 WHERE "___remote_followers_dec" > 32767`); + await queryRunner.query( + `UPDATE "__chart__federation" SET "___instance_total"=2147483647 WHERE "___instance_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__federation" SET "___instance_inc"=32767 WHERE "___instance_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__federation" SET "___instance_dec"=32767 WHERE "___instance_dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__federation" SET "___instance_total"=2147483647 WHERE "___instance_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__federation" SET "___instance_inc"=32767 WHERE "___instance_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__federation" SET "___instance_dec"=32767 WHERE "___instance_dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__notes" SET "___local_total"=2147483647 WHERE "___local_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__notes" SET "___local_inc"=2147483647 WHERE "___local_inc" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__notes" SET "___local_dec"=2147483647 WHERE "___local_dec" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__notes" SET "___local_diffs_normal"=2147483647 WHERE "___local_diffs_normal" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__notes" SET "___local_diffs_reply"=2147483647 WHERE "___local_diffs_reply" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__notes" SET "___local_diffs_renote"=2147483647 WHERE "___local_diffs_renote" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__notes" SET "___remote_total"=2147483647 WHERE "___remote_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__notes" SET "___remote_inc"=2147483647 WHERE "___remote_inc" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__notes" SET "___remote_dec"=2147483647 WHERE "___remote_dec" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__notes" SET "___remote_diffs_normal"=2147483647 WHERE "___remote_diffs_normal" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__notes" SET "___remote_diffs_reply"=2147483647 WHERE "___remote_diffs_reply" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__notes" SET "___remote_diffs_renote"=2147483647 WHERE "___remote_diffs_renote" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__notes" SET "___local_total"=2147483647 WHERE "___local_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__notes" SET "___local_inc"=2147483647 WHERE "___local_inc" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__notes" SET "___local_dec"=2147483647 WHERE "___local_dec" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__notes" SET "___local_diffs_normal"=2147483647 WHERE "___local_diffs_normal" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__notes" SET "___local_diffs_reply"=2147483647 WHERE "___local_diffs_reply" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__notes" SET "___local_diffs_renote"=2147483647 WHERE "___local_diffs_renote" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__notes" SET "___remote_total"=2147483647 WHERE "___remote_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__notes" SET "___remote_inc"=2147483647 WHERE "___remote_inc" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__notes" SET "___remote_dec"=2147483647 WHERE "___remote_dec" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__notes" SET "___remote_diffs_normal"=2147483647 WHERE "___remote_diffs_normal" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__notes" SET "___remote_diffs_reply"=2147483647 WHERE "___remote_diffs_reply" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__notes" SET "___remote_diffs_renote"=2147483647 WHERE "___remote_diffs_renote" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__users" SET "___local_total"=2147483647 WHERE "___local_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__users" SET "___local_inc"=32767 WHERE "___local_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__users" SET "___local_dec"=32767 WHERE "___local_dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__users" SET "___remote_total"=2147483647 WHERE "___remote_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__users" SET "___remote_inc"=32767 WHERE "___remote_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__users" SET "___remote_dec"=32767 WHERE "___remote_dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__users" SET "___local_total"=2147483647 WHERE "___local_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__users" SET "___local_inc"=32767 WHERE "___local_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__users" SET "___local_dec"=32767 WHERE "___local_dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__users" SET "___remote_total"=2147483647 WHERE "___remote_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__users" SET "___remote_inc"=32767 WHERE "___remote_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__users" SET "___remote_dec"=32767 WHERE "___remote_dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__network" SET "___incomingRequests"=2147483647 WHERE "___incomingRequests" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__network" SET "___outgoingRequests"=2147483647 WHERE "___outgoingRequests" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__network" SET "___totalTime"=2147483647 WHERE "___totalTime" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__network" SET "___incomingBytes"=2147483647 WHERE "___incomingBytes" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__network" SET "___outgoingBytes"=2147483647 WHERE "___outgoingBytes" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__network" SET "___incomingRequests"=2147483647 WHERE "___incomingRequests" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__network" SET "___outgoingRequests"=2147483647 WHERE "___outgoingRequests" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__network" SET "___totalTime"=2147483647 WHERE "___totalTime" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__network" SET "___incomingBytes"=2147483647 WHERE "___incomingBytes" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__network" SET "___outgoingBytes"=2147483647 WHERE "___outgoingBytes" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___requests_failed"=32767 WHERE "___requests_failed" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___requests_succeeded"=32767 WHERE "___requests_succeeded" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___requests_received"=32767 WHERE "___requests_received" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___notes_total"=2147483647 WHERE "___notes_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___notes_inc"=2147483647 WHERE "___notes_inc" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___notes_dec"=2147483647 WHERE "___notes_dec" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___notes_diffs_normal"=2147483647 WHERE "___notes_diffs_normal" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___notes_diffs_reply"=2147483647 WHERE "___notes_diffs_reply" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___notes_diffs_renote"=2147483647 WHERE "___notes_diffs_renote" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___users_total"=2147483647 WHERE "___users_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___users_inc"=32767 WHERE "___users_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___users_dec"=32767 WHERE "___users_dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___following_total"=2147483647 WHERE "___following_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___following_inc"=32767 WHERE "___following_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___following_dec"=32767 WHERE "___following_dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___followers_total"=2147483647 WHERE "___followers_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___followers_inc"=32767 WHERE "___followers_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___followers_dec"=32767 WHERE "___followers_dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___drive_totalFiles"=2147483647 WHERE "___drive_totalFiles" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___drive_incFiles"=2147483647 WHERE "___drive_incFiles" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___drive_decFiles"=2147483647 WHERE "___drive_decFiles" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___drive_incUsage"=2147483647 WHERE "___drive_incUsage" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__instance" SET "___drive_decUsage"=2147483647 WHERE "___drive_decUsage" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___requests_failed"=32767 WHERE "___requests_failed" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___requests_succeeded"=32767 WHERE "___requests_succeeded" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___requests_received"=32767 WHERE "___requests_received" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___notes_total"=2147483647 WHERE "___notes_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___notes_inc"=2147483647 WHERE "___notes_inc" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___notes_dec"=2147483647 WHERE "___notes_dec" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___notes_diffs_normal"=2147483647 WHERE "___notes_diffs_normal" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___notes_diffs_reply"=2147483647 WHERE "___notes_diffs_reply" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___notes_diffs_renote"=2147483647 WHERE "___notes_diffs_renote" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___users_total"=2147483647 WHERE "___users_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___users_inc"=32767 WHERE "___users_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___users_dec"=32767 WHERE "___users_dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___following_total"=2147483647 WHERE "___following_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___following_inc"=32767 WHERE "___following_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___following_dec"=32767 WHERE "___following_dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___followers_total"=2147483647 WHERE "___followers_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___followers_inc"=32767 WHERE "___followers_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___followers_dec"=32767 WHERE "___followers_dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___drive_totalFiles"=2147483647 WHERE "___drive_totalFiles" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___drive_incFiles"=2147483647 WHERE "___drive_incFiles" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___drive_decFiles"=2147483647 WHERE "___drive_decFiles" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___drive_incUsage"=2147483647 WHERE "___drive_incUsage" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__instance" SET "___drive_decUsage"=2147483647 WHERE "___drive_decUsage" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_notes" SET "___total"=2147483647 WHERE "___total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_notes" SET "___inc"=32767 WHERE "___inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_notes" SET "___dec"=32767 WHERE "___dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_notes" SET "___diffs_normal"=32767 WHERE "___diffs_normal" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_notes" SET "___diffs_reply"=32767 WHERE "___diffs_reply" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_notes" SET "___diffs_renote"=32767 WHERE "___diffs_renote" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_notes" SET "___total"=2147483647 WHERE "___total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_notes" SET "___inc"=32767 WHERE "___inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_notes" SET "___dec"=32767 WHERE "___dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_notes" SET "___diffs_normal"=32767 WHERE "___diffs_normal" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_notes" SET "___diffs_reply"=32767 WHERE "___diffs_reply" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_notes" SET "___diffs_renote"=32767 WHERE "___diffs_renote" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__drive" SET "___local_incCount"=2147483647 WHERE "___local_incCount" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__drive" SET "___local_incSize"=2147483647 WHERE "___local_incSize" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__drive" SET "___local_decCount"=2147483647 WHERE "___local_decCount" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__drive" SET "___local_decSize"=2147483647 WHERE "___local_decSize" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__drive" SET "___remote_incCount"=2147483647 WHERE "___remote_incCount" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__drive" SET "___remote_incSize"=2147483647 WHERE "___remote_incSize" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__drive" SET "___remote_decCount"=2147483647 WHERE "___remote_decCount" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__drive" SET "___remote_decSize"=2147483647 WHERE "___remote_decSize" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__drive" SET "___local_incCount"=2147483647 WHERE "___local_incCount" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__drive" SET "___local_incSize"=2147483647 WHERE "___local_incSize" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__drive" SET "___local_decCount"=2147483647 WHERE "___local_decCount" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__drive" SET "___local_decSize"=2147483647 WHERE "___local_decSize" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__drive" SET "___remote_incCount"=2147483647 WHERE "___remote_incCount" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__drive" SET "___remote_incSize"=2147483647 WHERE "___remote_incSize" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__drive" SET "___remote_decCount"=2147483647 WHERE "___remote_decCount" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__drive" SET "___remote_decSize"=2147483647 WHERE "___remote_decSize" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_reaction" SET "___local_count"=32767 WHERE "___local_count" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_reaction" SET "___remote_count"=32767 WHERE "___remote_count" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_reaction" SET "___local_count"=32767 WHERE "___local_count" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_reaction" SET "___remote_count"=32767 WHERE "___remote_count" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_following" SET "___local_followings_total"=2147483647 WHERE "___local_followings_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_following" SET "___local_followings_inc"=32767 WHERE "___local_followings_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_following" SET "___local_followings_dec"=32767 WHERE "___local_followings_dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_following" SET "___local_followers_total"=2147483647 WHERE "___local_followers_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_following" SET "___local_followers_inc"=32767 WHERE "___local_followers_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_following" SET "___local_followers_dec"=32767 WHERE "___local_followers_dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_following" SET "___remote_followings_total"=2147483647 WHERE "___remote_followings_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_following" SET "___remote_followings_inc"=32767 WHERE "___remote_followings_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_following" SET "___remote_followings_dec"=32767 WHERE "___remote_followings_dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_following" SET "___remote_followers_total"=2147483647 WHERE "___remote_followers_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_following" SET "___remote_followers_inc"=32767 WHERE "___remote_followers_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart__per_user_following" SET "___remote_followers_dec"=32767 WHERE "___remote_followers_dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_following" SET "___local_followings_total"=2147483647 WHERE "___local_followings_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_following" SET "___local_followings_inc"=32767 WHERE "___local_followings_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_following" SET "___local_followings_dec"=32767 WHERE "___local_followings_dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_following" SET "___local_followers_total"=2147483647 WHERE "___local_followers_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_following" SET "___local_followers_inc"=32767 WHERE "___local_followers_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_following" SET "___local_followers_dec"=32767 WHERE "___local_followers_dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_following" SET "___remote_followings_total"=2147483647 WHERE "___remote_followings_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_following" SET "___remote_followings_inc"=32767 WHERE "___remote_followings_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_following" SET "___remote_followings_dec"=32767 WHERE "___remote_followings_dec" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_following" SET "___remote_followers_total"=2147483647 WHERE "___remote_followers_total" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_following" SET "___remote_followers_inc"=32767 WHERE "___remote_followers_inc" > 32767`, + ); + await queryRunner.query( + `UPDATE "__chart_day__per_user_following" SET "___remote_followers_dec"=32767 WHERE "___remote_followers_dec" > 32767`, + ); await queryRunner.query(`TRUNCATE TABLE "__chart__per_user_drive"`); await queryRunner.query(`TRUNCATE TABLE "__chart_day__per_user_drive"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_total" TYPE integer USING "___instance_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_inc" TYPE smallint USING "___instance_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_dec" TYPE smallint USING "___instance_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_total" TYPE integer USING "___instance_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_inc" TYPE smallint USING "___instance_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_dec" TYPE smallint USING "___instance_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_total" TYPE integer USING "___local_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_inc" TYPE integer USING "___local_inc"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_dec" TYPE integer USING "___local_dec"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_normal" TYPE integer USING "___local_diffs_normal"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_reply" TYPE integer USING "___local_diffs_reply"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_renote" TYPE integer USING "___local_diffs_renote"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_total" TYPE integer USING "___remote_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_inc" TYPE integer USING "___remote_inc"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_dec" TYPE integer USING "___remote_dec"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_normal" TYPE integer USING "___remote_diffs_normal"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_reply" TYPE integer USING "___remote_diffs_reply"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_renote" TYPE integer USING "___remote_diffs_renote"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_total" TYPE integer USING "___local_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_inc" TYPE integer USING "___local_inc"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_dec" TYPE integer USING "___local_dec"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_normal" TYPE integer USING "___local_diffs_normal"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_reply" TYPE integer USING "___local_diffs_reply"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_renote" TYPE integer USING "___local_diffs_renote"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_total" TYPE integer USING "___remote_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_inc" TYPE integer USING "___remote_inc"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_dec" TYPE integer USING "___remote_dec"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_normal" TYPE integer USING "___remote_diffs_normal"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_reply" TYPE integer USING "___remote_diffs_reply"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_renote" TYPE integer USING "___remote_diffs_renote"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_total" TYPE integer USING "___local_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_inc" TYPE smallint USING "___local_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_dec" TYPE smallint USING "___local_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_total" TYPE integer USING "___remote_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_inc" TYPE smallint USING "___remote_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_dec" TYPE smallint USING "___remote_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_total" TYPE integer USING "___local_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_inc" TYPE smallint USING "___local_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_dec" TYPE smallint USING "___local_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_total" TYPE integer USING "___remote_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_inc" TYPE smallint USING "___remote_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_dec" TYPE smallint USING "___remote_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___incomingRequests" TYPE integer USING "___incomingRequests"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingRequests" TYPE integer USING "___outgoingRequests"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___totalTime" TYPE integer USING "___totalTime"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___incomingBytes" TYPE integer USING "___incomingBytes"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingBytes" TYPE integer USING "___outgoingBytes"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingRequests" TYPE integer USING "___incomingRequests"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingRequests" TYPE integer USING "___outgoingRequests"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___totalTime" TYPE integer USING "___totalTime"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingBytes" TYPE integer USING "___incomingBytes"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingBytes" TYPE integer USING "___outgoingBytes"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_failed" TYPE smallint USING "___requests_failed"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_succeeded" TYPE smallint USING "___requests_succeeded"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_received" TYPE smallint USING "___requests_received"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_total" TYPE integer USING "___notes_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_inc" TYPE integer USING "___notes_inc"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_dec" TYPE integer USING "___notes_dec"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_normal" TYPE integer USING "___notes_diffs_normal"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_reply" TYPE integer USING "___notes_diffs_reply"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_renote" TYPE integer USING "___notes_diffs_renote"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_total" TYPE integer USING "___users_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_inc" TYPE smallint USING "___users_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_dec" TYPE smallint USING "___users_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_total" TYPE integer USING "___following_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_inc" TYPE smallint USING "___following_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_dec" TYPE smallint USING "___following_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_total" TYPE integer USING "___followers_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_inc" TYPE smallint USING "___followers_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_dec" TYPE smallint USING "___followers_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_totalFiles" TYPE integer USING "___drive_totalFiles"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incFiles" TYPE integer USING "___drive_incFiles"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decFiles" TYPE integer USING "___drive_decFiles"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incUsage" TYPE integer USING "___drive_incUsage"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decUsage" TYPE integer USING "___drive_decUsage"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_failed" TYPE smallint USING "___requests_failed"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_succeeded" TYPE smallint USING "___requests_succeeded"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_received" TYPE smallint USING "___requests_received"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_total" TYPE integer USING "___notes_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_inc" TYPE integer USING "___notes_inc"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_dec" TYPE integer USING "___notes_dec"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_normal" TYPE integer USING "___notes_diffs_normal"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_reply" TYPE integer USING "___notes_diffs_reply"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_renote" TYPE integer USING "___notes_diffs_renote"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_total" TYPE integer USING "___users_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_inc" TYPE smallint USING "___users_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_dec" TYPE smallint USING "___users_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_total" TYPE integer USING "___following_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_inc" TYPE smallint USING "___following_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_dec" TYPE smallint USING "___following_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_total" TYPE integer USING "___followers_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_inc" TYPE smallint USING "___followers_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_dec" TYPE smallint USING "___followers_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_totalFiles" TYPE integer USING "___drive_totalFiles"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incFiles" TYPE integer USING "___drive_incFiles"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decFiles" TYPE integer USING "___drive_decFiles"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incUsage" TYPE integer USING "___drive_incUsage"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decUsage" TYPE integer USING "___drive_decUsage"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___total" TYPE integer USING "___total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___inc" TYPE smallint USING "___inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___dec" TYPE smallint USING "___dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_normal" TYPE smallint USING "___diffs_normal"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_reply" TYPE smallint USING "___diffs_reply"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_renote" TYPE smallint USING "___diffs_renote"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___total" TYPE integer USING "___total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___inc" TYPE smallint USING "___inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___dec" TYPE smallint USING "___dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_normal" TYPE smallint USING "___diffs_normal"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_reply" TYPE smallint USING "___diffs_reply"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_renote" TYPE smallint USING "___diffs_renote"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incCount" TYPE integer USING "___local_incCount"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incSize" TYPE integer USING "___local_incSize"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decCount" TYPE integer USING "___local_decCount"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decSize" TYPE integer USING "___local_decSize"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incCount" TYPE integer USING "___remote_incCount"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incSize" TYPE integer USING "___remote_incSize"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decCount" TYPE integer USING "___remote_decCount"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decSize" TYPE integer USING "___remote_decSize"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incCount" TYPE integer USING "___local_incCount"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incSize" TYPE integer USING "___local_incSize"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decCount" TYPE integer USING "___local_decCount"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decSize" TYPE integer USING "___local_decSize"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incCount" TYPE integer USING "___remote_incCount"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incSize" TYPE integer USING "___remote_incSize"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decCount" TYPE integer USING "___remote_decCount"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decSize" TYPE integer USING "___remote_decSize"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___local_count" TYPE smallint USING "___local_count"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___remote_count" TYPE smallint USING "___remote_count"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___local_count" TYPE smallint USING "___local_count"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___remote_count" TYPE smallint USING "___remote_count"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_total" TYPE integer USING "___local_followings_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_inc" TYPE smallint USING "___local_followings_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_dec" TYPE smallint USING "___local_followings_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_total" TYPE integer USING "___local_followers_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_inc" TYPE smallint USING "___local_followers_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_dec" TYPE smallint USING "___local_followers_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_total" TYPE integer USING "___remote_followings_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_inc" TYPE smallint USING "___remote_followings_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_dec" TYPE smallint USING "___remote_followings_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_total" TYPE integer USING "___remote_followers_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_inc" TYPE smallint USING "___remote_followers_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_dec" TYPE smallint USING "___remote_followers_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_total" TYPE integer USING "___local_followings_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_inc" TYPE smallint USING "___local_followings_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_dec" TYPE smallint USING "___local_followings_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_total" TYPE integer USING "___local_followers_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_inc" TYPE smallint USING "___local_followers_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_dec" TYPE smallint USING "___local_followers_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_total" TYPE integer USING "___remote_followings_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_inc" TYPE smallint USING "___remote_followings_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_dec" TYPE smallint USING "___remote_followings_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_total" TYPE integer USING "___remote_followers_total"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_inc" TYPE smallint USING "___remote_followers_inc"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_dec" TYPE smallint USING "___remote_followers_dec"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalCount" TYPE integer USING "___totalCount"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalSize" TYPE integer USING "___totalSize"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incCount" TYPE smallint USING "___incCount"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incSize" TYPE integer USING "___incSize"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decCount" TYPE smallint USING "___decCount"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decSize" TYPE integer USING "___decSize"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalCount" TYPE integer USING "___totalCount"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalSize" TYPE integer USING "___totalSize"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incCount" TYPE smallint USING "___incCount"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incSize" TYPE integer USING "___incSize"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decCount" TYPE smallint USING "___decCount"::smallint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decSize" TYPE integer USING "___decSize"::integer`); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_total" TYPE integer USING "___instance_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_inc" TYPE smallint USING "___instance_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_dec" TYPE smallint USING "___instance_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_total" TYPE integer USING "___instance_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_inc" TYPE smallint USING "___instance_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_dec" TYPE smallint USING "___instance_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_total" TYPE integer USING "___local_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_inc" TYPE integer USING "___local_inc"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_dec" TYPE integer USING "___local_dec"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_normal" TYPE integer USING "___local_diffs_normal"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_reply" TYPE integer USING "___local_diffs_reply"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_renote" TYPE integer USING "___local_diffs_renote"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_total" TYPE integer USING "___remote_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_inc" TYPE integer USING "___remote_inc"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_dec" TYPE integer USING "___remote_dec"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_normal" TYPE integer USING "___remote_diffs_normal"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_reply" TYPE integer USING "___remote_diffs_reply"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_renote" TYPE integer USING "___remote_diffs_renote"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_total" TYPE integer USING "___local_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_inc" TYPE integer USING "___local_inc"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_dec" TYPE integer USING "___local_dec"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_normal" TYPE integer USING "___local_diffs_normal"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_reply" TYPE integer USING "___local_diffs_reply"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_renote" TYPE integer USING "___local_diffs_renote"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_total" TYPE integer USING "___remote_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_inc" TYPE integer USING "___remote_inc"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_dec" TYPE integer USING "___remote_dec"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_normal" TYPE integer USING "___remote_diffs_normal"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_reply" TYPE integer USING "___remote_diffs_reply"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_renote" TYPE integer USING "___remote_diffs_renote"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___local_total" TYPE integer USING "___local_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___local_inc" TYPE smallint USING "___local_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___local_dec" TYPE smallint USING "___local_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___remote_total" TYPE integer USING "___remote_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___remote_inc" TYPE smallint USING "___remote_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___remote_dec" TYPE smallint USING "___remote_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_total" TYPE integer USING "___local_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_inc" TYPE smallint USING "___local_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_dec" TYPE smallint USING "___local_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_total" TYPE integer USING "___remote_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_inc" TYPE smallint USING "___remote_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_dec" TYPE smallint USING "___remote_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___incomingRequests" TYPE integer USING "___incomingRequests"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingRequests" TYPE integer USING "___outgoingRequests"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___totalTime" TYPE integer USING "___totalTime"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___incomingBytes" TYPE integer USING "___incomingBytes"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingBytes" TYPE integer USING "___outgoingBytes"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingRequests" TYPE integer USING "___incomingRequests"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingRequests" TYPE integer USING "___outgoingRequests"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___totalTime" TYPE integer USING "___totalTime"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingBytes" TYPE integer USING "___incomingBytes"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingBytes" TYPE integer USING "___outgoingBytes"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_failed" TYPE smallint USING "___requests_failed"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_succeeded" TYPE smallint USING "___requests_succeeded"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_received" TYPE smallint USING "___requests_received"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_total" TYPE integer USING "___notes_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_inc" TYPE integer USING "___notes_inc"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_dec" TYPE integer USING "___notes_dec"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_normal" TYPE integer USING "___notes_diffs_normal"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_reply" TYPE integer USING "___notes_diffs_reply"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_renote" TYPE integer USING "___notes_diffs_renote"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___users_total" TYPE integer USING "___users_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___users_inc" TYPE smallint USING "___users_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___users_dec" TYPE smallint USING "___users_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___following_total" TYPE integer USING "___following_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___following_inc" TYPE smallint USING "___following_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___following_dec" TYPE smallint USING "___following_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_total" TYPE integer USING "___followers_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_inc" TYPE smallint USING "___followers_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_dec" TYPE smallint USING "___followers_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_totalFiles" TYPE integer USING "___drive_totalFiles"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incFiles" TYPE integer USING "___drive_incFiles"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decFiles" TYPE integer USING "___drive_decFiles"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incUsage" TYPE integer USING "___drive_incUsage"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decUsage" TYPE integer USING "___drive_decUsage"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_failed" TYPE smallint USING "___requests_failed"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_succeeded" TYPE smallint USING "___requests_succeeded"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_received" TYPE smallint USING "___requests_received"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_total" TYPE integer USING "___notes_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_inc" TYPE integer USING "___notes_inc"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_dec" TYPE integer USING "___notes_dec"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_normal" TYPE integer USING "___notes_diffs_normal"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_reply" TYPE integer USING "___notes_diffs_reply"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_renote" TYPE integer USING "___notes_diffs_renote"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_total" TYPE integer USING "___users_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_inc" TYPE smallint USING "___users_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_dec" TYPE smallint USING "___users_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_total" TYPE integer USING "___following_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_inc" TYPE smallint USING "___following_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_dec" TYPE smallint USING "___following_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_total" TYPE integer USING "___followers_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_inc" TYPE smallint USING "___followers_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_dec" TYPE smallint USING "___followers_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_totalFiles" TYPE integer USING "___drive_totalFiles"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incFiles" TYPE integer USING "___drive_incFiles"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decFiles" TYPE integer USING "___drive_decFiles"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incUsage" TYPE integer USING "___drive_incUsage"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decUsage" TYPE integer USING "___drive_decUsage"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___total" TYPE integer USING "___total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___inc" TYPE smallint USING "___inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___dec" TYPE smallint USING "___dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_normal" TYPE smallint USING "___diffs_normal"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_reply" TYPE smallint USING "___diffs_reply"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_renote" TYPE smallint USING "___diffs_renote"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___total" TYPE integer USING "___total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___inc" TYPE smallint USING "___inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___dec" TYPE smallint USING "___dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_normal" TYPE smallint USING "___diffs_normal"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_reply" TYPE smallint USING "___diffs_reply"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_renote" TYPE smallint USING "___diffs_renote"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incCount" TYPE integer USING "___local_incCount"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incSize" TYPE integer USING "___local_incSize"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decCount" TYPE integer USING "___local_decCount"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decSize" TYPE integer USING "___local_decSize"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incCount" TYPE integer USING "___remote_incCount"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incSize" TYPE integer USING "___remote_incSize"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decCount" TYPE integer USING "___remote_decCount"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decSize" TYPE integer USING "___remote_decSize"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incCount" TYPE integer USING "___local_incCount"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incSize" TYPE integer USING "___local_incSize"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decCount" TYPE integer USING "___local_decCount"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decSize" TYPE integer USING "___local_decSize"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incCount" TYPE integer USING "___remote_incCount"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incSize" TYPE integer USING "___remote_incSize"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decCount" TYPE integer USING "___remote_decCount"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decSize" TYPE integer USING "___remote_decSize"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___local_count" TYPE smallint USING "___local_count"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___remote_count" TYPE smallint USING "___remote_count"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___local_count" TYPE smallint USING "___local_count"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___remote_count" TYPE smallint USING "___remote_count"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_total" TYPE integer USING "___local_followings_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_inc" TYPE smallint USING "___local_followings_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_dec" TYPE smallint USING "___local_followings_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_total" TYPE integer USING "___local_followers_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_inc" TYPE smallint USING "___local_followers_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_dec" TYPE smallint USING "___local_followers_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_total" TYPE integer USING "___remote_followings_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_inc" TYPE smallint USING "___remote_followings_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_dec" TYPE smallint USING "___remote_followings_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_total" TYPE integer USING "___remote_followers_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_inc" TYPE smallint USING "___remote_followers_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_dec" TYPE smallint USING "___remote_followers_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_total" TYPE integer USING "___local_followings_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_inc" TYPE smallint USING "___local_followings_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_dec" TYPE smallint USING "___local_followings_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_total" TYPE integer USING "___local_followers_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_inc" TYPE smallint USING "___local_followers_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_dec" TYPE smallint USING "___local_followers_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_total" TYPE integer USING "___remote_followings_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_inc" TYPE smallint USING "___remote_followings_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_dec" TYPE smallint USING "___remote_followings_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_total" TYPE integer USING "___remote_followers_total"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_inc" TYPE smallint USING "___remote_followers_inc"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_dec" TYPE smallint USING "___remote_followers_dec"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalCount" TYPE integer USING "___totalCount"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalSize" TYPE integer USING "___totalSize"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incCount" TYPE smallint USING "___incCount"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incSize" TYPE integer USING "___incSize"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decCount" TYPE smallint USING "___decCount"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decSize" TYPE integer USING "___decSize"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalCount" TYPE integer USING "___totalCount"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalSize" TYPE integer USING "___totalSize"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incCount" TYPE smallint USING "___incCount"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incSize" TYPE integer USING "___incSize"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decCount" TYPE smallint USING "___decCount"::smallint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decSize" TYPE integer USING "___decSize"::integer`, + ); } async down(queryRunner) { - - await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_total" TYPE bigint USING "___instance_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_inc" TYPE bigint USING "___instance_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_dec" TYPE bigint USING "___instance_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_total" TYPE bigint USING "___instance_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_inc" TYPE bigint USING "___instance_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_dec" TYPE bigint USING "___instance_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_total" TYPE bigint USING "___local_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_inc" TYPE bigint USING "___local_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_dec" TYPE bigint USING "___local_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_normal" TYPE bigint USING "___local_diffs_normal"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_reply" TYPE bigint USING "___local_diffs_reply"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_renote" TYPE bigint USING "___local_diffs_renote"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_total" TYPE bigint USING "___remote_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_inc" TYPE bigint USING "___remote_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_dec" TYPE bigint USING "___remote_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_normal" TYPE bigint USING "___remote_diffs_normal"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_reply" TYPE bigint USING "___remote_diffs_reply"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_renote" TYPE bigint USING "___remote_diffs_renote"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_total" TYPE bigint USING "___local_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_inc" TYPE bigint USING "___local_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_dec" TYPE bigint USING "___local_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_normal" TYPE bigint USING "___local_diffs_normal"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_reply" TYPE bigint USING "___local_diffs_reply"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_renote" TYPE bigint USING "___local_diffs_renote"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_total" TYPE bigint USING "___remote_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_inc" TYPE bigint USING "___remote_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_dec" TYPE bigint USING "___remote_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_normal" TYPE bigint USING "___remote_diffs_normal"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_reply" TYPE bigint USING "___remote_diffs_reply"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_renote" TYPE bigint USING "___remote_diffs_renote"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_total" TYPE bigint USING "___local_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_inc" TYPE bigint USING "___local_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_dec" TYPE bigint USING "___local_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_total" TYPE bigint USING "___remote_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_inc" TYPE bigint USING "___remote_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_dec" TYPE bigint USING "___remote_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_total" TYPE bigint USING "___local_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_inc" TYPE bigint USING "___local_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_dec" TYPE bigint USING "___local_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_total" TYPE bigint USING "___remote_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_inc" TYPE bigint USING "___remote_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_dec" TYPE bigint USING "___remote_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___incomingRequests" TYPE bigint USING "___incomingRequests"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingRequests" TYPE bigint USING "___outgoingRequests"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___totalTime" TYPE bigint USING "___totalTime"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___incomingBytes" TYPE bigint USING "___incomingBytes"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingBytes" TYPE bigint USING "___outgoingBytes"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingRequests" TYPE bigint USING "___incomingRequests"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingRequests" TYPE bigint USING "___outgoingRequests"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___totalTime" TYPE bigint USING "___totalTime"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingBytes" TYPE bigint USING "___incomingBytes"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingBytes" TYPE bigint USING "___outgoingBytes"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_failed" TYPE bigint USING "___requests_failed"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_succeeded" TYPE bigint USING "___requests_succeeded"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_received" TYPE bigint USING "___requests_received"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_total" TYPE bigint USING "___notes_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_inc" TYPE bigint USING "___notes_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_dec" TYPE bigint USING "___notes_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_normal" TYPE bigint USING "___notes_diffs_normal"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_reply" TYPE bigint USING "___notes_diffs_reply"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_renote" TYPE bigint USING "___notes_diffs_renote"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_total" TYPE bigint USING "___users_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_inc" TYPE bigint USING "___users_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_dec" TYPE bigint USING "___users_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_total" TYPE bigint USING "___following_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_inc" TYPE bigint USING "___following_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_dec" TYPE bigint USING "___following_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_total" TYPE bigint USING "___followers_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_inc" TYPE bigint USING "___followers_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_dec" TYPE bigint USING "___followers_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_totalFiles" TYPE bigint USING "___drive_totalFiles"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incFiles" TYPE bigint USING "___drive_incFiles"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decFiles" TYPE bigint USING "___drive_decFiles"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incUsage" TYPE bigint USING "___drive_incUsage"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decUsage" TYPE bigint USING "___drive_decUsage"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_failed" TYPE bigint USING "___requests_failed"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_succeeded" TYPE bigint USING "___requests_succeeded"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_received" TYPE bigint USING "___requests_received"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_total" TYPE bigint USING "___notes_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_inc" TYPE bigint USING "___notes_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_dec" TYPE bigint USING "___notes_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_normal" TYPE bigint USING "___notes_diffs_normal"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_reply" TYPE bigint USING "___notes_diffs_reply"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_renote" TYPE bigint USING "___notes_diffs_renote"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_total" TYPE bigint USING "___users_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_inc" TYPE bigint USING "___users_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_dec" TYPE bigint USING "___users_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_total" TYPE bigint USING "___following_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_inc" TYPE bigint USING "___following_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_dec" TYPE bigint USING "___following_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_total" TYPE bigint USING "___followers_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_inc" TYPE bigint USING "___followers_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_dec" TYPE bigint USING "___followers_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_totalFiles" TYPE bigint USING "___drive_totalFiles"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incFiles" TYPE bigint USING "___drive_incFiles"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decFiles" TYPE bigint USING "___drive_decFiles"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incUsage" TYPE bigint USING "___drive_incUsage"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decUsage" TYPE bigint USING "___drive_decUsage"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___total" TYPE bigint USING "___total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___inc" TYPE bigint USING "___inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___dec" TYPE bigint USING "___dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_normal" TYPE bigint USING "___diffs_normal"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_reply" TYPE bigint USING "___diffs_reply"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_renote" TYPE bigint USING "___diffs_renote"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___total" TYPE bigint USING "___total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___inc" TYPE bigint USING "___inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___dec" TYPE bigint USING "___dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_normal" TYPE bigint USING "___diffs_normal"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_reply" TYPE bigint USING "___diffs_reply"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_renote" TYPE bigint USING "___diffs_renote"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incCount" TYPE bigint USING "___local_incCount"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incSize" TYPE bigint USING "___local_incSize"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decCount" TYPE bigint USING "___local_decCount"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decSize" TYPE bigint USING "___local_decSize"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incCount" TYPE bigint USING "___remote_incCount"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incSize" TYPE bigint USING "___remote_incSize"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decCount" TYPE bigint USING "___remote_decCount"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decSize" TYPE bigint USING "___remote_decSize"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incCount" TYPE bigint USING "___local_incCount"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incSize" TYPE bigint USING "___local_incSize"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decCount" TYPE bigint USING "___local_decCount"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decSize" TYPE bigint USING "___local_decSize"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incCount" TYPE bigint USING "___remote_incCount"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incSize" TYPE bigint USING "___remote_incSize"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decCount" TYPE bigint USING "___remote_decCount"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decSize" TYPE bigint USING "___remote_decSize"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___local_count" TYPE bigint USING "___local_count"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___remote_count" TYPE bigint USING "___remote_count"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___local_count" TYPE bigint USING "___local_count"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___remote_count" TYPE bigint USING "___remote_count"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_total" TYPE bigint USING "___local_followings_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_inc" TYPE bigint USING "___local_followings_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_dec" TYPE bigint USING "___local_followings_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_total" TYPE bigint USING "___local_followers_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_inc" TYPE bigint USING "___local_followers_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_dec" TYPE bigint USING "___local_followers_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_total" TYPE bigint USING "___remote_followings_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_inc" TYPE bigint USING "___remote_followings_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_dec" TYPE bigint USING "___remote_followings_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_total" TYPE bigint USING "___remote_followers_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_inc" TYPE bigint USING "___remote_followers_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_dec" TYPE bigint USING "___remote_followers_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_total" TYPE bigint USING "___local_followings_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_inc" TYPE bigint USING "___local_followings_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_dec" TYPE bigint USING "___local_followings_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_total" TYPE bigint USING "___local_followers_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_inc" TYPE bigint USING "___local_followers_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_dec" TYPE bigint USING "___local_followers_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_total" TYPE bigint USING "___remote_followings_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_inc" TYPE bigint USING "___remote_followings_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_dec" TYPE bigint USING "___remote_followings_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_total" TYPE bigint USING "___remote_followers_total"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_inc" TYPE bigint USING "___remote_followers_inc"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_dec" TYPE bigint USING "___remote_followers_dec"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalCount" TYPE bigint USING "___totalCount"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalSize" TYPE bigint USING "___totalSize"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incCount" TYPE bigint USING "___incCount"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incSize" TYPE bigint USING "___incSize"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decCount" TYPE bigint USING "___decCount"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decSize" TYPE bigint USING "___decSize"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalCount" TYPE bigint USING "___totalCount"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalSize" TYPE bigint USING "___totalSize"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incCount" TYPE bigint USING "___incCount"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incSize" TYPE bigint USING "___incSize"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decCount" TYPE bigint USING "___decCount"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decSize" TYPE bigint USING "___decSize"::bigint`); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_total" TYPE bigint USING "___instance_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_inc" TYPE bigint USING "___instance_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_dec" TYPE bigint USING "___instance_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_total" TYPE bigint USING "___instance_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_inc" TYPE bigint USING "___instance_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_dec" TYPE bigint USING "___instance_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_total" TYPE bigint USING "___local_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_inc" TYPE bigint USING "___local_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_dec" TYPE bigint USING "___local_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_normal" TYPE bigint USING "___local_diffs_normal"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_reply" TYPE bigint USING "___local_diffs_reply"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_renote" TYPE bigint USING "___local_diffs_renote"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_total" TYPE bigint USING "___remote_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_inc" TYPE bigint USING "___remote_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_dec" TYPE bigint USING "___remote_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_normal" TYPE bigint USING "___remote_diffs_normal"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_reply" TYPE bigint USING "___remote_diffs_reply"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_renote" TYPE bigint USING "___remote_diffs_renote"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_total" TYPE bigint USING "___local_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_inc" TYPE bigint USING "___local_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_dec" TYPE bigint USING "___local_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_normal" TYPE bigint USING "___local_diffs_normal"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_reply" TYPE bigint USING "___local_diffs_reply"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_renote" TYPE bigint USING "___local_diffs_renote"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_total" TYPE bigint USING "___remote_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_inc" TYPE bigint USING "___remote_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_dec" TYPE bigint USING "___remote_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_normal" TYPE bigint USING "___remote_diffs_normal"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_reply" TYPE bigint USING "___remote_diffs_reply"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_renote" TYPE bigint USING "___remote_diffs_renote"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___local_total" TYPE bigint USING "___local_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___local_inc" TYPE bigint USING "___local_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___local_dec" TYPE bigint USING "___local_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___remote_total" TYPE bigint USING "___remote_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___remote_inc" TYPE bigint USING "___remote_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__users" ALTER COLUMN "___remote_dec" TYPE bigint USING "___remote_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_total" TYPE bigint USING "___local_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_inc" TYPE bigint USING "___local_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_dec" TYPE bigint USING "___local_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_total" TYPE bigint USING "___remote_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_inc" TYPE bigint USING "___remote_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_dec" TYPE bigint USING "___remote_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___incomingRequests" TYPE bigint USING "___incomingRequests"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingRequests" TYPE bigint USING "___outgoingRequests"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___totalTime" TYPE bigint USING "___totalTime"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___incomingBytes" TYPE bigint USING "___incomingBytes"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingBytes" TYPE bigint USING "___outgoingBytes"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingRequests" TYPE bigint USING "___incomingRequests"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingRequests" TYPE bigint USING "___outgoingRequests"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___totalTime" TYPE bigint USING "___totalTime"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingBytes" TYPE bigint USING "___incomingBytes"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingBytes" TYPE bigint USING "___outgoingBytes"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_failed" TYPE bigint USING "___requests_failed"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_succeeded" TYPE bigint USING "___requests_succeeded"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_received" TYPE bigint USING "___requests_received"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_total" TYPE bigint USING "___notes_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_inc" TYPE bigint USING "___notes_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_dec" TYPE bigint USING "___notes_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_normal" TYPE bigint USING "___notes_diffs_normal"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_reply" TYPE bigint USING "___notes_diffs_reply"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_renote" TYPE bigint USING "___notes_diffs_renote"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___users_total" TYPE bigint USING "___users_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___users_inc" TYPE bigint USING "___users_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___users_dec" TYPE bigint USING "___users_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___following_total" TYPE bigint USING "___following_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___following_inc" TYPE bigint USING "___following_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___following_dec" TYPE bigint USING "___following_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_total" TYPE bigint USING "___followers_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_inc" TYPE bigint USING "___followers_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_dec" TYPE bigint USING "___followers_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_totalFiles" TYPE bigint USING "___drive_totalFiles"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incFiles" TYPE bigint USING "___drive_incFiles"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decFiles" TYPE bigint USING "___drive_decFiles"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incUsage" TYPE bigint USING "___drive_incUsage"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decUsage" TYPE bigint USING "___drive_decUsage"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_failed" TYPE bigint USING "___requests_failed"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_succeeded" TYPE bigint USING "___requests_succeeded"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_received" TYPE bigint USING "___requests_received"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_total" TYPE bigint USING "___notes_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_inc" TYPE bigint USING "___notes_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_dec" TYPE bigint USING "___notes_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_normal" TYPE bigint USING "___notes_diffs_normal"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_reply" TYPE bigint USING "___notes_diffs_reply"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_renote" TYPE bigint USING "___notes_diffs_renote"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_total" TYPE bigint USING "___users_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_inc" TYPE bigint USING "___users_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_dec" TYPE bigint USING "___users_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_total" TYPE bigint USING "___following_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_inc" TYPE bigint USING "___following_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_dec" TYPE bigint USING "___following_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_total" TYPE bigint USING "___followers_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_inc" TYPE bigint USING "___followers_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_dec" TYPE bigint USING "___followers_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_totalFiles" TYPE bigint USING "___drive_totalFiles"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incFiles" TYPE bigint USING "___drive_incFiles"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decFiles" TYPE bigint USING "___drive_decFiles"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incUsage" TYPE bigint USING "___drive_incUsage"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decUsage" TYPE bigint USING "___drive_decUsage"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___total" TYPE bigint USING "___total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___inc" TYPE bigint USING "___inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___dec" TYPE bigint USING "___dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_normal" TYPE bigint USING "___diffs_normal"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_reply" TYPE bigint USING "___diffs_reply"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_renote" TYPE bigint USING "___diffs_renote"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___total" TYPE bigint USING "___total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___inc" TYPE bigint USING "___inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___dec" TYPE bigint USING "___dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_normal" TYPE bigint USING "___diffs_normal"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_reply" TYPE bigint USING "___diffs_reply"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_renote" TYPE bigint USING "___diffs_renote"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incCount" TYPE bigint USING "___local_incCount"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incSize" TYPE bigint USING "___local_incSize"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decCount" TYPE bigint USING "___local_decCount"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decSize" TYPE bigint USING "___local_decSize"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incCount" TYPE bigint USING "___remote_incCount"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incSize" TYPE bigint USING "___remote_incSize"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decCount" TYPE bigint USING "___remote_decCount"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decSize" TYPE bigint USING "___remote_decSize"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incCount" TYPE bigint USING "___local_incCount"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incSize" TYPE bigint USING "___local_incSize"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decCount" TYPE bigint USING "___local_decCount"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decSize" TYPE bigint USING "___local_decSize"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incCount" TYPE bigint USING "___remote_incCount"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incSize" TYPE bigint USING "___remote_incSize"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decCount" TYPE bigint USING "___remote_decCount"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decSize" TYPE bigint USING "___remote_decSize"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___local_count" TYPE bigint USING "___local_count"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___remote_count" TYPE bigint USING "___remote_count"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___local_count" TYPE bigint USING "___local_count"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___remote_count" TYPE bigint USING "___remote_count"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_total" TYPE bigint USING "___local_followings_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_inc" TYPE bigint USING "___local_followings_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_dec" TYPE bigint USING "___local_followings_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_total" TYPE bigint USING "___local_followers_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_inc" TYPE bigint USING "___local_followers_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_dec" TYPE bigint USING "___local_followers_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_total" TYPE bigint USING "___remote_followings_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_inc" TYPE bigint USING "___remote_followings_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_dec" TYPE bigint USING "___remote_followings_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_total" TYPE bigint USING "___remote_followers_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_inc" TYPE bigint USING "___remote_followers_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_dec" TYPE bigint USING "___remote_followers_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_total" TYPE bigint USING "___local_followings_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_inc" TYPE bigint USING "___local_followings_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_dec" TYPE bigint USING "___local_followings_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_total" TYPE bigint USING "___local_followers_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_inc" TYPE bigint USING "___local_followers_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_dec" TYPE bigint USING "___local_followers_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_total" TYPE bigint USING "___remote_followings_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_inc" TYPE bigint USING "___remote_followings_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_dec" TYPE bigint USING "___remote_followings_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_total" TYPE bigint USING "___remote_followers_total"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_inc" TYPE bigint USING "___remote_followers_inc"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_dec" TYPE bigint USING "___remote_followers_dec"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalCount" TYPE bigint USING "___totalCount"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalSize" TYPE bigint USING "___totalSize"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incCount" TYPE bigint USING "___incCount"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incSize" TYPE bigint USING "___incSize"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decCount" TYPE bigint USING "___decCount"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decSize" TYPE bigint USING "___decSize"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalCount" TYPE bigint USING "___totalCount"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalSize" TYPE bigint USING "___totalSize"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incCount" TYPE bigint USING "___incCount"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incSize" TYPE bigint USING "___incSize"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decCount" TYPE bigint USING "___decCount"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decSize" TYPE bigint USING "___decSize"::bigint`, + ); } } diff --git a/packages/backend/migration/1644059847460-chart-v8.js b/packages/backend/migration/1644059847460-chart-v8.js index a5339c0eb..f9357c8ca 100644 --- a/packages/backend/migration/1644059847460-chart-v8.js +++ b/packages/backend/migration/1644059847460-chart-v8.js @@ -1,25 +1,46 @@ - - export class chartV81644059847460 { - name = 'chartV81644059847460' + name = "chartV81644059847460"; - async up(queryRunner) { - await queryRunner.query(`UPDATE "__chart__active_users" SET "___local_users"=2147483647 WHERE "___local_users" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__active_users" SET "___remote_users"=2147483647 WHERE "___remote_users" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__active_users" SET "___local_users"=2147483647 WHERE "___local_users" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__active_users" SET "___remote_users"=2147483647 WHERE "___remote_users" > 2147483647`); + async up(queryRunner) { + await queryRunner.query( + `UPDATE "__chart__active_users" SET "___local_users"=2147483647 WHERE "___local_users" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__active_users" SET "___remote_users"=2147483647 WHERE "___remote_users" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__active_users" SET "___local_users"=2147483647 WHERE "___local_users" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__active_users" SET "___remote_users"=2147483647 WHERE "___remote_users" > 2147483647`, + ); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___local_users" TYPE integer USING "___local_users"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___remote_users" TYPE integer USING "___remote_users"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___local_users" TYPE integer USING "___local_users"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___remote_users" TYPE integer USING "___remote_users"::integer`); - } - - async down(queryRunner) { - - await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___local_users" TYPE bigint USING "___local_users"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___remote_users" TYPE bigint USING "___remote_users"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___local_users" TYPE bigint USING "___local_users"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___remote_users" TYPE bigint USING "___remote_users"::bigint`); - } + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ALTER COLUMN "___local_users" TYPE integer USING "___local_users"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ALTER COLUMN "___remote_users" TYPE integer USING "___remote_users"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___local_users" TYPE integer USING "___local_users"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___remote_users" TYPE integer USING "___remote_users"::integer`, + ); + } + + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ALTER COLUMN "___local_users" TYPE bigint USING "___local_users"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ALTER COLUMN "___remote_users" TYPE bigint USING "___remote_users"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___local_users" TYPE bigint USING "___local_users"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___remote_users" TYPE bigint USING "___remote_users"::bigint`, + ); + } } diff --git a/packages/backend/migration/1644060125705-chart-v9.js b/packages/backend/migration/1644060125705-chart-v9.js index da35d4231..7d7934e31 100644 --- a/packages/backend/migration/1644060125705-chart-v9.js +++ b/packages/backend/migration/1644060125705-chart-v9.js @@ -1,25 +1,46 @@ - - export class chartV91644060125705 { - name = 'chartV91644060125705' + name = "chartV91644060125705"; - async up(queryRunner) { - await queryRunner.query(`UPDATE "__chart__hashtag" SET "___local_users"=2147483647 WHERE "___local_users" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__hashtag" SET "___remote_users"=2147483647 WHERE "___remote_users" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__hashtag" SET "___local_users"=2147483647 WHERE "___local_users" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__hashtag" SET "___remote_users"=2147483647 WHERE "___remote_users" > 2147483647`); + async up(queryRunner) { + await queryRunner.query( + `UPDATE "__chart__hashtag" SET "___local_users"=2147483647 WHERE "___local_users" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart__hashtag" SET "___remote_users"=2147483647 WHERE "___remote_users" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__hashtag" SET "___local_users"=2147483647 WHERE "___local_users" > 2147483647`, + ); + await queryRunner.query( + `UPDATE "__chart_day__hashtag" SET "___remote_users"=2147483647 WHERE "___remote_users" > 2147483647`, + ); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ALTER COLUMN "___local_users" TYPE integer USING "___local_users"::integer`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ALTER COLUMN "___remote_users" TYPE integer USING "___remote_users"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ALTER COLUMN "___local_users" TYPE integer USING "___local_users"::integer`); - await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ALTER COLUMN "___remote_users" TYPE integer USING "___remote_users"::integer`); - } - - async down(queryRunner) { - - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ALTER COLUMN "___local_users" TYPE bigint USING "___local_users"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart__hashtag" ALTER COLUMN "___remote_users" TYPE bigint USING "___remote_users"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ALTER COLUMN "___local_users" TYPE bigint USING "___local_users"::bigint`); - await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ALTER COLUMN "___remote_users" TYPE bigint USING "___remote_users"::bigint`); - } + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ALTER COLUMN "___local_users" TYPE integer USING "___local_users"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ALTER COLUMN "___remote_users" TYPE integer USING "___remote_users"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__hashtag" ALTER COLUMN "___local_users" TYPE integer USING "___local_users"::integer`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__hashtag" ALTER COLUMN "___remote_users" TYPE integer USING "___remote_users"::integer`, + ); + } + + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ALTER COLUMN "___local_users" TYPE bigint USING "___local_users"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__hashtag" ALTER COLUMN "___remote_users" TYPE bigint USING "___remote_users"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__hashtag" ALTER COLUMN "___local_users" TYPE bigint USING "___local_users"::bigint`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__hashtag" ALTER COLUMN "___remote_users" TYPE bigint USING "___remote_users"::bigint`, + ); + } } diff --git a/packages/backend/migration/1644073149413-chart-v10.js b/packages/backend/migration/1644073149413-chart-v10.js index 7260bbeca..8038dad15 100644 --- a/packages/backend/migration/1644073149413-chart-v10.js +++ b/packages/backend/migration/1644073149413-chart-v10.js @@ -1,35 +1,77 @@ - - export class chartV101644073149413 { - name = 'chartV101644073149413' + name = "chartV101644073149413"; - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "__chart__ap_request" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "___deliverFailed" integer NOT NULL DEFAULT '0', "___deliverSucceeded" integer NOT NULL DEFAULT '0', "___inboxReceived" integer NOT NULL DEFAULT '0', CONSTRAINT "UQ_e56f4beac5746d44bc3e19c80d0" UNIQUE ("date"), CONSTRAINT "PK_56a25cd447c7ee08876b3baf8d8" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_e56f4beac5746d44bc3e19c80d" ON "__chart__ap_request" ("date") `); - await queryRunner.query(`CREATE TABLE "__chart_day__ap_request" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "___deliverFailed" integer NOT NULL DEFAULT '0', "___deliverSucceeded" integer NOT NULL DEFAULT '0', "___inboxReceived" integer NOT NULL DEFAULT '0', CONSTRAINT "UQ_a848f66d6cec11980a5dd595822" UNIQUE ("date"), CONSTRAINT "PK_9318b49daee320194e23f712e69" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_a848f66d6cec11980a5dd59582" ON "__chart_day__ap_request" ("date") `); - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "unique_temp___deliveredInstances" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "___deliveredInstances" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "unique_temp___inboxInstances" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "___inboxInstances" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "unique_temp___deliveredInstances" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "___deliveredInstances" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "unique_temp___inboxInstances" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "___inboxInstances" smallint NOT NULL DEFAULT '0'`); - } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "__chart__ap_request" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "___deliverFailed" integer NOT NULL DEFAULT '0', "___deliverSucceeded" integer NOT NULL DEFAULT '0', "___inboxReceived" integer NOT NULL DEFAULT '0', CONSTRAINT "UQ_e56f4beac5746d44bc3e19c80d0" UNIQUE ("date"), CONSTRAINT "PK_56a25cd447c7ee08876b3baf8d8" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_e56f4beac5746d44bc3e19c80d" ON "__chart__ap_request" ("date") `, + ); + await queryRunner.query( + `CREATE TABLE "__chart_day__ap_request" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "___deliverFailed" integer NOT NULL DEFAULT '0', "___deliverSucceeded" integer NOT NULL DEFAULT '0', "___inboxReceived" integer NOT NULL DEFAULT '0', CONSTRAINT "UQ_a848f66d6cec11980a5dd595822" UNIQUE ("date"), CONSTRAINT "PK_9318b49daee320194e23f712e69" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_a848f66d6cec11980a5dd59582" ON "__chart_day__ap_request" ("date") `, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD "unique_temp___deliveredInstances" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD "___deliveredInstances" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD "unique_temp___inboxInstances" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD "___inboxInstances" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ADD "unique_temp___deliveredInstances" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ADD "___deliveredInstances" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ADD "unique_temp___inboxInstances" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ADD "___inboxInstances" smallint NOT NULL DEFAULT '0'`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "___inboxInstances"`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "unique_temp___inboxInstances"`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "___deliveredInstances"`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "unique_temp___deliveredInstances"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "___inboxInstances"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "unique_temp___inboxInstances"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "___deliveredInstances"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "unique_temp___deliveredInstances"`); - await queryRunner.query(`DROP INDEX "public"."IDX_a848f66d6cec11980a5dd59582"`); - await queryRunner.query(`DROP TABLE "__chart_day__ap_request"`); - await queryRunner.query(`DROP INDEX "public"."IDX_e56f4beac5746d44bc3e19c80d"`); - await queryRunner.query(`DROP TABLE "__chart__ap_request"`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" DROP COLUMN "___inboxInstances"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" DROP COLUMN "unique_temp___inboxInstances"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" DROP COLUMN "___deliveredInstances"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" DROP COLUMN "unique_temp___deliveredInstances"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP COLUMN "___inboxInstances"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP COLUMN "unique_temp___inboxInstances"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP COLUMN "___deliveredInstances"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP COLUMN "unique_temp___deliveredInstances"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_a848f66d6cec11980a5dd59582"`, + ); + await queryRunner.query(`DROP TABLE "__chart_day__ap_request"`); + await queryRunner.query( + `DROP INDEX "public"."IDX_e56f4beac5746d44bc3e19c80d"`, + ); + await queryRunner.query(`DROP TABLE "__chart__ap_request"`); + } } diff --git a/packages/backend/migration/1644095659741-chart-v11.js b/packages/backend/migration/1644095659741-chart-v11.js index 309fff1d9..8db122d4f 100644 --- a/packages/backend/migration/1644095659741-chart-v11.js +++ b/packages/backend/migration/1644095659741-chart-v11.js @@ -1,91 +1,249 @@ - - export class chartV111644095659741 { - name = 'chartV111644095659741' + name = "chartV111644095659741"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___local_users"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___remote_users"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___local_users"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___remote_users"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___local_users"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___remote_users"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___local_users"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___remote_users"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "unique_temp___users" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___users" integer NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "unique_temp___notedUsers" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___notedUsers" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "unique_temp___registeredWithinWeek" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___registeredWithinWeek" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "unique_temp___registeredWithinMonth" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___registeredWithinMonth" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "unique_temp___registeredWithinYear" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___registeredWithinYear" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "unique_temp___registeredOutsideWeek" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___registeredOutsideWeek" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "unique_temp___registeredOutsideMonth" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___registeredOutsideMonth" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "unique_temp___registeredOutsideYear" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___registeredOutsideYear" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "unique_temp___users" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___users" integer NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "unique_temp___notedUsers" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___notedUsers" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "unique_temp___registeredWithinWeek" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___registeredWithinWeek" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "unique_temp___registeredWithinMonth" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___registeredWithinMonth" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "unique_temp___registeredWithinYear" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___registeredWithinYear" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "unique_temp___registeredOutsideWeek" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___registeredOutsideWeek" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "unique_temp___registeredOutsideMonth" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___registeredOutsideMonth" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "unique_temp___registeredOutsideYear" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___registeredOutsideYear" smallint NOT NULL DEFAULT '0'`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___local_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___remote_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___local_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___remote_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "___local_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "___remote_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___local_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___remote_users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "unique_temp___users" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___users" integer NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "unique_temp___notedUsers" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___notedUsers" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "unique_temp___registeredWithinWeek" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___registeredWithinWeek" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "unique_temp___registeredWithinMonth" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___registeredWithinMonth" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "unique_temp___registeredWithinYear" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___registeredWithinYear" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "unique_temp___registeredOutsideWeek" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___registeredOutsideWeek" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "unique_temp___registeredOutsideMonth" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___registeredOutsideMonth" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "unique_temp___registeredOutsideYear" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___registeredOutsideYear" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "unique_temp___users" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "___users" integer NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "unique_temp___notedUsers" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "___notedUsers" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "unique_temp___registeredWithinWeek" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "___registeredWithinWeek" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "unique_temp___registeredWithinMonth" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "___registeredWithinMonth" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "unique_temp___registeredWithinYear" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "___registeredWithinYear" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "unique_temp___registeredOutsideWeek" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "___registeredOutsideWeek" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "unique_temp___registeredOutsideMonth" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "___registeredOutsideMonth" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "unique_temp___registeredOutsideYear" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "___registeredOutsideYear" smallint NOT NULL DEFAULT '0'`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___registeredOutsideYear"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___registeredOutsideYear"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___registeredOutsideMonth"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___registeredOutsideMonth"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___registeredOutsideWeek"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___registeredOutsideWeek"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___registeredWithinYear"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___registeredWithinYear"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___registeredWithinMonth"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___registeredWithinMonth"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___registeredWithinWeek"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___registeredWithinWeek"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___notedUsers"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___notedUsers"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___users"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___users"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___registeredOutsideYear"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___registeredOutsideYear"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___registeredOutsideMonth"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___registeredOutsideMonth"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___registeredOutsideWeek"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___registeredOutsideWeek"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___registeredWithinYear"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___registeredWithinYear"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___registeredWithinMonth"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___registeredWithinMonth"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___registeredWithinWeek"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___registeredWithinWeek"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___notedUsers"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___notedUsers"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___users"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___users"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "unique_temp___remote_users" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "unique_temp___local_users" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___remote_users" integer NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___local_users" integer NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "unique_temp___remote_users" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "unique_temp___local_users" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___remote_users" integer NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___local_users" integer NOT NULL DEFAULT '0'`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "___registeredOutsideYear"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___registeredOutsideYear"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "___registeredOutsideMonth"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___registeredOutsideMonth"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "___registeredOutsideWeek"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___registeredOutsideWeek"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "___registeredWithinYear"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___registeredWithinYear"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "___registeredWithinMonth"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___registeredWithinMonth"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "___registeredWithinWeek"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___registeredWithinWeek"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "___notedUsers"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___notedUsers"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "___users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___registeredOutsideYear"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___registeredOutsideYear"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___registeredOutsideMonth"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___registeredOutsideMonth"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___registeredOutsideWeek"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___registeredOutsideWeek"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___registeredWithinYear"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___registeredWithinYear"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___registeredWithinMonth"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___registeredWithinMonth"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___registeredWithinWeek"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___registeredWithinWeek"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___notedUsers"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___notedUsers"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "unique_temp___remote_users" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "unique_temp___local_users" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "___remote_users" integer NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "___local_users" integer NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "unique_temp___remote_users" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "unique_temp___local_users" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___remote_users" integer NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___local_users" integer NOT NULL DEFAULT '0'`, + ); + } } diff --git a/packages/backend/migration/1644328606241-chart-v12.js b/packages/backend/migration/1644328606241-chart-v12.js index c3c7e44f9..ea363e12f 100644 --- a/packages/backend/migration/1644328606241-chart-v12.js +++ b/packages/backend/migration/1644328606241-chart-v12.js @@ -1,27 +1,57 @@ - - export class chartV121644328606241 { - name = 'chartV121644328606241' + name = "chartV121644328606241"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart__notes" ADD "___local_diffs_withFile" integer NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__notes" ADD "___remote_diffs_withFile" integer NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ADD "___local_diffs_withFile" integer NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" ADD "___remote_diffs_withFile" integer NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__instance" ADD "___notes_diffs_withFile" integer NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" ADD "___notes_diffs_withFile" integer NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ADD "___diffs_withFile" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ADD "___diffs_withFile" smallint NOT NULL DEFAULT '0'`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart__notes" ADD "___local_diffs_withFile" integer NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" ADD "___remote_diffs_withFile" integer NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ADD "___local_diffs_withFile" integer NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" ADD "___remote_diffs_withFile" integer NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" ADD "___notes_diffs_withFile" integer NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" ADD "___notes_diffs_withFile" integer NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" ADD "___diffs_withFile" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" ADD "___diffs_withFile" smallint NOT NULL DEFAULT '0'`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" DROP COLUMN "___diffs_withFile"`); - await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" DROP COLUMN "___diffs_withFile"`); - await queryRunner.query(`ALTER TABLE "__chart_day__instance" DROP COLUMN "___notes_diffs_withFile"`); - await queryRunner.query(`ALTER TABLE "__chart__instance" DROP COLUMN "___notes_diffs_withFile"`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" DROP COLUMN "___remote_diffs_withFile"`); - await queryRunner.query(`ALTER TABLE "__chart_day__notes" DROP COLUMN "___local_diffs_withFile"`); - await queryRunner.query(`ALTER TABLE "__chart__notes" DROP COLUMN "___remote_diffs_withFile"`); - await queryRunner.query(`ALTER TABLE "__chart__notes" DROP COLUMN "___local_diffs_withFile"`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart_day__per_user_notes" DROP COLUMN "___diffs_withFile"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__per_user_notes" DROP COLUMN "___diffs_withFile"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__instance" DROP COLUMN "___notes_diffs_withFile"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__instance" DROP COLUMN "___notes_diffs_withFile"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" DROP COLUMN "___remote_diffs_withFile"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__notes" DROP COLUMN "___local_diffs_withFile"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" DROP COLUMN "___remote_diffs_withFile"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__notes" DROP COLUMN "___local_diffs_withFile"`, + ); + } } diff --git a/packages/backend/migration/1644331238153-chart-v13.js b/packages/backend/migration/1644331238153-chart-v13.js index 639f7b4e2..cbb1830f5 100644 --- a/packages/backend/migration/1644331238153-chart-v13.js +++ b/packages/backend/migration/1644331238153-chart-v13.js @@ -1,19 +1,33 @@ - - export class chartV131644331238153 { - name = 'chartV131644331238153' + name = "chartV131644331238153"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "unique_temp___stalled" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "___stalled" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "unique_temp___stalled" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "___stalled" smallint NOT NULL DEFAULT '0'`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD "unique_temp___stalled" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD "___stalled" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ADD "unique_temp___stalled" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ADD "___stalled" smallint NOT NULL DEFAULT '0'`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "___stalled"`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "unique_temp___stalled"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "___stalled"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "unique_temp___stalled"`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" DROP COLUMN "___stalled"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" DROP COLUMN "unique_temp___stalled"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP COLUMN "___stalled"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP COLUMN "unique_temp___stalled"`, + ); + } } diff --git a/packages/backend/migration/1644344266289-chart-v14.js b/packages/backend/migration/1644344266289-chart-v14.js index a0d9cfc38..6e6c03083 100644 --- a/packages/backend/migration/1644344266289-chart-v14.js +++ b/packages/backend/migration/1644344266289-chart-v14.js @@ -1,47 +1,117 @@ - - export class chartV141644344266289 { - name = 'chartV141644344266289' + name = "chartV141644344266289"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___users"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___users"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___notedUsers"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___notedUsers"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___users"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___users"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___notedUsers"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___notedUsers"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___readWrite" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "unique_temp___read" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___read" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "unique_temp___write" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___write" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___readWrite" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "unique_temp___read" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___read" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "unique_temp___write" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___write" smallint NOT NULL DEFAULT '0'`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___notedUsers"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___notedUsers"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "___users"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___notedUsers"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "___notedUsers"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___readWrite" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "unique_temp___read" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___read" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "unique_temp___write" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___write" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "___readWrite" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "unique_temp___read" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "___read" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "unique_temp___write" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "___write" smallint NOT NULL DEFAULT '0'`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___write"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___write"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___read"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___read"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___readWrite"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___write"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___write"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___read"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___read"`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___readWrite"`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___notedUsers" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "unique_temp___notedUsers" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___users" integer NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "unique_temp___users" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___notedUsers" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "unique_temp___notedUsers" character varying array NOT NULL DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___users" integer NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "unique_temp___users" character varying array NOT NULL DEFAULT '{}'`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "___write"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___write"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "___read"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___read"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" DROP COLUMN "___readWrite"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___write"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___write"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___read"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___read"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" DROP COLUMN "___readWrite"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "___notedUsers" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "unique_temp___notedUsers" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "___users" integer NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__active_users" ADD "unique_temp___users" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___notedUsers" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "unique_temp___notedUsers" character varying array NOT NULL DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "___users" integer NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__active_users" ADD "unique_temp___users" character varying array NOT NULL DEFAULT '{}'`, + ); + } } diff --git a/packages/backend/migration/1644395759931-instance-theme-color.js b/packages/backend/migration/1644395759931-instance-theme-color.js index 8f335ad21..1e0ee04bc 100644 --- a/packages/backend/migration/1644395759931-instance-theme-color.js +++ b/packages/backend/migration/1644395759931-instance-theme-color.js @@ -1,13 +1,13 @@ - - export class instanceThemeColor1644395759931 { - name = 'instanceThemeColor1644395759931' + name = "instanceThemeColor1644395759931"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "themeColor" character varying(512)`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "themeColor" character varying(512)`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "themeColor"`); - } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "themeColor"`); + } } diff --git a/packages/backend/migration/1644481657998-chart-v15.js b/packages/backend/migration/1644481657998-chart-v15.js index b50ca87c4..a8e1b89cb 100644 --- a/packages/backend/migration/1644481657998-chart-v15.js +++ b/packages/backend/migration/1644481657998-chart-v15.js @@ -1,31 +1,69 @@ - - export class chartV151644481657998 { - name = 'chartV151644481657998' + name = "chartV151644481657998"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "___instance_total"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "___instance_inc"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "___instance_dec"`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "___instance_total"`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "___instance_inc"`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "___instance_dec"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "___sub" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "___pub" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "___sub" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "___pub" smallint NOT NULL DEFAULT '0'`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP COLUMN "___instance_total"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP COLUMN "___instance_inc"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP COLUMN "___instance_dec"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" DROP COLUMN "___instance_total"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" DROP COLUMN "___instance_inc"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" DROP COLUMN "___instance_dec"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD "___sub" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD "___pub" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ADD "___sub" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ADD "___pub" smallint NOT NULL DEFAULT '0'`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "___pub"`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "___sub"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "___pub"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "___sub"`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "___instance_dec" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "___instance_inc" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "___instance_total" integer NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "___instance_dec" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "___instance_inc" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "___instance_total" integer NOT NULL DEFAULT '0'`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" DROP COLUMN "___pub"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" DROP COLUMN "___sub"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP COLUMN "___pub"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP COLUMN "___sub"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ADD "___instance_dec" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ADD "___instance_inc" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ADD "___instance_total" integer NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD "___instance_dec" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD "___instance_inc" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD "___instance_total" integer NOT NULL DEFAULT '0'`, + ); + } } diff --git a/packages/backend/migration/1644551208096-following-indexes.js b/packages/backend/migration/1644551208096-following-indexes.js index 276473ff6..b06f764e5 100644 --- a/packages/backend/migration/1644551208096-following-indexes.js +++ b/packages/backend/migration/1644551208096-following-indexes.js @@ -1,15 +1,21 @@ - - export class followingIndexes1644551208096 { - name = 'followingIndexes1644551208096' + name = "followingIndexes1644551208096"; - async up(queryRunner) { - await queryRunner.query(`CREATE INDEX "IDX_4ccd2239268ebbd1b35e318754" ON "following" ("followerHost") `); - await queryRunner.query(`CREATE INDEX "IDX_fcdafee716dfe9c3b5fde90f30" ON "following" ("followeeHost") `); - } + async up(queryRunner) { + await queryRunner.query( + `CREATE INDEX "IDX_4ccd2239268ebbd1b35e318754" ON "following" ("followerHost") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_fcdafee716dfe9c3b5fde90f30" ON "following" ("followeeHost") `, + ); + } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "public"."IDX_fcdafee716dfe9c3b5fde90f30"`); - await queryRunner.query(`DROP INDEX "public"."IDX_4ccd2239268ebbd1b35e318754"`); - } + async down(queryRunner) { + await queryRunner.query( + `DROP INDEX "public"."IDX_fcdafee716dfe9c3b5fde90f30"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_4ccd2239268ebbd1b35e318754"`, + ); + } } diff --git a/packages/backend/migration/1645340161439-remove-max-note-text-length.js b/packages/backend/migration/1645340161439-remove-max-note-text-length.js index c88cb70bf..d17ef8c12 100644 --- a/packages/backend/migration/1645340161439-remove-max-note-text-length.js +++ b/packages/backend/migration/1645340161439-remove-max-note-text-length.js @@ -1,13 +1,15 @@ - - export class removeMaxNoteTextLength1645340161439 { - name = 'removeMaxNoteTextLength1645340161439' + name = "removeMaxNoteTextLength1645340161439"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "maxNoteTextLength"`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "maxNoteTextLength"`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "maxNoteTextLength" integer NOT NULL DEFAULT '500'`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "maxNoteTextLength" integer NOT NULL DEFAULT '500'`, + ); + } } diff --git a/packages/backend/migration/1645599900873-federation-chart-pubsub.js b/packages/backend/migration/1645599900873-federation-chart-pubsub.js index fd7cb6d5a..58e2b4c00 100644 --- a/packages/backend/migration/1645599900873-federation-chart-pubsub.js +++ b/packages/backend/migration/1645599900873-federation-chart-pubsub.js @@ -1,15 +1,21 @@ - - export class federationChartPubsub1645599900873 { - name = 'federationChartPubsub1645599900873' + name = "federationChartPubsub1645599900873"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "___pubsub" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "___pubsub" smallint NOT NULL DEFAULT '0'`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD "___pubsub" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ADD "___pubsub" smallint NOT NULL DEFAULT '0'`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "___pubsub"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "___pubsub"`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" DROP COLUMN "___pubsub"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP COLUMN "___pubsub"`, + ); + } } diff --git a/packages/backend/migration/1646143552768-instance-default-theme.js b/packages/backend/migration/1646143552768-instance-default-theme.js index 029354fd9..d97efcaa6 100644 --- a/packages/backend/migration/1646143552768-instance-default-theme.js +++ b/packages/backend/migration/1646143552768-instance-default-theme.js @@ -1,13 +1,21 @@ export class instanceDefaultTheme1646143552768 { - name = 'instanceDefaultTheme1646143552768' + name = "instanceDefaultTheme1646143552768"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "defaultLightTheme" character varying(8192)`); - await queryRunner.query(`ALTER TABLE "meta" ADD "defaultDarkTheme" character varying(8192)`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "defaultLightTheme" character varying(8192)`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "defaultDarkTheme" character varying(8192)`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "defaultDarkTheme"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "defaultLightTheme"`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "defaultDarkTheme"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "defaultLightTheme"`, + ); + } } diff --git a/packages/backend/migration/1646387162108-mute-expires-at.js b/packages/backend/migration/1646387162108-mute-expires-at.js index c8be8f3c5..52fe101bd 100644 --- a/packages/backend/migration/1646387162108-mute-expires-at.js +++ b/packages/backend/migration/1646387162108-mute-expires-at.js @@ -1,13 +1,19 @@ export class muteExpiresAt1646387162108 { - name = 'muteExpiresAt1646387162108' + name = "muteExpiresAt1646387162108"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "muting" ADD "expiresAt" TIMESTAMP WITH TIME ZONE`); - await queryRunner.query(`CREATE INDEX "IDX_c1fd1c3dfb0627aa36c253fd14" ON "muting" ("expiresAt") `); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "muting" ADD "expiresAt" TIMESTAMP WITH TIME ZONE`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_c1fd1c3dfb0627aa36c253fd14" ON "muting" ("expiresAt") `, + ); + } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "public"."IDX_c1fd1c3dfb0627aa36c253fd14"`); - await queryRunner.query(`ALTER TABLE "muting" DROP COLUMN "expiresAt"`); - } + async down(queryRunner) { + await queryRunner.query( + `DROP INDEX "public"."IDX_c1fd1c3dfb0627aa36c253fd14"`, + ); + await queryRunner.query(`ALTER TABLE "muting" DROP COLUMN "expiresAt"`); + } } diff --git a/packages/backend/migration/1646549089451-poll-ended-notification.js b/packages/backend/migration/1646549089451-poll-ended-notification.js index 38a38ce64..cc96a62a7 100644 --- a/packages/backend/migration/1646549089451-poll-ended-notification.js +++ b/packages/backend/migration/1646549089451-poll-ended-notification.js @@ -1,18 +1,29 @@ - export class pollEndedNotification1646549089451 { - name = 'pollEndedNotification1646549089451' + name = "pollEndedNotification1646549089451"; - async up(queryRunner) { - await queryRunner.query(`ALTER TYPE "public"."notification_type_enum" RENAME TO "notification_type_enum_old"`); - await queryRunner.query(`CREATE TYPE "public"."notification_type_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`); - await queryRunner.query(`ALTER TABLE "notification" ALTER COLUMN "type" TYPE "public"."notification_type_enum" USING "type"::"text"::"public"."notification_type_enum"`); - await queryRunner.query(`DROP TYPE "public"."notification_type_enum_old"`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TYPE "public"."notification_type_enum" RENAME TO "notification_type_enum_old"`, + ); + await queryRunner.query( + `CREATE TYPE "public"."notification_type_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`, + ); + await queryRunner.query( + `ALTER TABLE "notification" ALTER COLUMN "type" TYPE "public"."notification_type_enum" USING "type"::"text"::"public"."notification_type_enum"`, + ); + await queryRunner.query(`DROP TYPE "public"."notification_type_enum_old"`); + } - async down(queryRunner) { - await queryRunner.query(`CREATE TYPE "public"."notification_type_enum_old" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`); - await queryRunner.query(`ALTER TABLE "notification" ALTER COLUMN "type" TYPE "public"."notification_type_enum_old" USING "type"::"text"::"public"."notification_type_enum_old"`); - await queryRunner.query(`DROP TYPE "public"."notification_type_enum"`); - await queryRunner.query(`ALTER TYPE "public"."notification_type_enum_old" RENAME TO "notification_type_enum"`); - } + async down(queryRunner) { + await queryRunner.query( + `CREATE TYPE "public"."notification_type_enum_old" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`, + ); + await queryRunner.query( + `ALTER TABLE "notification" ALTER COLUMN "type" TYPE "public"."notification_type_enum_old" USING "type"::"text"::"public"."notification_type_enum_old"`, + ); + await queryRunner.query(`DROP TYPE "public"."notification_type_enum"`); + await queryRunner.query( + `ALTER TYPE "public"."notification_type_enum_old" RENAME TO "notification_type_enum"`, + ); + } } diff --git a/packages/backend/migration/1646633030285-chart-federation-active.js b/packages/backend/migration/1646633030285-chart-federation-active.js index 952289c8f..3cb2dffe3 100644 --- a/packages/backend/migration/1646633030285-chart-federation-active.js +++ b/packages/backend/migration/1646633030285-chart-federation-active.js @@ -1,13 +1,21 @@ export class chartFederationActive1646633030285 { - name = 'chartFederationActive1646633030285' + name = "chartFederationActive1646633030285"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "___active" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "___active" smallint NOT NULL DEFAULT '0'`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD "___active" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ADD "___active" smallint NOT NULL DEFAULT '0'`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "___active"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "___active"`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" DROP COLUMN "___active"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP COLUMN "___active"`, + ); + } } diff --git a/packages/backend/migration/1646655454495-remove-instance-drive-columns.js b/packages/backend/migration/1646655454495-remove-instance-drive-columns.js index a0ee1b2c4..12f56bc2d 100644 --- a/packages/backend/migration/1646655454495-remove-instance-drive-columns.js +++ b/packages/backend/migration/1646655454495-remove-instance-drive-columns.js @@ -1,13 +1,17 @@ export class removeInstanceDriveColumns1646655454495 { - name = 'removeInstanceDriveColumns1646655454495' + name = "removeInstanceDriveColumns1646655454495"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "driveUsage"`); - await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "driveFiles"`); - } + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "driveUsage"`); + await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "driveFiles"`); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "instance" ADD "driveFiles" integer NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "instance" ADD "driveUsage" bigint NOT NULL DEFAULT '0'`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "instance" ADD "driveFiles" integer NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "instance" ADD "driveUsage" bigint NOT NULL DEFAULT '0'`, + ); + } } diff --git a/packages/backend/migration/1646732390560-chart-federation-active-sub-pub.js b/packages/backend/migration/1646732390560-chart-federation-active-sub-pub.js index c9a847cbc..e34b9a22e 100644 --- a/packages/backend/migration/1646732390560-chart-federation-active-sub-pub.js +++ b/packages/backend/migration/1646732390560-chart-federation-active-sub-pub.js @@ -1,21 +1,45 @@ export class chartFederationActiveSubPub1646732390560 { - name = 'chartFederationActiveSubPub1646732390560' + name = "chartFederationActiveSubPub1646732390560"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "___active"`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "___active"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "___subActive" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "___pubActive" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "___subActive" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "___pubActive" smallint NOT NULL DEFAULT '0'`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP COLUMN "___active"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" DROP COLUMN "___active"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD "___subActive" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD "___pubActive" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ADD "___subActive" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ADD "___pubActive" smallint NOT NULL DEFAULT '0'`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "___pubActive"`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "___subActive"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "___pubActive"`); - await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "___subActive"`); - await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "___active" smallint NOT NULL DEFAULT '0'`); - await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "___active" smallint NOT NULL DEFAULT '0'`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" DROP COLUMN "___pubActive"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" DROP COLUMN "___subActive"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP COLUMN "___pubActive"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" DROP COLUMN "___subActive"`, + ); + await queryRunner.query( + `ALTER TABLE "__chart_day__federation" ADD "___active" smallint NOT NULL DEFAULT '0'`, + ); + await queryRunner.query( + `ALTER TABLE "__chart__federation" ADD "___active" smallint NOT NULL DEFAULT '0'`, + ); + } } diff --git a/packages/backend/migration/1648548247382-webhook.js b/packages/backend/migration/1648548247382-webhook.js index aea369a5c..3e7160e2b 100644 --- a/packages/backend/migration/1648548247382-webhook.js +++ b/packages/backend/migration/1648548247382-webhook.js @@ -1,19 +1,37 @@ export class webhook1648548247382 { - name = 'webhook1648548247382' + name = "webhook1648548247382"; - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "webhook" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "name" character varying(128) NOT NULL, "on" character varying(128) array NOT NULL DEFAULT '{}', "url" character varying(1024) NOT NULL, "secret" character varying(1024) NOT NULL, "active" boolean NOT NULL DEFAULT true, CONSTRAINT "PK_e6765510c2d078db49632b59020" PRIMARY KEY ("id")); COMMENT ON COLUMN "webhook"."createdAt" IS 'The created date of the Antenna.'; COMMENT ON COLUMN "webhook"."userId" IS 'The owner ID.'; COMMENT ON COLUMN "webhook"."name" IS 'The name of the Antenna.'`); - await queryRunner.query(`CREATE INDEX "IDX_f272c8c8805969e6a6449c77b3" ON "webhook" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_8063a0586ed1dfbe86e982d961" ON "webhook" ("on") `); - await queryRunner.query(`CREATE INDEX "IDX_5a056076f76b2efe08216ba655" ON "webhook" ("active") `); - await queryRunner.query(`ALTER TABLE "webhook" ADD CONSTRAINT "FK_f272c8c8805969e6a6449c77b3c" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "webhook" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "name" character varying(128) NOT NULL, "on" character varying(128) array NOT NULL DEFAULT '{}', "url" character varying(1024) NOT NULL, "secret" character varying(1024) NOT NULL, "active" boolean NOT NULL DEFAULT true, CONSTRAINT "PK_e6765510c2d078db49632b59020" PRIMARY KEY ("id")); COMMENT ON COLUMN "webhook"."createdAt" IS 'The created date of the Antenna.'; COMMENT ON COLUMN "webhook"."userId" IS 'The owner ID.'; COMMENT ON COLUMN "webhook"."name" IS 'The name of the Antenna.'`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_f272c8c8805969e6a6449c77b3" ON "webhook" ("userId") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_8063a0586ed1dfbe86e982d961" ON "webhook" ("on") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_5a056076f76b2efe08216ba655" ON "webhook" ("active") `, + ); + await queryRunner.query( + `ALTER TABLE "webhook" ADD CONSTRAINT "FK_f272c8c8805969e6a6449c77b3c" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); } async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "webhook" DROP CONSTRAINT "FK_f272c8c8805969e6a6449c77b3c"`); - await queryRunner.query(`DROP INDEX "public"."IDX_5a056076f76b2efe08216ba655"`); - await queryRunner.query(`DROP INDEX "public"."IDX_8063a0586ed1dfbe86e982d961"`); - await queryRunner.query(`DROP INDEX "public"."IDX_f272c8c8805969e6a6449c77b3"`); - await queryRunner.query(`DROP TABLE "webhook"`); + await queryRunner.query( + `ALTER TABLE "webhook" DROP CONSTRAINT "FK_f272c8c8805969e6a6449c77b3c"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_5a056076f76b2efe08216ba655"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_8063a0586ed1dfbe86e982d961"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_f272c8c8805969e6a6449c77b3"`, + ); + await queryRunner.query(`DROP TABLE "webhook"`); } } diff --git a/packages/backend/migration/1648816172177-webhook-2.js b/packages/backend/migration/1648816172177-webhook-2.js index 2feb68d61..a4ab4ef8f 100644 --- a/packages/backend/migration/1648816172177-webhook-2.js +++ b/packages/backend/migration/1648816172177-webhook-2.js @@ -1,14 +1,15 @@ - export class webhook21648816172177 { - name = 'webhook21648816172177' + name = "webhook21648816172177"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "webhook" ADD "latestSentAt" TIMESTAMP WITH TIME ZONE`); - await queryRunner.query(`ALTER TABLE "webhook" ADD "latestStatus" integer`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "webhook" ADD "latestSentAt" TIMESTAMP WITH TIME ZONE`, + ); + await queryRunner.query(`ALTER TABLE "webhook" ADD "latestStatus" integer`); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "webhook" DROP COLUMN "latestStatus"`); - await queryRunner.query(`ALTER TABLE "webhook" DROP COLUMN "latestSentAt"`); - } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "webhook" DROP COLUMN "latestStatus"`); + await queryRunner.query(`ALTER TABLE "webhook" DROP COLUMN "latestSentAt"`); + } } diff --git a/packages/backend/migration/1651224615271-foreign-key.js b/packages/backend/migration/1651224615271-foreign-key.js index 535d21731..7e6bc7962 100644 --- a/packages/backend/migration/1651224615271-foreign-key.js +++ b/packages/backend/migration/1651224615271-foreign-key.js @@ -1,89 +1,187 @@ export class foreignKeyReports1651224615271 { - name = 'foreignKeyReports1651224615271' + name = "foreignKeyReports1651224615271"; - async up(queryRunner) { - await Promise.all([ - queryRunner.query(`ALTER INDEX "public"."IDX_seoignmeoprigmkpodgrjmkpormg" RENAME TO "IDX_c8cc87bd0f2f4487d17c651fbf"`), - queryRunner.query(`DROP INDEX "public"."IDX_note_on_channelId_and_id_desc"`), + async up(queryRunner) { + await Promise.all([ + queryRunner.query( + `ALTER INDEX "public"."IDX_seoignmeoprigmkpodgrjmkpormg" RENAME TO "IDX_c8cc87bd0f2f4487d17c651fbf"`, + ), + queryRunner.query( + `DROP INDEX "public"."IDX_note_on_channelId_and_id_desc"`, + ), - // remove unnecessary default null, see also down - queryRunner.query(`ALTER TABLE "user" ALTER COLUMN "followersUri" DROP DEFAULT`), - queryRunner.query(`ALTER TABLE "access_token" ALTER COLUMN "session" DROP DEFAULT`), - queryRunner.query(`ALTER TABLE "access_token" ALTER COLUMN "appId" DROP DEFAULT`), - queryRunner.query(`ALTER TABLE "access_token" ALTER COLUMN "name" DROP DEFAULT`), - queryRunner.query(`ALTER TABLE "access_token" ALTER COLUMN "description" DROP DEFAULT`), - queryRunner.query(`ALTER TABLE "access_token" ALTER COLUMN "iconUrl" DROP DEFAULT`), - queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "softwareName" DROP DEFAULT`), - queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "softwareVersion" DROP DEFAULT`), - queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "name" DROP DEFAULT`), - queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "description" DROP DEFAULT`), - queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "maintainerName" DROP DEFAULT`), - queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "maintainerEmail" DROP DEFAULT`), - queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "iconUrl" DROP DEFAULT`), - queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "faviconUrl" DROP DEFAULT`), - queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "themeColor" DROP DEFAULT`), - queryRunner.query(`ALTER TABLE "clip" ALTER COLUMN "description" DROP DEFAULT`), - queryRunner.query(`ALTER TABLE "note" ALTER COLUMN "channelId" DROP DEFAULT`), - queryRunner.query(`ALTER TABLE "abuse_user_report" ALTER COLUMN "comment" DROP DEFAULT`), + // remove unnecessary default null, see also down + queryRunner.query( + `ALTER TABLE "user" ALTER COLUMN "followersUri" DROP DEFAULT`, + ), + queryRunner.query( + `ALTER TABLE "access_token" ALTER COLUMN "session" DROP DEFAULT`, + ), + queryRunner.query( + `ALTER TABLE "access_token" ALTER COLUMN "appId" DROP DEFAULT`, + ), + queryRunner.query( + `ALTER TABLE "access_token" ALTER COLUMN "name" DROP DEFAULT`, + ), + queryRunner.query( + `ALTER TABLE "access_token" ALTER COLUMN "description" DROP DEFAULT`, + ), + queryRunner.query( + `ALTER TABLE "access_token" ALTER COLUMN "iconUrl" DROP DEFAULT`, + ), + queryRunner.query( + `ALTER TABLE "instance" ALTER COLUMN "softwareName" DROP DEFAULT`, + ), + queryRunner.query( + `ALTER TABLE "instance" ALTER COLUMN "softwareVersion" DROP DEFAULT`, + ), + queryRunner.query( + `ALTER TABLE "instance" ALTER COLUMN "name" DROP DEFAULT`, + ), + queryRunner.query( + `ALTER TABLE "instance" ALTER COLUMN "description" DROP DEFAULT`, + ), + queryRunner.query( + `ALTER TABLE "instance" ALTER COLUMN "maintainerName" DROP DEFAULT`, + ), + queryRunner.query( + `ALTER TABLE "instance" ALTER COLUMN "maintainerEmail" DROP DEFAULT`, + ), + queryRunner.query( + `ALTER TABLE "instance" ALTER COLUMN "iconUrl" DROP DEFAULT`, + ), + queryRunner.query( + `ALTER TABLE "instance" ALTER COLUMN "faviconUrl" DROP DEFAULT`, + ), + queryRunner.query( + `ALTER TABLE "instance" ALTER COLUMN "themeColor" DROP DEFAULT`, + ), + queryRunner.query( + `ALTER TABLE "clip" ALTER COLUMN "description" DROP DEFAULT`, + ), + queryRunner.query( + `ALTER TABLE "note" ALTER COLUMN "channelId" DROP DEFAULT`, + ), + queryRunner.query( + `ALTER TABLE "abuse_user_report" ALTER COLUMN "comment" DROP DEFAULT`, + ), - queryRunner.query(`CREATE INDEX "IDX_315c779174fe8247ab324f036e" ON "drive_file" ("isLink")`), - queryRunner.query(`CREATE INDEX "IDX_f22169eb10657bded6d875ac8f" ON "note" ("channelId")`), - //queryRunner.query(`CREATE INDEX "IDX_a9021cc2e1feb5f72d3db6e9f5" ON "abuse_user_report" ("targetUserId")`), + queryRunner.query( + `CREATE INDEX "IDX_315c779174fe8247ab324f036e" ON "drive_file" ("isLink")`, + ), + queryRunner.query( + `CREATE INDEX "IDX_f22169eb10657bded6d875ac8f" ON "note" ("channelId")`, + ), + //queryRunner.query(`CREATE INDEX "IDX_a9021cc2e1feb5f72d3db6e9f5" ON "abuse_user_report" ("targetUserId")`), - //queryRunner.query(`DELETE FROM "abuse_user_report" WHERE "targetUserId" NOT IN (SELECT "id" FROM "user")`).then(() => { - // queryRunner.query(`ALTER TABLE "abuse_user_report" ADD CONSTRAINT "FK_a9021cc2e1feb5f72d3db6e9f5f" FOREIGN KEY ("targetUserId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - //}), + //queryRunner.query(`DELETE FROM "abuse_user_report" WHERE "targetUserId" NOT IN (SELECT "id" FROM "user")`).then(() => { + // queryRunner.query(`ALTER TABLE "abuse_user_report" ADD CONSTRAINT "FK_a9021cc2e1feb5f72d3db6e9f5f" FOREIGN KEY ("targetUserId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); + //}), - queryRunner.query(`ALTER TABLE "poll" ADD CONSTRAINT "UQ_da851e06d0dfe2ef397d8b1bf1b" UNIQUE ("noteId")`), - queryRunner.query(`ALTER TABLE "user_keypair" ADD CONSTRAINT "UQ_f4853eb41ab722fe05f81cedeb6" UNIQUE ("userId")`), - queryRunner.query(`ALTER TABLE "user_profile" ADD CONSTRAINT "UQ_51cb79b5555effaf7d69ba1cff9" UNIQUE ("userId")`), - queryRunner.query(`ALTER TABLE "user_publickey" ADD CONSTRAINT "UQ_10c146e4b39b443ede016f6736d" UNIQUE ("userId")`), - queryRunner.query(`ALTER TABLE "promo_note" ADD CONSTRAINT "UQ_e263909ca4fe5d57f8d4230dd5c" UNIQUE ("noteId")`), + queryRunner.query( + `ALTER TABLE "poll" ADD CONSTRAINT "UQ_da851e06d0dfe2ef397d8b1bf1b" UNIQUE ("noteId")`, + ), + queryRunner.query( + `ALTER TABLE "user_keypair" ADD CONSTRAINT "UQ_f4853eb41ab722fe05f81cedeb6" UNIQUE ("userId")`, + ), + queryRunner.query( + `ALTER TABLE "user_profile" ADD CONSTRAINT "UQ_51cb79b5555effaf7d69ba1cff9" UNIQUE ("userId")`, + ), + queryRunner.query( + `ALTER TABLE "user_publickey" ADD CONSTRAINT "UQ_10c146e4b39b443ede016f6736d" UNIQUE ("userId")`, + ), + queryRunner.query( + `ALTER TABLE "promo_note" ADD CONSTRAINT "UQ_e263909ca4fe5d57f8d4230dd5c" UNIQUE ("noteId")`, + ), - queryRunner.query(`ALTER TABLE "page" RENAME CONSTRAINT "FK_3126dd7c502c9e4d7597ef7ef10" TO "FK_a9ca79ad939bf06066b81c9d3aa"`), + queryRunner.query( + `ALTER TABLE "page" RENAME CONSTRAINT "FK_3126dd7c502c9e4d7597ef7ef10" TO "FK_a9ca79ad939bf06066b81c9d3aa"`, + ), - queryRunner.query(`ALTER TYPE "public"."user_profile_mutingnotificationtypes_enum" ADD VALUE 'pollEnded' AFTER 'pollVote'`), - ]); - } + queryRunner.query( + `ALTER TYPE "public"."user_profile_mutingnotificationtypes_enum" ADD VALUE 'pollEnded' AFTER 'pollVote'`, + ), + ]); + } - async down(queryRunner) { - await Promise.all([ - // There is no ALTER TYPE REMOVE VALUE query, so the reverse operation is a bit more complex - queryRunner.query(`UPDATE "user_profile" SET "mutingNotificationTypes" = array_remove("mutingNotificationTypes", 'pollEnded')`) - .then(() => - queryRunner.query(`CREATE TYPE "public"."user_profile_mutingnotificationtypes_enum_old" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`) - ).then(() => - queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "mutingNotificationTypes" DROP DEFAULT`) - ).then(() => - queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "mutingNotificationTypes" TYPE "public"."user_profile_mutingnotificationtypes_enum_old"[] USING "mutingNotificationTypes"::"text"::"public"."user_profile_mutingnotificationtypes_enum_old"[]`) - ).then(() => - queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "mutingNotificationTypes" SET DEFAULT '{}'`) - ).then(() => - queryRunner.query(`DROP TYPE "public"."user_profile_mutingnotificationtypes_enum"`) - ).then(() => - queryRunner.query(`ALTER TYPE "public"."user_profile_mutingnotificationtypes_enum_old" RENAME TO "user_profile_mutingnotificationtypes_enum"`) - ), + async down(queryRunner) { + await Promise.all([ + // There is no ALTER TYPE REMOVE VALUE query, so the reverse operation is a bit more complex + queryRunner + .query( + `UPDATE "user_profile" SET "mutingNotificationTypes" = array_remove("mutingNotificationTypes", 'pollEnded')`, + ) + .then(() => + queryRunner.query( + `CREATE TYPE "public"."user_profile_mutingnotificationtypes_enum_old" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`, + ), + ) + .then(() => + queryRunner.query( + `ALTER TABLE "user_profile" ALTER COLUMN "mutingNotificationTypes" DROP DEFAULT`, + ), + ) + .then(() => + queryRunner.query( + `ALTER TABLE "user_profile" ALTER COLUMN "mutingNotificationTypes" TYPE "public"."user_profile_mutingnotificationtypes_enum_old"[] USING "mutingNotificationTypes"::"text"::"public"."user_profile_mutingnotificationtypes_enum_old"[]`, + ), + ) + .then(() => + queryRunner.query( + `ALTER TABLE "user_profile" ALTER COLUMN "mutingNotificationTypes" SET DEFAULT '{}'`, + ), + ) + .then(() => + queryRunner.query( + `DROP TYPE "public"."user_profile_mutingnotificationtypes_enum"`, + ), + ) + .then(() => + queryRunner.query( + `ALTER TYPE "public"."user_profile_mutingnotificationtypes_enum_old" RENAME TO "user_profile_mutingnotificationtypes_enum"`, + ), + ), - queryRunner.query(`ALTER TABLE "page" RENAME CONSTRAINT "FK_a9ca79ad939bf06066b81c9d3aa" TO "FK_3126dd7c502c9e4d7597ef7ef10"`), + queryRunner.query( + `ALTER TABLE "page" RENAME CONSTRAINT "FK_a9ca79ad939bf06066b81c9d3aa" TO "FK_3126dd7c502c9e4d7597ef7ef10"`, + ), - queryRunner.query(`ALTER TABLE "promo_note" DROP CONSTRAINT "UQ_e263909ca4fe5d57f8d4230dd5c"`), - queryRunner.query(`ALTER TABLE "user_publickey" DROP CONSTRAINT "UQ_10c146e4b39b443ede016f6736d"`), - queryRunner.query(`ALTER TABLE "user_profile" DROP CONSTRAINT "UQ_51cb79b5555effaf7d69ba1cff9"`), - queryRunner.query(`ALTER TABLE "user_keypair" DROP CONSTRAINT "UQ_f4853eb41ab722fe05f81cedeb6"`), - queryRunner.query(`ALTER TABLE "poll" DROP CONSTRAINT "UQ_da851e06d0dfe2ef397d8b1bf1b"`), + queryRunner.query( + `ALTER TABLE "promo_note" DROP CONSTRAINT "UQ_e263909ca4fe5d57f8d4230dd5c"`, + ), + queryRunner.query( + `ALTER TABLE "user_publickey" DROP CONSTRAINT "UQ_10c146e4b39b443ede016f6736d"`, + ), + queryRunner.query( + `ALTER TABLE "user_profile" DROP CONSTRAINT "UQ_51cb79b5555effaf7d69ba1cff9"`, + ), + queryRunner.query( + `ALTER TABLE "user_keypair" DROP CONSTRAINT "UQ_f4853eb41ab722fe05f81cedeb6"`, + ), + queryRunner.query( + `ALTER TABLE "poll" DROP CONSTRAINT "UQ_da851e06d0dfe2ef397d8b1bf1b"`, + ), - queryRunner.query(`ALTER TABLE "abuse_user_report" ALTER COLUMN "comment" SET DEFAULT '{}'`), - queryRunner.query(`ALTER TABLE "abuse_user_report" DROP CONSTRAINT "FK_a9021cc2e1feb5f72d3db6e9f5f"`), + queryRunner.query( + `ALTER TABLE "abuse_user_report" ALTER COLUMN "comment" SET DEFAULT '{}'`, + ), + queryRunner.query( + `ALTER TABLE "abuse_user_report" DROP CONSTRAINT "FK_a9021cc2e1feb5f72d3db6e9f5f"`, + ), - queryRunner.query(`DROP INDEX "public"."IDX_a9021cc2e1feb5f72d3db6e9f5"`), - queryRunner.query(`DROP INDEX "public"."IDX_f22169eb10657bded6d875ac8f"`), - queryRunner.query(`DROP INDEX "public"."IDX_315c779174fe8247ab324f036e"`), + queryRunner.query(`DROP INDEX "public"."IDX_a9021cc2e1feb5f72d3db6e9f5"`), + queryRunner.query(`DROP INDEX "public"."IDX_f22169eb10657bded6d875ac8f"`), + queryRunner.query(`DROP INDEX "public"."IDX_315c779174fe8247ab324f036e"`), - /* DEFAULT's are not set again because if the column can be NULL, then DEFAULT NULL is not necessary. + /* DEFAULT's are not set again because if the column can be NULL, then DEFAULT NULL is not necessary. see also https://github.com/typeorm/typeorm/issues/7579#issuecomment-835423615 */ - queryRunner.query(`CREATE INDEX "IDX_note_on_channelId_and_id_desc" ON "note" ("id", "channelId") `), - queryRunner.query(`ALTER INDEX "public"."IDX_c8cc87bd0f2f4487d17c651fbf" RENAME TO "IDX_seoignmeoprigmkpodgrjmkpormg"`), - ]); - } + queryRunner.query( + `CREATE INDEX "IDX_note_on_channelId_and_id_desc" ON "note" ("id", "channelId") `, + ), + queryRunner.query( + `ALTER INDEX "public"."IDX_c8cc87bd0f2f4487d17c651fbf" RENAME TO "IDX_seoignmeoprigmkpodgrjmkpormg"`, + ), + ]); + } } diff --git a/packages/backend/migration/1652859567549-uniform-themecolor.js b/packages/backend/migration/1652859567549-uniform-themecolor.js index 8da1fd7fb..8c91854d5 100644 --- a/packages/backend/migration/1652859567549-uniform-themecolor.js +++ b/packages/backend/migration/1652859567549-uniform-themecolor.js @@ -1,7 +1,7 @@ -import tinycolor from 'tinycolor2'; +import tinycolor from "tinycolor2"; export class uniformThemecolor1652859567549 { - name = 'uniformThemecolor1652859567549' + name = "uniformThemecolor1652859567549"; async up(queryRunner) { const formatColor = (color) => { @@ -13,20 +13,35 @@ export class uniformThemecolor1652859567549 { } }; - await queryRunner.query('SELECT "id", "themeColor" FROM "instance" WHERE "themeColor" IS NOT NULL') - .then(instances => Promise.all(instances.map(instance => { - // update theme color to uniform format, e.g. #00ff00 - // invalid theme colors get set to null - return queryRunner.query('UPDATE "instance" SET "themeColor" = $1 WHERE "id" = $2', [formatColor(instance.themeColor), instance.id]); - }))); + await queryRunner + .query( + 'SELECT "id", "themeColor" FROM "instance" WHERE "themeColor" IS NOT NULL', + ) + .then((instances) => + Promise.all( + instances.map((instance) => { + // update theme color to uniform format, e.g. #00ff00 + // invalid theme colors get set to null + return queryRunner.query( + 'UPDATE "instance" SET "themeColor" = $1 WHERE "id" = $2', + [formatColor(instance.themeColor), instance.id], + ); + }), + ), + ); // also fix own theme color - await queryRunner.query('SELECT "themeColor" FROM "meta" WHERE "themeColor" IS NOT NULL LIMIT 1') - .then(metas => { - if (metas.length > 0) { - return queryRunner.query('UPDATE "meta" SET "themeColor" = $1', [formatColor(metas[0].themeColor)]); - } - }); + await queryRunner + .query( + 'SELECT "themeColor" FROM "meta" WHERE "themeColor" IS NOT NULL LIMIT 1', + ) + .then((metas) => { + if (metas.length > 0) { + return queryRunner.query('UPDATE "meta" SET "themeColor" = $1', [ + formatColor(metas[0].themeColor), + ]); + } + }); } async down(queryRunner) { diff --git a/packages/backend/migration/1655368940105-nsfw-detection.js b/packages/backend/migration/1655368940105-nsfw-detection.js index 9268f4340..f1bcda50e 100644 --- a/packages/backend/migration/1655368940105-nsfw-detection.js +++ b/packages/backend/migration/1655368940105-nsfw-detection.js @@ -1,23 +1,51 @@ export class nsfwDetection1655368940105 { - name = 'nsfwDetection1655368940105' + name = "nsfwDetection1655368940105"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "drive_file" ADD "forceIsSensitive" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`ALTER TABLE "drive_file" ADD "predictedIsSensitive" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."predictedIsSensitive" IS 'Whether the DriveFile is NSFW. (predict)'`); - await queryRunner.query(`CREATE TYPE "public"."meta_sensitiveimagedetection_enum" AS ENUM('none', 'all', 'local', 'remote')`); - await queryRunner.query(`ALTER TABLE "meta" ADD "sensitiveImageDetection" "public"."meta_sensitiveimagedetection_enum" NOT NULL DEFAULT 'none'`); - await queryRunner.query(`ALTER TABLE "meta" ADD "forceIsSensitiveWhenPredicted" boolean NOT NULL DEFAULT true`); - await queryRunner.query(`CREATE INDEX "IDX_fc2d74a6d7d8b11292a851d8f8" ON "drive_file" ("predictedIsSensitive") `); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "drive_file" ADD "forceIsSensitive" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `ALTER TABLE "drive_file" ADD "predictedIsSensitive" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."predictedIsSensitive" IS 'Whether the DriveFile is NSFW. (predict)'`, + ); + await queryRunner.query( + `CREATE TYPE "public"."meta_sensitiveimagedetection_enum" AS ENUM('none', 'all', 'local', 'remote')`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "sensitiveImageDetection" "public"."meta_sensitiveimagedetection_enum" NOT NULL DEFAULT 'none'`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "forceIsSensitiveWhenPredicted" boolean NOT NULL DEFAULT true`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_fc2d74a6d7d8b11292a851d8f8" ON "drive_file" ("predictedIsSensitive") `, + ); + } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "public"."IDX_fc2d74a6d7d8b11292a851d8f8"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "forceIsSensitiveWhenPredicted"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "sensitiveImageDetection"`); - await queryRunner.query(`DROP TYPE "public"."meta_sensitiveimagedetection_enum"`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."predictedIsSensitive" IS 'Whether the DriveFile is NSFW. (predict)'`); - await queryRunner.query(`ALTER TABLE "drive_file" DROP COLUMN "predictedIsSensitive"`); - await queryRunner.query(`ALTER TABLE "drive_file" DROP COLUMN "forceIsSensitive"`); - } + async down(queryRunner) { + await queryRunner.query( + `DROP INDEX "public"."IDX_fc2d74a6d7d8b11292a851d8f8"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "forceIsSensitiveWhenPredicted"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "sensitiveImageDetection"`, + ); + await queryRunner.query( + `DROP TYPE "public"."meta_sensitiveimagedetection_enum"`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."predictedIsSensitive" IS 'Whether the DriveFile is NSFW. (predict)'`, + ); + await queryRunner.query( + `ALTER TABLE "drive_file" DROP COLUMN "predictedIsSensitive"`, + ); + await queryRunner.query( + `ALTER TABLE "drive_file" DROP COLUMN "forceIsSensitive"`, + ); + } } diff --git a/packages/backend/migration/1655371960534-nsfw-detection-2.js b/packages/backend/migration/1655371960534-nsfw-detection-2.js index aac6f37da..236cd7091 100644 --- a/packages/backend/migration/1655371960534-nsfw-detection-2.js +++ b/packages/backend/migration/1655371960534-nsfw-detection-2.js @@ -1,15 +1,27 @@ export class nsfwDetection21655371960534 { - name = 'nsfwDetection21655371960534' + name = "nsfwDetection21655371960534"; - async up(queryRunner) { - await queryRunner.query(`CREATE TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum" AS ENUM('medium', 'low', 'high')`); - await queryRunner.query(`ALTER TABLE "meta" ADD "sensitiveImageDetectionSensitivity" "public"."meta_sensitiveimagedetectionsensitivity_enum" NOT NULL DEFAULT 'medium'`); - await queryRunner.query(`ALTER TABLE "meta" ADD "disallowUploadWhenPredictedAsPorn" boolean NOT NULL DEFAULT false`); - } + async up(queryRunner) { + await queryRunner.query( + `CREATE TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum" AS ENUM('medium', 'low', 'high')`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "sensitiveImageDetectionSensitivity" "public"."meta_sensitiveimagedetectionsensitivity_enum" NOT NULL DEFAULT 'medium'`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "disallowUploadWhenPredictedAsPorn" boolean NOT NULL DEFAULT false`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "disallowUploadWhenPredictedAsPorn"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "sensitiveImageDetectionSensitivity"`); - await queryRunner.query(`DROP TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum"`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "disallowUploadWhenPredictedAsPorn"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "sensitiveImageDetectionSensitivity"`, + ); + await queryRunner.query( + `DROP TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum"`, + ); + } } diff --git a/packages/backend/migration/1655388169582-nsfw-detection-3.js b/packages/backend/migration/1655388169582-nsfw-detection-3.js index a5c80cf96..6a6ceeafb 100644 --- a/packages/backend/migration/1655388169582-nsfw-detection-3.js +++ b/packages/backend/migration/1655388169582-nsfw-detection-3.js @@ -1,21 +1,45 @@ export class nsfwDetection31655388169582 { - name = 'nsfwDetection31655388169582' + name = "nsfwDetection31655388169582"; - async up(queryRunner) { - await queryRunner.query(`ALTER TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum" RENAME TO "meta_sensitiveimagedetectionsensitivity_enum_old"`); - await queryRunner.query(`CREATE TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum" AS ENUM('medium', 'low', 'high', 'veryLow', 'veryHigh')`); - await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "sensitiveImageDetectionSensitivity" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "sensitiveImageDetectionSensitivity" TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum" USING "sensitiveImageDetectionSensitivity"::"text"::"public"."meta_sensitiveimagedetectionsensitivity_enum"`); - await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "sensitiveImageDetectionSensitivity" SET DEFAULT 'medium'`); - await queryRunner.query(`DROP TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum_old"`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum" RENAME TO "meta_sensitiveimagedetectionsensitivity_enum_old"`, + ); + await queryRunner.query( + `CREATE TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum" AS ENUM('medium', 'low', 'high', 'veryLow', 'veryHigh')`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ALTER COLUMN "sensitiveImageDetectionSensitivity" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ALTER COLUMN "sensitiveImageDetectionSensitivity" TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum" USING "sensitiveImageDetectionSensitivity"::"text"::"public"."meta_sensitiveimagedetectionsensitivity_enum"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ALTER COLUMN "sensitiveImageDetectionSensitivity" SET DEFAULT 'medium'`, + ); + await queryRunner.query( + `DROP TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum_old"`, + ); + } - async down(queryRunner) { - await queryRunner.query(`CREATE TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum_old" AS ENUM('medium', 'low', 'high')`); - await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "sensitiveImageDetectionSensitivity" DROP DEFAULT`); - await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "sensitiveImageDetectionSensitivity" TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum_old" USING "sensitiveImageDetectionSensitivity"::"text"::"public"."meta_sensitiveimagedetectionsensitivity_enum_old"`); - await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "sensitiveImageDetectionSensitivity" SET DEFAULT 'medium'`); - await queryRunner.query(`DROP TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum"`); - await queryRunner.query(`ALTER TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum_old" RENAME TO "meta_sensitiveimagedetectionsensitivity_enum"`); - } + async down(queryRunner) { + await queryRunner.query( + `CREATE TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum_old" AS ENUM('medium', 'low', 'high')`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ALTER COLUMN "sensitiveImageDetectionSensitivity" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ALTER COLUMN "sensitiveImageDetectionSensitivity" TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum_old" USING "sensitiveImageDetectionSensitivity"::"text"::"public"."meta_sensitiveimagedetectionsensitivity_enum_old"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ALTER COLUMN "sensitiveImageDetectionSensitivity" SET DEFAULT 'medium'`, + ); + await queryRunner.query( + `DROP TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum"`, + ); + await queryRunner.query( + `ALTER TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum_old" RENAME TO "meta_sensitiveimagedetectionsensitivity_enum"`, + ); + } } diff --git a/packages/backend/migration/1655393015659-nsfw-detection-4.js b/packages/backend/migration/1655393015659-nsfw-detection-4.js index e78073262..3e4589732 100644 --- a/packages/backend/migration/1655393015659-nsfw-detection-4.js +++ b/packages/backend/migration/1655393015659-nsfw-detection-4.js @@ -1,25 +1,57 @@ export class nsfwDetection41655393015659 { - name = 'nsfwDetection41655393015659' + name = "nsfwDetection41655393015659"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "sensitiveImageDetection"`); - await queryRunner.query(`DROP TYPE "public"."meta_sensitiveimagedetection_enum"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "sensitiveImageDetectionSensitivity"`); - await queryRunner.query(`DROP TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum"`); - await queryRunner.query(`CREATE TYPE "public"."meta_sensitivemediadetection_enum" AS ENUM('none', 'all', 'local', 'remote')`); - await queryRunner.query(`ALTER TABLE "meta" ADD "sensitiveMediaDetection" "public"."meta_sensitivemediadetection_enum" NOT NULL DEFAULT 'none'`); - await queryRunner.query(`CREATE TYPE "public"."meta_sensitivemediadetectionsensitivity_enum" AS ENUM('medium', 'low', 'high', 'veryLow', 'veryHigh')`); - await queryRunner.query(`ALTER TABLE "meta" ADD "sensitiveMediaDetectionSensitivity" "public"."meta_sensitivemediadetectionsensitivity_enum" NOT NULL DEFAULT 'medium'`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "sensitiveImageDetection"`, + ); + await queryRunner.query( + `DROP TYPE "public"."meta_sensitiveimagedetection_enum"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "sensitiveImageDetectionSensitivity"`, + ); + await queryRunner.query( + `DROP TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum"`, + ); + await queryRunner.query( + `CREATE TYPE "public"."meta_sensitivemediadetection_enum" AS ENUM('none', 'all', 'local', 'remote')`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "sensitiveMediaDetection" "public"."meta_sensitivemediadetection_enum" NOT NULL DEFAULT 'none'`, + ); + await queryRunner.query( + `CREATE TYPE "public"."meta_sensitivemediadetectionsensitivity_enum" AS ENUM('medium', 'low', 'high', 'veryLow', 'veryHigh')`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "sensitiveMediaDetectionSensitivity" "public"."meta_sensitivemediadetectionsensitivity_enum" NOT NULL DEFAULT 'medium'`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "sensitiveMediaDetectionSensitivity"`); - await queryRunner.query(`DROP TYPE "public"."meta_sensitivemediadetectionsensitivity_enum"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "sensitiveMediaDetection"`); - await queryRunner.query(`DROP TYPE "public"."meta_sensitivemediadetection_enum"`); - await queryRunner.query(`CREATE TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum" AS ENUM('medium', 'low', 'high', 'veryLow', 'veryHigh')`); - await queryRunner.query(`ALTER TABLE "meta" ADD "sensitiveImageDetectionSensitivity" "public"."meta_sensitiveimagedetectionsensitivity_enum" NOT NULL DEFAULT 'medium'`); - await queryRunner.query(`CREATE TYPE "public"."meta_sensitiveimagedetection_enum" AS ENUM('none', 'all', 'local', 'remote')`); - await queryRunner.query(`ALTER TABLE "meta" ADD "sensitiveImageDetection" "public"."meta_sensitiveimagedetection_enum" NOT NULL DEFAULT 'none'`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "sensitiveMediaDetectionSensitivity"`, + ); + await queryRunner.query( + `DROP TYPE "public"."meta_sensitivemediadetectionsensitivity_enum"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "sensitiveMediaDetection"`, + ); + await queryRunner.query( + `DROP TYPE "public"."meta_sensitivemediadetection_enum"`, + ); + await queryRunner.query( + `CREATE TYPE "public"."meta_sensitiveimagedetectionsensitivity_enum" AS ENUM('medium', 'low', 'high', 'veryLow', 'veryHigh')`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "sensitiveImageDetectionSensitivity" "public"."meta_sensitiveimagedetectionsensitivity_enum" NOT NULL DEFAULT 'medium'`, + ); + await queryRunner.query( + `CREATE TYPE "public"."meta_sensitiveimagedetection_enum" AS ENUM('none', 'all', 'local', 'remote')`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "sensitiveImageDetection" "public"."meta_sensitiveimagedetection_enum" NOT NULL DEFAULT 'none'`, + ); + } } diff --git a/packages/backend/migration/1655813815729-driveCapacityOverrideMb.js b/packages/backend/migration/1655813815729-driveCapacityOverrideMb.js index f257cd112..e43f0af5c 100644 --- a/packages/backend/migration/1655813815729-driveCapacityOverrideMb.js +++ b/packages/backend/migration/1655813815729-driveCapacityOverrideMb.js @@ -1,13 +1,21 @@ export class driveCapacityOverrideMb1655813815729 { - name = 'driveCapacityOverrideMb1655813815729' + name = "driveCapacityOverrideMb1655813815729"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user" ADD "driveCapacityOverrideMb" integer`); - await queryRunner.query(`COMMENT ON COLUMN "user"."driveCapacityOverrideMb" IS 'Overrides user drive capacity limit'`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user" ADD "driveCapacityOverrideMb" integer`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."driveCapacityOverrideMb" IS 'Overrides user drive capacity limit'`, + ); + } - async down(queryRunner) { - await queryRunner.query(`COMMENT ON COLUMN "user"."driveCapacityOverrideMb" IS 'Overrides user drive capacity limit'`); - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "driveCapacityOverrideMb"`); - } + async down(queryRunner) { + await queryRunner.query( + `COMMENT ON COLUMN "user"."driveCapacityOverrideMb" IS 'Overrides user drive capacity limit'`, + ); + await queryRunner.query( + `ALTER TABLE "user" DROP COLUMN "driveCapacityOverrideMb"`, + ); + } } diff --git a/packages/backend/migration/1655918165614-user-ip.js b/packages/backend/migration/1655918165614-user-ip.js index 2294fbaf1..2c5dc1c82 100644 --- a/packages/backend/migration/1655918165614-user-ip.js +++ b/packages/backend/migration/1655918165614-user-ip.js @@ -1,17 +1,31 @@ export class userIp1655918165614 { - name = 'userIp1655918165614' + name = "userIp1655918165614"; - async up(queryRunner) { - await queryRunner.query(`CREATE TABLE "user_ip" ("id" SERIAL NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "ip" character varying(128) NOT NULL, CONSTRAINT "PK_2c44ddfbf7c0464d028dcef325e" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_7f7f1c66f48e9a8e18a33bc515" ON "user_ip" ("userId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_361b500e06721013c124b7b6c5" ON "user_ip" ("userId", "ip") `); - await queryRunner.query(`ALTER TABLE "user_ip" ADD CONSTRAINT "FK_7f7f1c66f48e9a8e18a33bc5150" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`); - } + async up(queryRunner) { + await queryRunner.query( + `CREATE TABLE "user_ip" ("id" SERIAL NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "ip" character varying(128) NOT NULL, CONSTRAINT "PK_2c44ddfbf7c0464d028dcef325e" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_7f7f1c66f48e9a8e18a33bc515" ON "user_ip" ("userId") `, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_361b500e06721013c124b7b6c5" ON "user_ip" ("userId", "ip") `, + ); + await queryRunner.query( + `ALTER TABLE "user_ip" ADD CONSTRAINT "FK_7f7f1c66f48e9a8e18a33bc5150" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_ip" DROP CONSTRAINT "FK_7f7f1c66f48e9a8e18a33bc5150"`); - await queryRunner.query(`DROP INDEX "public"."IDX_361b500e06721013c124b7b6c5"`); - await queryRunner.query(`DROP INDEX "public"."IDX_7f7f1c66f48e9a8e18a33bc515"`); - await queryRunner.query(`DROP TABLE "user_ip"`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_ip" DROP CONSTRAINT "FK_7f7f1c66f48e9a8e18a33bc5150"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_361b500e06721013c124b7b6c5"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_7f7f1c66f48e9a8e18a33bc515"`, + ); + await queryRunner.query(`DROP TABLE "user_ip"`); + } } diff --git a/packages/backend/migration/1656122560740-file-ip.js b/packages/backend/migration/1656122560740-file-ip.js index b59e7a911..534097adb 100644 --- a/packages/backend/migration/1656122560740-file-ip.js +++ b/packages/backend/migration/1656122560740-file-ip.js @@ -1,13 +1,19 @@ export class fileIp1656122560740 { - name = 'fileIp1656122560740' + name = "fileIp1656122560740"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "drive_file" ADD "requestHeaders" jsonb DEFAULT '{}'`); - await queryRunner.query(`ALTER TABLE "drive_file" ADD "requestIp" character varying(128)`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "drive_file" ADD "requestHeaders" jsonb DEFAULT '{}'`, + ); + await queryRunner.query( + `ALTER TABLE "drive_file" ADD "requestIp" character varying(128)`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "drive_file" DROP COLUMN "requestIp"`); - await queryRunner.query(`ALTER TABLE "drive_file" DROP COLUMN "requestHeaders"`); - } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "drive_file" DROP COLUMN "requestIp"`); + await queryRunner.query( + `ALTER TABLE "drive_file" DROP COLUMN "requestHeaders"`, + ); + } } diff --git a/packages/backend/migration/1656251734807-nsfw-detection-5.js b/packages/backend/migration/1656251734807-nsfw-detection-5.js index 6f0c53690..7a2206e01 100644 --- a/packages/backend/migration/1656251734807-nsfw-detection-5.js +++ b/packages/backend/migration/1656251734807-nsfw-detection-5.js @@ -1,33 +1,79 @@ export class nsfwDetection51656251734807 { - name = 'nsfwDetection51656251734807' + name = "nsfwDetection51656251734807"; - async up(queryRunner) { - await queryRunner.query(`DROP INDEX "public"."IDX_fc2d74a6d7d8b11292a851d8f8"`); - await queryRunner.query(`ALTER TABLE "drive_file" DROP COLUMN "forceIsSensitive"`); - await queryRunner.query(`ALTER TABLE "drive_file" DROP COLUMN "predictedIsSensitive"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "forceIsSensitiveWhenPredicted"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "disallowUploadWhenPredictedAsPorn"`); - await queryRunner.query(`ALTER TABLE "drive_file" ADD "maybeSensitive" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."maybeSensitive" IS 'Whether the DriveFile is NSFW. (predict)'`); - await queryRunner.query(`ALTER TABLE "drive_file" ADD "maybePorn" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`ALTER TABLE "meta" ADD "setSensitiveFlagAutomatically" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`ALTER TABLE "user_profile" ADD "autoSensitive" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`CREATE INDEX "IDX_3b33dff77bb64b23c88151d23e" ON "drive_file" ("maybeSensitive") `); - await queryRunner.query(`CREATE INDEX "IDX_8bdcd3dd2bddb78014999a16ce" ON "drive_file" ("maybePorn") `); - } + async up(queryRunner) { + await queryRunner.query( + `DROP INDEX "public"."IDX_fc2d74a6d7d8b11292a851d8f8"`, + ); + await queryRunner.query( + `ALTER TABLE "drive_file" DROP COLUMN "forceIsSensitive"`, + ); + await queryRunner.query( + `ALTER TABLE "drive_file" DROP COLUMN "predictedIsSensitive"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "forceIsSensitiveWhenPredicted"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "disallowUploadWhenPredictedAsPorn"`, + ); + await queryRunner.query( + `ALTER TABLE "drive_file" ADD "maybeSensitive" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."maybeSensitive" IS 'Whether the DriveFile is NSFW. (predict)'`, + ); + await queryRunner.query( + `ALTER TABLE "drive_file" ADD "maybePorn" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "setSensitiveFlagAutomatically" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "autoSensitive" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_3b33dff77bb64b23c88151d23e" ON "drive_file" ("maybeSensitive") `, + ); + await queryRunner.query( + `CREATE INDEX "IDX_8bdcd3dd2bddb78014999a16ce" ON "drive_file" ("maybePorn") `, + ); + } - async down(queryRunner) { - await queryRunner.query(`DROP INDEX "public"."IDX_8bdcd3dd2bddb78014999a16ce"`); - await queryRunner.query(`DROP INDEX "public"."IDX_3b33dff77bb64b23c88151d23e"`); - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "autoSensitive"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "setSensitiveFlagAutomatically"`); - await queryRunner.query(`ALTER TABLE "drive_file" DROP COLUMN "maybePorn"`); - await queryRunner.query(`COMMENT ON COLUMN "drive_file"."maybeSensitive" IS 'Whether the DriveFile is NSFW. (predict)'`); - await queryRunner.query(`ALTER TABLE "drive_file" DROP COLUMN "maybeSensitive"`); - await queryRunner.query(`ALTER TABLE "meta" ADD "disallowUploadWhenPredictedAsPorn" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`ALTER TABLE "meta" ADD "forceIsSensitiveWhenPredicted" boolean NOT NULL DEFAULT true`); - await queryRunner.query(`ALTER TABLE "drive_file" ADD "predictedIsSensitive" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`ALTER TABLE "drive_file" ADD "forceIsSensitive" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`CREATE INDEX "IDX_fc2d74a6d7d8b11292a851d8f8" ON "drive_file" ("predictedIsSensitive") `); - } + async down(queryRunner) { + await queryRunner.query( + `DROP INDEX "public"."IDX_8bdcd3dd2bddb78014999a16ce"`, + ); + await queryRunner.query( + `DROP INDEX "public"."IDX_3b33dff77bb64b23c88151d23e"`, + ); + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "autoSensitive"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "setSensitiveFlagAutomatically"`, + ); + await queryRunner.query(`ALTER TABLE "drive_file" DROP COLUMN "maybePorn"`); + await queryRunner.query( + `COMMENT ON COLUMN "drive_file"."maybeSensitive" IS 'Whether the DriveFile is NSFW. (predict)'`, + ); + await queryRunner.query( + `ALTER TABLE "drive_file" DROP COLUMN "maybeSensitive"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "disallowUploadWhenPredictedAsPorn" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "forceIsSensitiveWhenPredicted" boolean NOT NULL DEFAULT true`, + ); + await queryRunner.query( + `ALTER TABLE "drive_file" ADD "predictedIsSensitive" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `ALTER TABLE "drive_file" ADD "forceIsSensitive" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `CREATE INDEX "IDX_fc2d74a6d7d8b11292a851d8f8" ON "drive_file" ("predictedIsSensitive") `, + ); + } } diff --git a/packages/backend/migration/1656328812281-ip-2.js b/packages/backend/migration/1656328812281-ip-2.js index b0ee1ebfc..ab4096e9c 100644 --- a/packages/backend/migration/1656328812281-ip-2.js +++ b/packages/backend/migration/1656328812281-ip-2.js @@ -1,13 +1,19 @@ export class ip21656328812281 { - name = 'ip21656328812281' + name = "ip21656328812281"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_ip" DROP CONSTRAINT "FK_7f7f1c66f48e9a8e18a33bc5150"`); - await queryRunner.query(`ALTER TABLE "meta" ADD "enableIpLogging" boolean NOT NULL DEFAULT false`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_ip" DROP CONSTRAINT "FK_7f7f1c66f48e9a8e18a33bc5150"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "enableIpLogging" boolean NOT NULL DEFAULT false`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "enableIpLogging"`); - await queryRunner.query(`ALTER TABLE "user_ip" ADD CONSTRAINT "FK_7f7f1c66f48e9a8e18a33bc5150" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`); - } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "enableIpLogging"`); + await queryRunner.query( + `ALTER TABLE "user_ip" ADD CONSTRAINT "FK_7f7f1c66f48e9a8e18a33bc5150" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + } } diff --git a/packages/backend/migration/1656408772602-nsfw-detection-6.js b/packages/backend/migration/1656408772602-nsfw-detection-6.js index 7ef223a4c..4ef237308 100644 --- a/packages/backend/migration/1656408772602-nsfw-detection-6.js +++ b/packages/backend/migration/1656408772602-nsfw-detection-6.js @@ -1,11 +1,15 @@ export class nsfwDetection61656408772602 { - name = 'nsfwDetection61656408772602' + name = "nsfwDetection61656408772602"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "enableSensitiveMediaDetectionForVideos" boolean NOT NULL DEFAULT false`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "enableSensitiveMediaDetectionForVideos" boolean NOT NULL DEFAULT false`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "enableSensitiveMediaDetectionForVideos"`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "enableSensitiveMediaDetectionForVideos"`, + ); + } } diff --git a/packages/backend/migration/1656772790599-user-moderation-note.js b/packages/backend/migration/1656772790599-user-moderation-note.js index 133bcffe1..11d3124ae 100644 --- a/packages/backend/migration/1656772790599-user-moderation-note.js +++ b/packages/backend/migration/1656772790599-user-moderation-note.js @@ -1,11 +1,15 @@ export class userModerationNote1656772790599 { - name = 'userModerationNote1656772790599' + name = "userModerationNote1656772790599"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" ADD "moderationNote" character varying(8192) NOT NULL DEFAULT ''`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" ADD "moderationNote" character varying(8192) NOT NULL DEFAULT ''`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "moderationNote"`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "user_profile" DROP COLUMN "moderationNote"`, + ); + } } diff --git a/packages/backend/migration/1657346559800-active-email-validation.js b/packages/backend/migration/1657346559800-active-email-validation.js index f8e03eeb0..4e3fd3f82 100644 --- a/packages/backend/migration/1657346559800-active-email-validation.js +++ b/packages/backend/migration/1657346559800-active-email-validation.js @@ -1,11 +1,15 @@ export class activeEmailValidation1657346559800 { - name = 'activeEmailValidation1657346559800' + name = "activeEmailValidation1657346559800"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "enableActiveEmailValidation" boolean NOT NULL DEFAULT true`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "enableActiveEmailValidation" boolean NOT NULL DEFAULT true`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "enableActiveEmailValidation"`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "enableActiveEmailValidation"`, + ); + } } diff --git a/packages/backend/migration/1658203170545calckey.js b/packages/backend/migration/1658203170545calckey.js index eb5913e81..95c3f05d3 100644 --- a/packages/backend/migration/1658203170545calckey.js +++ b/packages/backend/migration/1658203170545calckey.js @@ -1,15 +1,27 @@ export class calckey1658203170545 { - name = 'calckey1658203170545' + name = "calckey1658203170545"; - async up(queryRunner) { - await queryRunner.query(`UPDATE meta SET "useStarForReactionFallback" = TRUE;`); - await queryRunner.query(`UPDATE meta SET "repositoryUrl" = 'https://codeberg/calckey/calckey'`); - await queryRunner.query(`UPDATE meta SET "feedbackUrl" = 'https://codeberg/calckey/calckey/issues'`); - } + async up(queryRunner) { + await queryRunner.query( + `UPDATE meta SET "useStarForReactionFallback" = TRUE;`, + ); + await queryRunner.query( + `UPDATE meta SET "repositoryUrl" = 'https://codeberg/calckey/calckey'`, + ); + await queryRunner.query( + `UPDATE meta SET "feedbackUrl" = 'https://codeberg/calckey/calckey/issues'`, + ); + } - async down(queryRunner) { - await queryRunner.query(`UPDATE meta SET "useStarForReactionFallback" = FALSE;`); - await queryRunner.query(`UPDATE meta SET "repositoryUrl" = 'https://codeberg/calckey/calckey'`); - await queryRunner.query(`UPDATE meta SET "feedbackUrl" = 'https://codeberg/calckey/calckey/issues'`); - } + async down(queryRunner) { + await queryRunner.query( + `UPDATE meta SET "useStarForReactionFallback" = FALSE;`, + ); + await queryRunner.query( + `UPDATE meta SET "repositoryUrl" = 'https://codeberg/calckey/calckey'`, + ); + await queryRunner.query( + `UPDATE meta SET "feedbackUrl" = 'https://codeberg/calckey/calckey/issues'`, + ); + } } diff --git a/packages/backend/migration/1658656633972-note-replies-function.js b/packages/backend/migration/1658656633972-note-replies-function.js index de2e28c6f..810e23843 100644 --- a/packages/backend/migration/1658656633972-note-replies-function.js +++ b/packages/backend/migration/1658656633972-note-replies-function.js @@ -1,5 +1,5 @@ export class noteRepliesFunction1658656633972 { - name = 'noteRepliesFunction1658656633972' + name = "noteRepliesFunction1658656633972"; async up(queryRunner) { await queryRunner.query(` diff --git a/packages/backend/migration/1658939464003CustomMOTD.js b/packages/backend/migration/1658939464003CustomMOTD.js index eac03451d..ee1b182e5 100644 --- a/packages/backend/migration/1658939464003CustomMOTD.js +++ b/packages/backend/migration/1658939464003CustomMOTD.js @@ -1,8 +1,10 @@ export class CustomMOTD1658939464003 { - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "customMOTD" character varying(256) array NOT NULL DEFAULT '{}'::varchar[]`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "customMOTD"`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "customMOTD" character varying(256) array NOT NULL DEFAULT '{}'::varchar[]`, + ); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "customMOTD"`); + } } diff --git a/packages/backend/migration/1658941974648CustomSplashIcons.js b/packages/backend/migration/1658941974648CustomSplashIcons.js index fce5eb767..5c6a874d0 100644 --- a/packages/backend/migration/1658941974648CustomSplashIcons.js +++ b/packages/backend/migration/1658941974648CustomSplashIcons.js @@ -1,8 +1,12 @@ export class CustomSplashIcons1658941974648 { - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "customSplashIcons" character varying(256) array NOT NULL DEFAULT '{}'::varchar[]`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "customSplashIcons"`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "customSplashIcons" character varying(256) array NOT NULL DEFAULT '{}'::varchar[]`, + ); + } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "customSplashIcons"`, + ); + } } diff --git a/packages/backend/migration/1658981842728FixCalckey.js b/packages/backend/migration/1658981842728FixCalckey.js index 7d8750634..1a0305538 100644 --- a/packages/backend/migration/1658981842728FixCalckey.js +++ b/packages/backend/migration/1658981842728FixCalckey.js @@ -1,15 +1,27 @@ export class FixCalckey1658981842728 { - name = 'FixCalckey1658981842728' + name = "FixCalckey1658981842728"; - async up(queryRunner) { - await queryRunner.query(`UPDATE "meta" SET "useStarForReactionFallback" = TRUE;`); - await queryRunner.query(`UPDATE "meta" SET "repositoryUrl" = 'https://codeberg/calckey/calckey'`); - await queryRunner.query(`UPDATE "meta" SET "feedbackUrl" = 'https://codeberg/calckey/calckey/issues'`); + async up(queryRunner) { + await queryRunner.query( + `UPDATE "meta" SET "useStarForReactionFallback" = TRUE;`, + ); + await queryRunner.query( + `UPDATE "meta" SET "repositoryUrl" = 'https://codeberg/calckey/calckey'`, + ); + await queryRunner.query( + `UPDATE "meta" SET "feedbackUrl" = 'https://codeberg/calckey/calckey/issues'`, + ); } async down(queryRunner) { - await queryRunner.query(`UPDATE "meta" SET "useStarForReactionFallback" = FALSE;`); - await queryRunner.query(`UPDATE "meta" SET "repositoryUrl" = 'https://codeberg/calckey/calckey'`); - await queryRunner.query(`UPDATE "meta" SET "feedbackUrl" = 'https://codeberg/calckey/calckey/issues'`); + await queryRunner.query( + `UPDATE "meta" SET "useStarForReactionFallback" = FALSE;`, + ); + await queryRunner.query( + `UPDATE "meta" SET "repositoryUrl" = 'https://codeberg/calckey/calckey'`, + ); + await queryRunner.query( + `UPDATE "meta" SET "feedbackUrl" = 'https://codeberg/calckey/calckey/issues'`, + ); } } diff --git a/packages/backend/migration/1659042130648RecommendedTimeline.js b/packages/backend/migration/1659042130648RecommendedTimeline.js index 39c9b4163..01d28b2f3 100644 --- a/packages/backend/migration/1659042130648RecommendedTimeline.js +++ b/packages/backend/migration/1659042130648RecommendedTimeline.js @@ -1,11 +1,19 @@ export class RecommendedTimeline1659042130648 { - name = 'RecommendedTimeline1659042130648' - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "disableRecommendedTimeline" boolean NOT NULL DEFAULT true`); - await queryRunner.query(`ALTER TABLE "meta" ADD "recommendedInstances" character varying(256) array NOT NULL DEFAULT '{}'::varchar[]`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "disableRecommendedTimeline"`); - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "recommendedInstances"`); - } + name = "RecommendedTimeline1659042130648"; + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "disableRecommendedTimeline" boolean NOT NULL DEFAULT true`, + ); + await queryRunner.query( + `ALTER TABLE "meta" ADD "recommendedInstances" character varying(256) array NOT NULL DEFAULT '{}'::varchar[]`, + ); } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "disableRecommendedTimeline"`, + ); + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "recommendedInstances"`, + ); + } +} diff --git a/packages/backend/migration/1660068273737GuestTimeline.js b/packages/backend/migration/1660068273737GuestTimeline.js index 23d3bc51b..9a42f602d 100644 --- a/packages/backend/migration/1660068273737GuestTimeline.js +++ b/packages/backend/migration/1660068273737GuestTimeline.js @@ -1,9 +1,13 @@ export class GuestTimeline1660068273737 { - name = 'GuestTimeline1660068273737' - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "enableGuestTimeline" boolean NOT NULL DEFAULT false`); - } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "enableGuestTimeline"`); - } + name = "GuestTimeline1660068273737"; + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" ADD "enableGuestTimeline" boolean NOT NULL DEFAULT false`, + ); } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "meta" DROP COLUMN "enableGuestTimeline"`, + ); + } +} diff --git a/packages/backend/migration/1668828368510PageDraft.js b/packages/backend/migration/1668828368510PageDraft.js index 4a6818912..a5cc88b26 100644 --- a/packages/backend/migration/1668828368510PageDraft.js +++ b/packages/backend/migration/1668828368510PageDraft.js @@ -1,8 +1,10 @@ export class Page1668828368510 { async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "page" ADD "isPublic" boolean NOT NULL DEFAULT true`); + await queryRunner.query( + `ALTER TABLE "page" ADD "isPublic" boolean NOT NULL DEFAULT true`, + ); } async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "page" DROP COLUMN "isPublic"`); + await queryRunner.query(`ALTER TABLE "page" DROP COLUMN "isPublic"`); } } diff --git a/packages/backend/migration/1668831378728FixCalckeyAgain.js b/packages/backend/migration/1668831378728FixCalckeyAgain.js index d5e67a48c..c65dd54cd 100644 --- a/packages/backend/migration/1668831378728FixCalckeyAgain.js +++ b/packages/backend/migration/1668831378728FixCalckeyAgain.js @@ -1,11 +1,15 @@ export class FixCalckeyAgain1668831378728 { - name = 'FixCalckeyAgain1668831378728' + name = "FixCalckeyAgain1668831378728"; async up(queryRunner) { - await queryRunner.query(`UPDATE "meta" SET "useStarForReactionFallback" = TRUE`); + await queryRunner.query( + `UPDATE "meta" SET "useStarForReactionFallback" = TRUE`, + ); } async down(queryRunner) { - await queryRunner.query(`UPDATE "meta" SET "useStarForReactionFallback" = FALSE`); + await queryRunner.query( + `UPDATE "meta" SET "useStarForReactionFallback" = FALSE`, + ); } } diff --git a/packages/backend/migration/1669138716634-whetherPushNotifyToSendReadMessage.js b/packages/backend/migration/1669138716634-whetherPushNotifyToSendReadMessage.js index 2265b0061..101972a68 100644 --- a/packages/backend/migration/1669138716634-whetherPushNotifyToSendReadMessage.js +++ b/packages/backend/migration/1669138716634-whetherPushNotifyToSendReadMessage.js @@ -1,11 +1,15 @@ export class whetherPushNotifyToSendReadMessage1669138716634 { - name = 'whetherPushNotifyToSendReadMessage1669138716634' + name = "whetherPushNotifyToSendReadMessage1669138716634"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "sw_subscription" ADD "sendReadMessage" boolean NOT NULL DEFAULT false`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "sw_subscription" ADD "sendReadMessage" boolean NOT NULL DEFAULT false`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "sw_subscription" DROP COLUMN "sendReadMessage"`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "sw_subscription" DROP COLUMN "sendReadMessage"`, + ); + } } diff --git a/packages/backend/migration/1669288094000-AddMovedToAndKnownAs.js b/packages/backend/migration/1669288094000-AddMovedToAndKnownAs.js index 8b3c770ac..c34764e0b 100644 --- a/packages/backend/migration/1669288094000-AddMovedToAndKnownAs.js +++ b/packages/backend/migration/1669288094000-AddMovedToAndKnownAs.js @@ -1,16 +1,21 @@ export class addMovedToAndKnownAs1669288094000 { - name = 'addMovedToAndKnownAs1669288094000' + name = "addMovedToAndKnownAs1669288094000"; async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user" ADD "movedToUri" character varying(512)`); - await queryRunner.query(`ALTER TABLE "user" ADD "alsoKnownAs" TEXT`); - await queryRunner.query(`COMMENT ON COLUMN "user"."movedToUri" IS 'The URI of the new account of the User'`); - await queryRunner.query(`COMMENT ON COLUMN "user"."alsoKnownAs" IS 'URIs the user is known as too'`); + await queryRunner.query( + `ALTER TABLE "user" ADD "movedToUri" character varying(512)`, + ); + await queryRunner.query(`ALTER TABLE "user" ADD "alsoKnownAs" TEXT`); + await queryRunner.query( + `COMMENT ON COLUMN "user"."movedToUri" IS 'The URI of the new account of the User'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "user"."alsoKnownAs" IS 'URIs the user is known as too'`, + ); } async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "movedToUri"`); - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "alsoKnownAs"`); + await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "movedToUri"`); + await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "alsoKnownAs"`); } - } diff --git a/packages/backend/migration/1671199573000-AddFkAbuseUserReportTargetUserIdToUserId.js b/packages/backend/migration/1671199573000-AddFkAbuseUserReportTargetUserIdToUserId.js index 68f560b47..96ed8e1d6 100644 --- a/packages/backend/migration/1671199573000-AddFkAbuseUserReportTargetUserIdToUserId.js +++ b/packages/backend/migration/1671199573000-AddFkAbuseUserReportTargetUserIdToUserId.js @@ -1,12 +1,18 @@ export class addFkAbuseUserReportTargetUserIdToUserId1671199573000 { - name = 'addFkAbuseUserReportTargetUserIdToUserId1671199573000' + name = "addFkAbuseUserReportTargetUserIdToUserId1671199573000"; async up(queryRunner) { - await queryRunner.query(`DELETE FROM abuse_user_report WHERE NOT EXISTS (SELECT 1 FROM "user" WHERE "user"."id" = "abuse_user_report"."targetUserId")`); - await queryRunner.query(`ALTER TABLE abuse_user_report ADD CONSTRAINT fk_7f4e851a35d81b64dda28eee0 FOREIGN KEY ("targetUserId") REFERENCES "user"("id") ON DELETE CASCADE`); + await queryRunner.query( + `DELETE FROM abuse_user_report WHERE NOT EXISTS (SELECT 1 FROM "user" WHERE "user"."id" = "abuse_user_report"."targetUserId")`, + ); + await queryRunner.query( + `ALTER TABLE abuse_user_report ADD CONSTRAINT fk_7f4e851a35d81b64dda28eee0 FOREIGN KEY ("targetUserId") REFERENCES "user"("id") ON DELETE CASCADE`, + ); } async down(queryRunner) { - await queryRunner.query(`ALTER TABLE abuse_user_report DROP CONSTRAINT fk_7f4e851a35d81b64dda28eee0`); + await queryRunner.query( + `ALTER TABLE abuse_user_report DROP CONSTRAINT fk_7f4e851a35d81b64dda28eee0`, + ); } } diff --git a/packages/backend/migration/1671388343000-CalckeyRepoMove.js b/packages/backend/migration/1671388343000-CalckeyRepoMove.js index df933bcb9..60550f044 100644 --- a/packages/backend/migration/1671388343000-CalckeyRepoMove.js +++ b/packages/backend/migration/1671388343000-CalckeyRepoMove.js @@ -1,15 +1,23 @@ /* "CalckeyRepoMove1671388343000" is a class that updates the "useStarForReactionFallback" column in the "meta" table to TRUE */ export class CalckeyRepoMove1671388343000 { - name = 'CalckeyRepoMove1671388343000' + name = "CalckeyRepoMove1671388343000"; async up(queryRunner) { - await queryRunner.query(`UPDATE meta SET "repositoryUrl" = 'https://codeberg/calckey/calckey'`); - await queryRunner.query(`UPDATE meta SET "feedbackUrl" = 'https://codeberg/calckey/calckey/issues'`); + await queryRunner.query( + `UPDATE meta SET "repositoryUrl" = 'https://codeberg/calckey/calckey'`, + ); + await queryRunner.query( + `UPDATE meta SET "feedbackUrl" = 'https://codeberg/calckey/calckey/issues'`, + ); } async down(queryRunner) { - await queryRunner.query(`UPDATE meta SET "repositoryUrl" = 'https://codeberg/calckey/calckey'`); - await queryRunner.query(`UPDATE meta SET "feedbackUrl" = 'https://codeberg/calckey/calckey/issues'`); + await queryRunner.query( + `UPDATE meta SET "repositoryUrl" = 'https://codeberg/calckey/calckey'`, + ); + await queryRunner.query( + `UPDATE meta SET "feedbackUrl" = 'https://codeberg/calckey/calckey/issues'`, + ); } } diff --git a/packages/backend/migration/1672882664294-DefaultReaction.js b/packages/backend/migration/1672882664294-DefaultReaction.js index 498a1810d..6ce1146ec 100644 --- a/packages/backend/migration/1672882664294-DefaultReaction.js +++ b/packages/backend/migration/1672882664294-DefaultReaction.js @@ -1,9 +1,13 @@ export class DefaultReaction1672882664294 { - name = 'DefaultReaction1672882664294' + name = "DefaultReaction1672882664294"; async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "defaultReaction" character varying(256) NOT NULL DEFAULT '⭐'`); - await queryRunner.query(`COMMENT ON COLUMN "meta"."defaultReaction" IS 'The fallback reaction for emoji reacts'`); + await queryRunner.query( + `ALTER TABLE "meta" ADD "defaultReaction" character varying(256) NOT NULL DEFAULT '⭐'`, + ); + await queryRunner.query( + `COMMENT ON COLUMN "meta"."defaultReaction" IS 'The fallback reaction for emoji reacts'`, + ); } async down(queryRunner) { diff --git a/packages/backend/migration/1673336077243-PollChoiceLength.js b/packages/backend/migration/1673336077243-PollChoiceLength.js index 13db7dd96..a0e335016 100644 --- a/packages/backend/migration/1673336077243-PollChoiceLength.js +++ b/packages/backend/migration/1673336077243-PollChoiceLength.js @@ -1,11 +1,15 @@ export class PollChoiceLength1673336077243 { - name = 'PollChoiceLength1673336077243' + name = "PollChoiceLength1673336077243"; async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "poll" ALTER COLUMN "choices" TYPE character varying(256) array`); + await queryRunner.query( + `ALTER TABLE "poll" ALTER COLUMN "choices" TYPE character varying(256) array`, + ); } async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "poll" ALTER COLUMN "choices" TYPE character varying(128) array`); + await queryRunner.query( + `ALTER TABLE "poll" ALTER COLUMN "choices" TYPE character varying(128) array`, + ); } } diff --git a/packages/backend/migration/1676093997212-AntennaInstances.js b/packages/backend/migration/1676093997212-AntennaInstances.js index 7553e1255..ffd428f7d 100644 --- a/packages/backend/migration/1676093997212-AntennaInstances.js +++ b/packages/backend/migration/1676093997212-AntennaInstances.js @@ -1,17 +1,27 @@ export class AntennaInstances1676093997212 { - name = 'AntennaInstances1676093997212' + name = "AntennaInstances1676093997212"; - async up(queryRunner) { - await queryRunner.query(`ALTER TYPE "antenna_src_enum" ADD VALUE 'instances'`); - await queryRunner.query(`ALTER TABLE "antenna" ADD "instances" jsonb NOT NULL DEFAULT '[]'`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TYPE "antenna_src_enum" ADD VALUE 'instances'`, + ); + await queryRunner.query( + `ALTER TABLE "antenna" ADD "instances" jsonb NOT NULL DEFAULT '[]'`, + ); + } - async down(queryRunner) { - await queryRunner.query(`DELETE FROM "antenna" WHERE "src" = 'instances'`); - await queryRunner.query(`ALTER TABLE "antenna" DROP COLUMN "instances"`); - await queryRunner.query(`CREATE TYPE "public"."antenna_src_enum_old" AS ENUM('home', 'all', 'users', 'list', 'group')`); - await queryRunner.query(`ALTER TABLE "antenna" ALTER COLUMN "src" TYPE "public"."antenna_src_enum_old" USING "src"::"text"::"public"."antenna_src_enum_old"`); - await queryRunner.query(`DROP TYPE "public"."antenna_src_enum"`); - await queryRunner.query(`ALTER TYPE "public"."antenna_src_enum_old" RENAME TO "antenna_src_enum"`); - } + async down(queryRunner) { + await queryRunner.query(`DELETE FROM "antenna" WHERE "src" = 'instances'`); + await queryRunner.query(`ALTER TABLE "antenna" DROP COLUMN "instances"`); + await queryRunner.query( + `CREATE TYPE "public"."antenna_src_enum_old" AS ENUM('home', 'all', 'users', 'list', 'group')`, + ); + await queryRunner.query( + `ALTER TABLE "antenna" ALTER COLUMN "src" TYPE "public"."antenna_src_enum_old" USING "src"::"text"::"public"."antenna_src_enum_old"`, + ); + await queryRunner.query(`DROP TYPE "public"."antenna_src_enum"`); + await queryRunner.query( + `ALTER TYPE "public"."antenna_src_enum_old" RENAME TO "antenna_src_enum"`, + ); + } } diff --git a/packages/backend/migration/1677935903517-DriveComment.js b/packages/backend/migration/1677935903517-DriveComment.js index 41c7556f0..571958f29 100644 --- a/packages/backend/migration/1677935903517-DriveComment.js +++ b/packages/backend/migration/1677935903517-DriveComment.js @@ -1,11 +1,15 @@ export class DriveComment1677935903517 { - name = 'DriveComment1677935903517' + name = "DriveComment1677935903517"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "drive_file" ALTER "comment" TYPE character varying(8192)`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "drive_file" ALTER "comment" TYPE character varying(8192)`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "drive_file" ALTER "comment" TYPE character varying(512)`); - } + async down(queryRunner) { + await queryRunner.query( + `ALTER TABLE "drive_file" ALTER "comment" TYPE character varying(512)`, + ); + } } diff --git a/packages/backend/migration/1678945242650-add-props-for-custom-emoji.js b/packages/backend/migration/1678945242650-add-props-for-custom-emoji.js index 656a92177..f3de7ce27 100644 --- a/packages/backend/migration/1678945242650-add-props-for-custom-emoji.js +++ b/packages/backend/migration/1678945242650-add-props-for-custom-emoji.js @@ -1,11 +1,13 @@ export class addPropsForCustomEmoji1678945242650 { - name = 'addPropsForCustomEmoji1678945242650' + name = "addPropsForCustomEmoji1678945242650"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "emoji" ADD "license" character varying(1024)`); - } + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "emoji" ADD "license" character varying(1024)`, + ); + } - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "emoji" DROP COLUMN "license"`); - } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "emoji" DROP COLUMN "license"`); + } } diff --git a/packages/backend/migration/1679269929000-fix-repo.js b/packages/backend/migration/1679269929000-fix-repo.js index 6784b3793..3571da4f5 100644 --- a/packages/backend/migration/1679269929000-fix-repo.js +++ b/packages/backend/migration/1679269929000-fix-repo.js @@ -1,13 +1,21 @@ export class FixRepo1679269929000 { - name = 'FixRepo1679269929000' + name = "FixRepo1679269929000"; async up(queryRunner) { - await queryRunner.query(`UPDATE meta SET "repositoryUrl" = 'https://codeberg.org/calckey/calckey'`); - await queryRunner.query(`UPDATE meta SET "feedbackUrl" = 'https://codeberg.org/calckey/calckey/issues'`); + await queryRunner.query( + `UPDATE meta SET "repositoryUrl" = 'https://codeberg.org/calckey/calckey'`, + ); + await queryRunner.query( + `UPDATE meta SET "feedbackUrl" = 'https://codeberg.org/calckey/calckey/issues'`, + ); } async down(queryRunner) { - await queryRunner.query(`UPDATE meta SET "repositoryUrl" = 'https://codeberg.org/calckey/calckey'`); - await queryRunner.query(`UPDATE meta SET "feedbackUrl" = 'https://codeberg.org/calckey/calckey/issues'`); + await queryRunner.query( + `UPDATE meta SET "repositoryUrl" = 'https://codeberg.org/calckey/calckey'`, + ); + await queryRunner.query( + `UPDATE meta SET "feedbackUrl" = 'https://codeberg.org/calckey/calckey/issues'`, + ); } } diff --git a/packages/backend/migration/1680375641101-clean-charts.js b/packages/backend/migration/1680375641101-clean-charts.js index c125f43a3..bfb8aa9d9 100644 --- a/packages/backend/migration/1680375641101-clean-charts.js +++ b/packages/backend/migration/1680375641101-clean-charts.js @@ -1,17 +1,25 @@ export class CleanCharts1680375641101 { - constructor() { - this.name = 'CleanCharts1680375641101'; - } - async up(queryRunner) { - await queryRunner.query(`delete from __chart__hashtag where ___local_users = 0 and ___remote_users = 0;`); - await queryRunner.query(`delete from __chart_day__hashtag where ___local_users = 0 and ___remote_users = 0;`); - await queryRunner.query(`COMMIT;`); - await queryRunner.query(`vacuum __chart__hashtag;`); - await queryRunner.query(`vacuum __chart_day__hashtag;`); - await queryRunner.query(`COMMIT;`); - } - async down(queryRunner) { - await queryRunner.query(`delete from __chart__hashtag where ___local_users = 0 and ___remote_users = 0;`); - await queryRunner.query(`delete from __chart_day__hashtag where ___local_users = 0 and ___remote_users = 0;`); - } + constructor() { + this.name = "CleanCharts1680375641101"; + } + async up(queryRunner) { + await queryRunner.query( + `delete from __chart__hashtag where ___local_users = 0 and ___remote_users = 0;`, + ); + await queryRunner.query( + `delete from __chart_day__hashtag where ___local_users = 0 and ___remote_users = 0;`, + ); + await queryRunner.query(`COMMIT;`); + await queryRunner.query(`vacuum __chart__hashtag;`); + await queryRunner.query(`vacuum __chart_day__hashtag;`); + await queryRunner.query(`COMMIT;`); + } + async down(queryRunner) { + await queryRunner.query( + `delete from __chart__hashtag where ___local_users = 0 and ___remote_users = 0;`, + ); + await queryRunner.query( + `delete from __chart_day__hashtag where ___local_users = 0 and ___remote_users = 0;`, + ); + } } diff --git a/packages/backend/migration/1680426269172-SpeakAsCat.js b/packages/backend/migration/1680426269172-SpeakAsCat.js index 3655e2726..375098542 100644 --- a/packages/backend/migration/1680426269172-SpeakAsCat.js +++ b/packages/backend/migration/1680426269172-SpeakAsCat.js @@ -1,20 +1,20 @@ export class SpeakAsCat1680426269172 { - name = 'SpeakAsCat1680426269172' + name = "SpeakAsCat1680426269172"; - async up(queryRunner) { - await queryRunner.query(` + async up(queryRunner) { + await queryRunner.query(` ALTER TABLE "user" ADD "speakAsCat" boolean NOT NULL DEFAULT true `); - await queryRunner.query(` + await queryRunner.query(` COMMENT ON COLUMN "user"."speakAsCat" IS 'Whether to speak as a cat if isCat.' `); - } + } - async down(queryRunner) { - await queryRunner.query(` + async down(queryRunner) { + await queryRunner.query(` ALTER TABLE "user" DROP COLUMN "speakAsCat" `); - } + } } diff --git a/packages/backend/native-utils/__test__/index.spec.mjs b/packages/backend/native-utils/__test__/index.spec.mjs index 1ade4cafe..0d41e012d 100644 --- a/packages/backend/native-utils/__test__/index.spec.mjs +++ b/packages/backend/native-utils/__test__/index.spec.mjs @@ -1,7 +1,7 @@ -import test from 'ava' +import test from "ava"; -import { sum } from '../index.js' +import { sum } from "../index.js"; -test('sum from native', (t) => { - t.is(sum(1, 2), 3) -}) +test("sum from native", (t) => { + t.is(sum(1, 2), 3); +}); diff --git a/packages/backend/ormconfig.js b/packages/backend/ormconfig.js index a4e903aba..5f85cead8 100644 --- a/packages/backend/ormconfig.js +++ b/packages/backend/ormconfig.js @@ -1,9 +1,9 @@ -import { DataSource } from 'typeorm'; -import config from './built/config/index.js'; -import { entities } from './built/db/postgre.js'; +import { DataSource } from "typeorm"; +import config from "./built/config/index.js"; +import { entities } from "./built/db/postgre.js"; export default new DataSource({ - type: 'postgres', + type: "postgres", host: config.db.host, port: config.db.port, username: config.db.user, @@ -11,5 +11,5 @@ export default new DataSource({ database: config.db.db, extra: config.db.extra, entities: entities, - migrations: ['migration/*.js'], + migrations: ["migration/*.js"], }); diff --git a/packages/backend/src/server/api/endpoints.ts b/packages/backend/src/server/api/endpoints.ts index 57a3ce4dc..3bedd1af3 100644 --- a/packages/backend/src/server/api/endpoints.ts +++ b/packages/backend/src/server/api/endpoints.ts @@ -290,8 +290,8 @@ import * as ep___resetDb from "./endpoints/reset-db.js"; import * as ep___resetPassword from "./endpoints/reset-password.js"; import * as ep___serverInfo from "./endpoints/server-info.js"; import * as ep___stats from "./endpoints/stats.js"; -import * as ep___sw_show_registration from './endpoints/sw/show-registration.js'; -import * as ep___sw_update_registration from './endpoints/sw/update-registration.js'; +import * as ep___sw_show_registration from "./endpoints/sw/show-registration.js"; +import * as ep___sw_update_registration from "./endpoints/sw/update-registration.js"; import * as ep___sw_register from "./endpoints/sw/register.js"; import * as ep___sw_unregister from "./endpoints/sw/unregister.js"; import * as ep___test from "./endpoints/test.js"; @@ -639,8 +639,8 @@ const eps = [ ["stats", ep___stats], ["sw/register", ep___sw_register], ["sw/unregister", ep___sw_unregister], - ['sw/show-registration', ep___sw_show_registration], - ['sw/update-registration', ep___sw_update_registration], + ["sw/show-registration", ep___sw_show_registration], + ["sw/update-registration", ep___sw_update_registration], ["test", ep___test], ["username/available", ep___username_available], ["users", ep___users], diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index d3a39acd2..f7e79b64b 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -209,11 +209,11 @@ export default define(meta, paramDef, async (ps, me) => { } if (Array.isArray(ps.blockedHosts)) { - let lastValue = ''; - set.blockedHosts = ps.blockedHosts.sort().filter(h => { + let lastValue = ""; + set.blockedHosts = ps.blockedHosts.sort().filter((h) => { const lv = lastValue; lastValue = h; - return h !== '' && h !== lv; + return h !== "" && h !== lv; }); } diff --git a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts index 584a6ce02..a7aaf9b8f 100644 --- a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts @@ -98,7 +98,7 @@ export default define(meta, paramDef, async (ps, user) => { activeUsersChart.read(user); } }); - + // We fetch more than requested because some may be filtered out, and if there's less than // requested, the pagination stops. const found = []; @@ -106,7 +106,7 @@ export default define(meta, paramDef, async (ps, user) => { let skip = 0; while (found.length < ps.limit) { const notes = await query.take(take).skip(skip).getMany(); - found.push(...await Notes.packMany(notes, user)) + found.push(...(await Notes.packMany(notes, user))); skip += take; if (notes.length < take) break; } diff --git a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts index 78846861a..af9f670d9 100644 --- a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts @@ -162,7 +162,7 @@ export default define(meta, paramDef, async (ps, user) => { let skip = 0; while (found.length < ps.limit) { const notes = await query.take(take).skip(skip).getMany(); - found.push(...await Notes.packMany(notes, user)) + found.push(...(await Notes.packMany(notes, user))); skip += take; if (notes.length < take) break; } diff --git a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts index fead87738..e1e8a9ae2 100644 --- a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts @@ -136,7 +136,7 @@ export default define(meta, paramDef, async (ps, user) => { let skip = 0; while (found.length < ps.limit) { const notes = await query.take(take).skip(skip).getMany(); - found.push(...await Notes.packMany(notes, user)) + found.push(...(await Notes.packMany(notes, user))); skip += take; if (notes.length < take) break; } diff --git a/packages/backend/src/server/api/endpoints/notes/mentions.ts b/packages/backend/src/server/api/endpoints/notes/mentions.ts index 7ffe83e5c..68688b504 100644 --- a/packages/backend/src/server/api/endpoints/notes/mentions.ts +++ b/packages/backend/src/server/api/endpoints/notes/mentions.ts @@ -86,7 +86,6 @@ export default define(meta, paramDef, async (ps, user) => { query.setParameters(followingQuery.getParameters()); } - // We fetch more than requested because some may be filtered out, and if there's less than // requested, the pagination stops. const found = []; @@ -94,7 +93,7 @@ export default define(meta, paramDef, async (ps, user) => { let skip = 0; while (found.length < ps.limit) { const notes = await query.take(take).skip(skip).getMany(); - found.push(...await Notes.packMany(notes, user)) + found.push(...(await Notes.packMany(notes, user))); skip += take; if (notes.length < take) break; } diff --git a/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts b/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts index c73114de6..e009233c4 100644 --- a/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts @@ -139,7 +139,7 @@ export default define(meta, paramDef, async (ps, user) => { let skip = 0; while (found.length < ps.limit) { const notes = await query.take(take).skip(skip).getMany(); - found.push(...await Notes.packMany(notes, user)) + found.push(...(await Notes.packMany(notes, user))); skip += take; if (notes.length < take) break; } diff --git a/packages/backend/src/server/api/endpoints/notes/renotes.ts b/packages/backend/src/server/api/endpoints/notes/renotes.ts index 60d398088..f313616be 100644 --- a/packages/backend/src/server/api/endpoints/notes/renotes.ts +++ b/packages/backend/src/server/api/endpoints/notes/renotes.ts @@ -81,7 +81,7 @@ export default define(meta, paramDef, async (ps, user) => { let skip = 0; while (found.length < ps.limit) { const notes = await query.take(take).skip(skip).getMany(); - found.push(...await Notes.packMany(notes, user)) + found.push(...(await Notes.packMany(notes, user))); skip += take; if (notes.length < take) break; } diff --git a/packages/backend/src/server/api/endpoints/notes/replies.ts b/packages/backend/src/server/api/endpoints/notes/replies.ts index 94a752a64..5ea4d479c 100644 --- a/packages/backend/src/server/api/endpoints/notes/replies.ts +++ b/packages/backend/src/server/api/endpoints/notes/replies.ts @@ -65,7 +65,7 @@ export default define(meta, paramDef, async (ps, user) => { let skip = 0; while (found.length < ps.limit) { const notes = await query.take(take).skip(skip).getMany(); - found.push(...await Notes.packMany(notes, user)) + found.push(...(await Notes.packMany(notes, user))); skip += take; if (notes.length < take) break; } diff --git a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts index f1cae78ba..f988acaa5 100644 --- a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts +++ b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts @@ -152,7 +152,7 @@ export default define(meta, paramDef, async (ps, me) => { let skip = 0; while (found.length < ps.limit) { const notes = await query.take(take).skip(skip).getMany(); - found.push(...await Notes.packMany(notes, me)) + found.push(...(await Notes.packMany(notes, me))); skip += take; if (notes.length < take) break; } diff --git a/packages/backend/src/server/api/endpoints/notes/timeline.ts b/packages/backend/src/server/api/endpoints/notes/timeline.ts index e79f6b589..0d6ec2f46 100644 --- a/packages/backend/src/server/api/endpoints/notes/timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/timeline.ts @@ -154,7 +154,7 @@ export default define(meta, paramDef, async (ps, user) => { let skip = 0; while (found.length < ps.limit) { const notes = await query.take(take).skip(skip).getMany(); - found.push(...await Notes.packMany(notes, user)) + found.push(...(await Notes.packMany(notes, user))); skip += take; if (notes.length < take) break; } diff --git a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts index 1123a33ae..03f5cee3f 100644 --- a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts @@ -151,7 +151,7 @@ export default define(meta, paramDef, async (ps, user) => { let skip = 0; while (found.length < ps.limit) { const notes = await query.take(take).skip(skip).getMany(); - found.push(...await Notes.packMany(notes, user)) + found.push(...(await Notes.packMany(notes, user))); skip += take; if (notes.length < take) break; } diff --git a/packages/backend/src/server/api/endpoints/sw/register.ts b/packages/backend/src/server/api/endpoints/sw/register.ts index d2b805d97..42a35fb68 100644 --- a/packages/backend/src/server/api/endpoints/sw/register.ts +++ b/packages/backend/src/server/api/endpoints/sw/register.ts @@ -27,16 +27,19 @@ export const meta = { nullable: true, }, userId: { - type: 'string', - optional: false, nullable: false, + type: "string", + optional: false, + nullable: false, }, endpoint: { - type: 'string', - optional: false, nullable: false, + type: "string", + optional: false, + nullable: false, }, sendReadMessage: { - type: 'boolean', - optional: false, nullable: false, + type: "boolean", + optional: false, + nullable: false, }, }, }, @@ -48,7 +51,7 @@ export const paramDef = { endpoint: { type: "string" }, auth: { type: "string" }, publickey: { type: "string" }, - sendReadMessage: { type: 'boolean', default: false }, + sendReadMessage: { type: "boolean", default: false }, }, required: ["endpoint", "auth", "publickey"], } as const; diff --git a/packages/backend/src/server/api/endpoints/sw/show-registration.ts b/packages/backend/src/server/api/endpoints/sw/show-registration.ts index 25eb53f52..c7a9609cf 100644 --- a/packages/backend/src/server/api/endpoints/sw/show-registration.ts +++ b/packages/backend/src/server/api/endpoints/sw/show-registration.ts @@ -1,39 +1,43 @@ -import { SwSubscriptions } from '@/models/index.js'; +import { SwSubscriptions } from "@/models/index.js"; import define from "../../define.js"; export const meta = { - tags: ['account'], + tags: ["account"], requireCredential: true, - description: 'Check push notification registration exists.', + description: "Check push notification registration exists.", res: { - type: 'object', - optional: false, nullable: true, + type: "object", + optional: false, + nullable: true, properties: { userId: { - type: 'string', - optional: false, nullable: false, + type: "string", + optional: false, + nullable: false, }, endpoint: { - type: 'string', - optional: false, nullable: false, + type: "string", + optional: false, + nullable: false, }, sendReadMessage: { - type: 'boolean', - optional: false, nullable: false, + type: "boolean", + optional: false, + nullable: false, }, }, }, } as const; export const paramDef = { - type: 'object', + type: "object", properties: { - endpoint: { type: 'string' }, + endpoint: { type: "string" }, }, - required: ['endpoint'], + required: ["endpoint"], } as const; // eslint-disable-next-line import/no-default-export diff --git a/packages/backend/src/server/api/endpoints/sw/update-registration.ts b/packages/backend/src/server/api/endpoints/sw/update-registration.ts index 0b0a56d49..5ba53ee8a 100644 --- a/packages/backend/src/server/api/endpoints/sw/update-registration.ts +++ b/packages/backend/src/server/api/endpoints/sw/update-registration.ts @@ -13,7 +13,7 @@ export const paramDef = { type: "object", properties: { endpoint: { type: "string" }, - sendReadMessage: { type: 'boolean' }, + sendReadMessage: { type: "boolean" }, }, required: ["endpoint"], } as const; diff --git a/packages/backend/src/server/api/index.ts b/packages/backend/src/server/api/index.ts index bfc373e58..b8e423165 100644 --- a/packages/backend/src/server/api/index.ts +++ b/packages/backend/src/server/api/index.ts @@ -24,7 +24,10 @@ import discord from "./service/discord.js"; import github from "./service/github.js"; import twitter from "./service/twitter.js"; import { koaBody } from "koa-body"; -import { convertId, IdConvertType as IdType } from "../../../native-utils/built/index.js"; +import { + convertId, + IdConvertType as IdType, +} from "../../../native-utils/built/index.js"; // re-export native rust id conversion (function and enum) export { IdType, convertId }; diff --git a/packages/backend/src/services/push-notification.ts b/packages/backend/src/services/push-notification.ts index a3abaf769..a207fae39 100644 --- a/packages/backend/src/services/push-notification.ts +++ b/packages/backend/src/services/push-notification.ts @@ -63,12 +63,16 @@ export async function pushNotification( }); for (const subscription of subscriptions) { - if ([ - 'readNotifications', - 'readAllNotifications', - 'readAllMessagingMessages', - 'readAllMessagingMessagesOfARoom', - ].includes(type) && !subscription.sendReadMessage) continue; + if ( + [ + "readNotifications", + "readAllNotifications", + "readAllMessagingMessages", + "readAllMessagingMessagesOfARoom", + ].includes(type) && + !subscription.sendReadMessage + ) + continue; const pushSubscription = { endpoint: subscription.endpoint, diff --git a/packages/backend/test/activitypub.ts b/packages/backend/test/activitypub.ts index f4ae27e5e..7b6f85f5a 100644 --- a/packages/backend/test/activitypub.ts +++ b/packages/backend/test/activitypub.ts @@ -1,42 +1,44 @@ -process.env.NODE_ENV = 'test'; +process.env.NODE_ENV = "test"; -import * as assert from 'assert'; -import rndstr from 'rndstr'; -import { initDb } from '../src/db/postgre.js'; -import { initTestDb } from './utils.js'; +import * as assert from "assert"; +import rndstr from "rndstr"; +import { initDb } from "../src/db/postgre.js"; +import { initTestDb } from "./utils.js"; -describe('ActivityPub', () => { +describe("ActivityPub", () => { before(async () => { //await initTestDb(); await initDb(); }); - describe('Parse minimum object', () => { - const host = 'https://host1.test'; - const preferredUsername = `${rndstr('A-Z', 4)}${rndstr('a-z', 4)}`; + describe("Parse minimum object", () => { + const host = "https://host1.test"; + const preferredUsername = `${rndstr("A-Z", 4)}${rndstr("a-z", 4)}`; const actorId = `${host}/users/${preferredUsername.toLowerCase()}`; const actor = { - '@context': 'https://www.w3.org/ns/activitystreams', + "@context": "https://www.w3.org/ns/activitystreams", id: actorId, - type: 'Person', + type: "Person", preferredUsername, inbox: `${actorId}/inbox`, outbox: `${actorId}/outbox`, }; const post = { - '@context': 'https://www.w3.org/ns/activitystreams', - id: `${host}/users/${rndstr('0-9a-z', 8)}`, - type: 'Note', + "@context": "https://www.w3.org/ns/activitystreams", + id: `${host}/users/${rndstr("0-9a-z", 8)}`, + type: "Note", attributedTo: actor.id, - to: 'https://www.w3.org/ns/activitystreams#Public', - content: 'あ', + to: "https://www.w3.org/ns/activitystreams#Public", + content: "あ", }; - it('Minimum Actor', async () => { - const { MockResolver } = await import('./misc/mock-resolver.js'); - const { createPerson } = await import('../src/remote/activitypub/models/person.js'); + it("Minimum Actor", async () => { + const { MockResolver } = await import("./misc/mock-resolver.js"); + const { createPerson } = await import( + "../src/remote/activitypub/models/person.js" + ); const resolver = new MockResolver(); resolver._register(actor.id, actor); @@ -48,9 +50,11 @@ describe('ActivityPub', () => { assert.deepStrictEqual(user.inbox, actor.inbox); }); - it('Minimum Note', async () => { - const { MockResolver } = await import('./misc/mock-resolver.js'); - const { createNote } = await import('../src/remote/activitypub/models/note.js'); + it("Minimum Note", async () => { + const { MockResolver } = await import("./misc/mock-resolver.js"); + const { createNote } = await import( + "../src/remote/activitypub/models/note.js" + ); const resolver = new MockResolver(); resolver._register(actor.id, actor); @@ -59,31 +63,33 @@ describe('ActivityPub', () => { const note = await createNote(post.id, resolver, true); assert.deepStrictEqual(note?.uri, post.id); - assert.deepStrictEqual(note.visibility, 'public'); + assert.deepStrictEqual(note.visibility, "public"); assert.deepStrictEqual(note.text, post.content); }); }); - describe('Truncate long name', () => { - const host = 'https://host1.test'; - const preferredUsername = `${rndstr('A-Z', 4)}${rndstr('a-z', 4)}`; + describe("Truncate long name", () => { + const host = "https://host1.test"; + const preferredUsername = `${rndstr("A-Z", 4)}${rndstr("a-z", 4)}`; const actorId = `${host}/users/${preferredUsername.toLowerCase()}`; - const name = rndstr('0-9a-z', 129); + const name = rndstr("0-9a-z", 129); const actor = { - '@context': 'https://www.w3.org/ns/activitystreams', + "@context": "https://www.w3.org/ns/activitystreams", id: actorId, - type: 'Person', + type: "Person", preferredUsername, name, inbox: `${actorId}/inbox`, outbox: `${actorId}/outbox`, }; - it('Actor', async () => { - const { MockResolver } = await import('./misc/mock-resolver.js'); - const { createPerson } = await import('../src/remote/activitypub/models/person.js'); + it("Actor", async () => { + const { MockResolver } = await import("./misc/mock-resolver.js"); + const { createPerson } = await import( + "../src/remote/activitypub/models/person.js" + ); const resolver = new MockResolver(); resolver._register(actor.id, actor); diff --git a/packages/backend/test/ap-request.ts b/packages/backend/test/ap-request.ts index 744b2f2c9..bf77a3853 100644 --- a/packages/backend/test/ap-request.ts +++ b/packages/backend/test/ap-request.ts @@ -1,53 +1,73 @@ -import * as assert from 'assert'; -import httpSignature from '@peertube/http-signature'; -import { genRsaKeyPair } from '../src/misc/gen-key-pair.js'; -import { createSignedPost, createSignedGet } from '../src/remote/activitypub/ap-request.js'; +import * as assert from "assert"; +import httpSignature from "@peertube/http-signature"; +import { genRsaKeyPair } from "../src/misc/gen-key-pair.js"; +import { + createSignedPost, + createSignedGet, +} from "../src/remote/activitypub/ap-request.js"; -export const buildParsedSignature = (signingString: string, signature: string, algorithm: string) => { +export const buildParsedSignature = ( + signingString: string, + signature: string, + algorithm: string, +) => { return { - scheme: 'Signature', + scheme: "Signature", params: { - keyId: 'KeyID', // dummy, not used for verify + keyId: "KeyID", // dummy, not used for verify algorithm: algorithm, - headers: [ '(request-target)', 'date', 'host', 'digest' ], // dummy, not used for verify + headers: ["(request-target)", "date", "host", "digest"], // dummy, not used for verify signature: signature, }, signingString: signingString, algorithm: algorithm.toUpperCase(), - keyId: 'KeyID', // dummy, not used for verify + keyId: "KeyID", // dummy, not used for verify }; }; -describe('ap-request', () => { - it('createSignedPost with verify', async () => { +describe("ap-request", () => { + it("createSignedPost with verify", async () => { const keypair = await genRsaKeyPair(); - const key = { keyId: 'x', 'privateKeyPem': keypair.privateKey }; - const url = 'https://example.com/inbox'; + const key = { keyId: "x", privateKeyPem: keypair.privateKey }; + const url = "https://example.com/inbox"; const activity = { a: 1 }; const body = JSON.stringify(activity); const headers = { - 'User-Agent': 'UA', + "User-Agent": "UA", }; - const req = createSignedPost({ key, url, body, additionalHeaders: headers }); + const req = createSignedPost({ + key, + url, + body, + additionalHeaders: headers, + }); - const parsed = buildParsedSignature(req.signingString, req.signature, 'rsa-sha256'); + const parsed = buildParsedSignature( + req.signingString, + req.signature, + "rsa-sha256", + ); const result = httpSignature.verifySignature(parsed, keypair.publicKey); assert.deepStrictEqual(result, true); }); - it('createSignedGet with verify', async () => { + it("createSignedGet with verify", async () => { const keypair = await genRsaKeyPair(); - const key = { keyId: 'x', 'privateKeyPem': keypair.privateKey }; - const url = 'https://example.com/outbox'; + const key = { keyId: "x", privateKeyPem: keypair.privateKey }; + const url = "https://example.com/outbox"; const headers = { - 'User-Agent': 'UA', + "User-Agent": "UA", }; const req = createSignedGet({ key, url, additionalHeaders: headers }); - const parsed = buildParsedSignature(req.signingString, req.signature, 'rsa-sha256'); + const parsed = buildParsedSignature( + req.signingString, + req.signature, + "rsa-sha256", + ); const result = httpSignature.verifySignature(parsed, keypair.publicKey); assert.deepStrictEqual(result, true); diff --git a/packages/backend/test/api-visibility.ts b/packages/backend/test/api-visibility.ts index cde3cd2d0..0ee4a4d33 100644 --- a/packages/backend/test/api-visibility.ts +++ b/packages/backend/test/api-visibility.ts @@ -1,10 +1,17 @@ -process.env.NODE_ENV = 'test'; +process.env.NODE_ENV = "test"; -import * as assert from 'assert'; -import * as childProcess from 'child_process'; -import { async, signup, request, post, startServer, shutdownServer } from './utils.js'; +import * as assert from "assert"; +import * as childProcess from "child_process"; +import { + async, + signup, + request, + post, + startServer, + shutdownServer, +} from "./utils.js"; -describe('API visibility', () => { +describe("API visibility", () => { let p: childProcess.ChildProcess; before(async () => { @@ -15,7 +22,7 @@ describe('API visibility', () => { await shutdownServer(p); }); - describe('Note visibility', async () => { + describe("Note visibility", async () => { //#region vars /** ヒロイン */ let alice: any; @@ -60,130 +67,170 @@ describe('API visibility', () => { //#endregion const show = async (noteId: any, by: any) => { - return await request('/notes/show', { - noteId, - }, by); + return await request( + "/notes/show", + { + noteId, + }, + by, + ); }; before(async () => { //#region prepare // signup - alice = await signup({ username: 'alice' }); - follower = await signup({ username: 'follower' }); - other = await signup({ username: 'other' }); - target = await signup({ username: 'target' }); - target2 = await signup({ username: 'target2' }); + alice = await signup({ username: "alice" }); + follower = await signup({ username: "follower" }); + other = await signup({ username: "other" }); + target = await signup({ username: "target" }); + target2 = await signup({ username: "target2" }); // follow alice <= follower - await request('/following/create', { userId: alice.id }, follower); + await request("/following/create", { userId: alice.id }, follower); // normal posts - pub = await post(alice, { text: 'x', visibility: 'public' }); - home = await post(alice, { text: 'x', visibility: 'home' }); - fol = await post(alice, { text: 'x', visibility: 'followers' }); - spe = await post(alice, { text: 'x', visibility: 'specified', visibleUserIds: [target.id] }); + pub = await post(alice, { text: "x", visibility: "public" }); + home = await post(alice, { text: "x", visibility: "home" }); + fol = await post(alice, { text: "x", visibility: "followers" }); + spe = await post(alice, { + text: "x", + visibility: "specified", + visibleUserIds: [target.id], + }); // replies - tgt = await post(target, { text: 'y', visibility: 'public' }); - pubR = await post(alice, { text: 'x', replyId: tgt.id, visibility: 'public' }); - homeR = await post(alice, { text: 'x', replyId: tgt.id, visibility: 'home' }); - folR = await post(alice, { text: 'x', replyId: tgt.id, visibility: 'followers' }); - speR = await post(alice, { text: 'x', replyId: tgt.id, visibility: 'specified' }); + tgt = await post(target, { text: "y", visibility: "public" }); + pubR = await post(alice, { + text: "x", + replyId: tgt.id, + visibility: "public", + }); + homeR = await post(alice, { + text: "x", + replyId: tgt.id, + visibility: "home", + }); + folR = await post(alice, { + text: "x", + replyId: tgt.id, + visibility: "followers", + }); + speR = await post(alice, { + text: "x", + replyId: tgt.id, + visibility: "specified", + }); // mentions - pubM = await post(alice, { text: '@target x', replyId: tgt.id, visibility: 'public' }); - homeM = await post(alice, { text: '@target x', replyId: tgt.id, visibility: 'home' }); - folM = await post(alice, { text: '@target x', replyId: tgt.id, visibility: 'followers' }); - speM = await post(alice, { text: '@target2 x', replyId: tgt.id, visibility: 'specified' }); + pubM = await post(alice, { + text: "@target x", + replyId: tgt.id, + visibility: "public", + }); + homeM = await post(alice, { + text: "@target x", + replyId: tgt.id, + visibility: "home", + }); + folM = await post(alice, { + text: "@target x", + replyId: tgt.id, + visibility: "followers", + }); + speM = await post(alice, { + text: "@target2 x", + replyId: tgt.id, + visibility: "specified", + }); //#endregion }); //#region show post // public - it('[show] public-postを自分が見れる', async(async () => { + it("[show] public-postを自分が見れる", async(async () => { const res = await show(pub.id, alice); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] public-postをフォロワーが見れる', async(async () => { + it("[show] public-postをフォロワーが見れる", async(async () => { const res = await show(pub.id, follower); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] public-postを非フォロワーが見れる', async(async () => { + it("[show] public-postを非フォロワーが見れる", async(async () => { const res = await show(pub.id, other); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] public-postを未認証が見れる', async(async () => { + it("[show] public-postを未認証が見れる", async(async () => { const res = await show(pub.id, null); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); // home - it('[show] home-postを自分が見れる', async(async () => { + it("[show] home-postを自分が見れる", async(async () => { const res = await show(home.id, alice); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] home-postをフォロワーが見れる', async(async () => { + it("[show] home-postをフォロワーが見れる", async(async () => { const res = await show(home.id, follower); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] home-postを非フォロワーが見れる', async(async () => { + it("[show] home-postを非フォロワーが見れる", async(async () => { const res = await show(home.id, other); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] home-postを未認証が見れる', async(async () => { + it("[show] home-postを未認証が見れる", async(async () => { const res = await show(home.id, null); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); // followers - it('[show] followers-postを自分が見れる', async(async () => { + it("[show] followers-postを自分が見れる", async(async () => { const res = await show(fol.id, alice); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] followers-postをフォロワーが見れる', async(async () => { + it("[show] followers-postをフォロワーが見れる", async(async () => { const res = await show(fol.id, follower); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] followers-postを非フォロワーが見れない', async(async () => { + it("[show] followers-postを非フォロワーが見れない", async(async () => { const res = await show(fol.id, other); assert.strictEqual(res.status, 404); })); - it('[show] followers-postを未認証が見れない', async(async () => { + it("[show] followers-postを未認証が見れない", async(async () => { const res = await show(fol.id, null); assert.strictEqual(res.status, 404); })); // specified - it('[show] specified-postを自分が見れる', async(async () => { + it("[show] specified-postを自分が見れる", async(async () => { const res = await show(spe.id, alice); assert.strictEqual(res.status, 404); })); - it('[show] specified-postを指定ユーザーが見れる', async(async () => { + it("[show] specified-postを指定ユーザーが見れる", async(async () => { const res = await show(spe.id, target); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] specified-postをフォロワーが見れない', async(async () => { + it("[show] specified-postをフォロワーが見れない", async(async () => { const res = await show(spe.id, follower); assert.strictEqual(res.status, 404); })); - it('[show] specified-postを非フォロワーが見れない', async(async () => { + it("[show] specified-postを非フォロワーが見れない", async(async () => { const res = await show(spe.id, other); assert.strictEqual(res.status, 404); })); - it('[show] specified-postを未認証が見れない', async(async () => { + it("[show] specified-postを未認証が見れない", async(async () => { const res = await show(spe.id, null); assert.strictEqual(res.status, 404); })); @@ -191,110 +238,110 @@ describe('API visibility', () => { //#region show reply // public - it('[show] public-replyを自分が見れる', async(async () => { + it("[show] public-replyを自分が見れる", async(async () => { const res = await show(pubR.id, alice); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] public-replyをされた人が見れる', async(async () => { + it("[show] public-replyをされた人が見れる", async(async () => { const res = await show(pubR.id, target); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] public-replyをフォロワーが見れる', async(async () => { + it("[show] public-replyをフォロワーが見れる", async(async () => { const res = await show(pubR.id, follower); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] public-replyを非フォロワーが見れる', async(async () => { + it("[show] public-replyを非フォロワーが見れる", async(async () => { const res = await show(pubR.id, other); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] public-replyを未認証が見れる', async(async () => { + it("[show] public-replyを未認証が見れる", async(async () => { const res = await show(pubR.id, null); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); // home - it('[show] home-replyを自分が見れる', async(async () => { + it("[show] home-replyを自分が見れる", async(async () => { const res = await show(homeR.id, alice); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] home-replyをされた人が見れる', async(async () => { + it("[show] home-replyをされた人が見れる", async(async () => { const res = await show(homeR.id, target); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] home-replyをフォロワーが見れる', async(async () => { + it("[show] home-replyをフォロワーが見れる", async(async () => { const res = await show(homeR.id, follower); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] home-replyを非フォロワーが見れる', async(async () => { + it("[show] home-replyを非フォロワーが見れる", async(async () => { const res = await show(homeR.id, other); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] home-replyを未認証が見れる', async(async () => { + it("[show] home-replyを未認証が見れる", async(async () => { const res = await show(homeR.id, null); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); // followers - it('[show] followers-replyを自分が見れる', async(async () => { + it("[show] followers-replyを自分が見れる", async(async () => { const res = await show(folR.id, alice); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] followers-replyを非フォロワーでもリプライされていれば見れる', async(async () => { + it("[show] followers-replyを非フォロワーでもリプライされていれば見れる", async(async () => { const res = await show(folR.id, target); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] followers-replyをフォロワーが見れる', async(async () => { + it("[show] followers-replyをフォロワーが見れる", async(async () => { const res = await show(folR.id, follower); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] followers-replyを非フォロワーが見れない', async(async () => { + it("[show] followers-replyを非フォロワーが見れない", async(async () => { const res = await show(folR.id, other); assert.strictEqual(res.status, 404); })); - it('[show] followers-replyを未認証が見れない', async(async () => { + it("[show] followers-replyを未認証が見れない", async(async () => { const res = await show(folR.id, null); assert.strictEqual(res.status, 404); })); // specified - it('[show] specified-replyを自分が見れる', async(async () => { + it("[show] specified-replyを自分が見れる", async(async () => { const res = await show(speR.id, alice); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] specified-replyを指定ユーザーが見れる', async(async () => { + it("[show] specified-replyを指定ユーザーが見れる", async(async () => { const res = await show(speR.id, target); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] specified-replyをされた人が指定されてなくても見れる', async(async () => { + it("[show] specified-replyをされた人が指定されてなくても見れる", async(async () => { const res = await show(speR.id, target); - assert.strictEqual(res.body.text, 'x'); + assert.strictEqual(res.body.text, "x"); })); - it('[show] specified-replyをフォロワーが見れない', async(async () => { + it("[show] specified-replyをフォロワーが見れない", async(async () => { const res = await show(speR.id, follower); assert.strictEqual(res.status, 404); })); - it('[show] specified-replyを非フォロワーが見れない', async(async () => { + it("[show] specified-replyを非フォロワーが見れない", async(async () => { const res = await show(speR.id, other); assert.strictEqual(res.status, 404); })); - it('[show] specified-replyを未認証が見れない', async(async () => { + it("[show] specified-replyを未認証が見れない", async(async () => { const res = await show(speR.id, null); assert.strictEqual(res.status, 404); })); @@ -302,174 +349,186 @@ describe('API visibility', () => { //#region show mention // public - it('[show] public-mentionを自分が見れる', async(async () => { + it("[show] public-mentionを自分が見れる", async(async () => { const res = await show(pubM.id, alice); - assert.strictEqual(res.body.text, '@target x'); + assert.strictEqual(res.body.text, "@target x"); })); - it('[show] public-mentionをされた人が見れる', async(async () => { + it("[show] public-mentionをされた人が見れる", async(async () => { const res = await show(pubM.id, target); - assert.strictEqual(res.body.text, '@target x'); + assert.strictEqual(res.body.text, "@target x"); })); - it('[show] public-mentionをフォロワーが見れる', async(async () => { + it("[show] public-mentionをフォロワーが見れる", async(async () => { const res = await show(pubM.id, follower); - assert.strictEqual(res.body.text, '@target x'); + assert.strictEqual(res.body.text, "@target x"); })); - it('[show] public-mentionを非フォロワーが見れる', async(async () => { + it("[show] public-mentionを非フォロワーが見れる", async(async () => { const res = await show(pubM.id, other); - assert.strictEqual(res.body.text, '@target x'); + assert.strictEqual(res.body.text, "@target x"); })); - it('[show] public-mentionを未認証が見れる', async(async () => { + it("[show] public-mentionを未認証が見れる", async(async () => { const res = await show(pubM.id, null); - assert.strictEqual(res.body.text, '@target x'); + assert.strictEqual(res.body.text, "@target x"); })); // home - it('[show] home-mentionを自分が見れる', async(async () => { + it("[show] home-mentionを自分が見れる", async(async () => { const res = await show(homeM.id, alice); - assert.strictEqual(res.body.text, '@target x'); + assert.strictEqual(res.body.text, "@target x"); })); - it('[show] home-mentionをされた人が見れる', async(async () => { + it("[show] home-mentionをされた人が見れる", async(async () => { const res = await show(homeM.id, target); - assert.strictEqual(res.body.text, '@target x'); + assert.strictEqual(res.body.text, "@target x"); })); - it('[show] home-mentionをフォロワーが見れる', async(async () => { + it("[show] home-mentionをフォロワーが見れる", async(async () => { const res = await show(homeM.id, follower); - assert.strictEqual(res.body.text, '@target x'); + assert.strictEqual(res.body.text, "@target x"); })); - it('[show] home-mentionを非フォロワーが見れる', async(async () => { + it("[show] home-mentionを非フォロワーが見れる", async(async () => { const res = await show(homeM.id, other); - assert.strictEqual(res.body.text, '@target x'); + assert.strictEqual(res.body.text, "@target x"); })); - it('[show] home-mentionを未認証が見れる', async(async () => { + it("[show] home-mentionを未認証が見れる", async(async () => { const res = await show(homeM.id, null); - assert.strictEqual(res.body.text, '@target x'); + assert.strictEqual(res.body.text, "@target x"); })); // followers - it('[show] followers-mentionを自分が見れる', async(async () => { + it("[show] followers-mentionを自分が見れる", async(async () => { const res = await show(folM.id, alice); - assert.strictEqual(res.body.text, '@target x'); + assert.strictEqual(res.body.text, "@target x"); })); - it('[show] followers-mentionをメンションされていれば非フォロワーでも見れる', async(async () => { + it("[show] followers-mentionをメンションされていれば非フォロワーでも見れる", async(async () => { const res = await show(folM.id, target); - assert.strictEqual(res.body.text, '@target x'); + assert.strictEqual(res.body.text, "@target x"); })); - it('[show] followers-mentionをフォロワーが見れる', async(async () => { + it("[show] followers-mentionをフォロワーが見れる", async(async () => { const res = await show(folM.id, follower); - assert.strictEqual(res.body.text, '@target x'); + assert.strictEqual(res.body.text, "@target x"); })); - it('[show] followers-mentionを非フォロワーが見れない', async(async () => { + it("[show] followers-mentionを非フォロワーが見れない", async(async () => { const res = await show(folM.id, other); assert.strictEqual(res.status, 404); })); - it('[show] followers-mentionを未認証が見れない', async(async () => { + it("[show] followers-mentionを未認証が見れない", async(async () => { const res = await show(folM.id, null); assert.strictEqual(res.status, 404); })); // specified - it('[show] specified-mentionを自分が見れる', async(async () => { + it("[show] specified-mentionを自分が見れる", async(async () => { const res = await show(speM.id, alice); - assert.strictEqual(res.body.text, '@target2 x'); + assert.strictEqual(res.body.text, "@target2 x"); })); - it('[show] specified-mentionを指定ユーザーが見れる', async(async () => { + it("[show] specified-mentionを指定ユーザーが見れる", async(async () => { const res = await show(speM.id, target); - assert.strictEqual(res.body.text, '@target2 x'); + assert.strictEqual(res.body.text, "@target2 x"); })); - it('[show] specified-mentionをされた人が指定されてなかったら見れない', async(async () => { + it("[show] specified-mentionをされた人が指定されてなかったら見れない", async(async () => { const res = await show(speM.id, target2); assert.strictEqual(res.status, 404); })); - it('[show] specified-mentionをフォロワーが見れない', async(async () => { + it("[show] specified-mentionをフォロワーが見れない", async(async () => { const res = await show(speM.id, follower); assert.strictEqual(res.status, 404); })); - it('[show] specified-mentionを非フォロワーが見れない', async(async () => { + it("[show] specified-mentionを非フォロワーが見れない", async(async () => { const res = await show(speM.id, other); assert.strictEqual(res.status, 404); })); - it('[show] specified-mentionを未認証が見れない', async(async () => { + it("[show] specified-mentionを未認証が見れない", async(async () => { const res = await show(speM.id, null); assert.strictEqual(res.status, 404); })); //#endregion //#region HTL - it('[HTL] public-post が 自分が見れる', async(async () => { - const res = await request('/notes/timeline', { limit: 100 }, alice); + it("[HTL] public-post が 自分が見れる", async(async () => { + const res = await request("/notes/timeline", { limit: 100 }, alice); assert.strictEqual(res.status, 200); const notes = res.body.filter((n: any) => n.id == pub.id); - assert.strictEqual(notes[0].text, 'x'); + assert.strictEqual(notes[0].text, "x"); })); - it('[HTL] public-post が 非フォロワーから見れない', async(async () => { - const res = await request('/notes/timeline', { limit: 100 }, other); + it("[HTL] public-post が 非フォロワーから見れない", async(async () => { + const res = await request("/notes/timeline", { limit: 100 }, other); assert.strictEqual(res.status, 200); const notes = res.body.filter((n: any) => n.id == pub.id); assert.strictEqual(notes.length, 0); })); - it('[HTL] followers-post が フォロワーから見れる', async(async () => { - const res = await request('/notes/timeline', { limit: 100 }, follower); + it("[HTL] followers-post が フォロワーから見れる", async(async () => { + const res = await request("/notes/timeline", { limit: 100 }, follower); assert.strictEqual(res.status, 200); const notes = res.body.filter((n: any) => n.id == fol.id); - assert.strictEqual(notes[0].text, 'x'); + assert.strictEqual(notes[0].text, "x"); })); //#endregion //#region RTL - it('[replies] followers-reply が フォロワーから見れる', async(async () => { - const res = await request('/notes/replies', { noteId: tgt.id, limit: 100 }, follower); + it("[replies] followers-reply が フォロワーから見れる", async(async () => { + const res = await request( + "/notes/replies", + { noteId: tgt.id, limit: 100 }, + follower, + ); assert.strictEqual(res.status, 200); const notes = res.body.filter((n: any) => n.id == folR.id); - assert.strictEqual(notes[0].text, 'x'); + assert.strictEqual(notes[0].text, "x"); })); - it('[replies] followers-reply が 非フォロワー (リプライ先ではない) から見れない', async(async () => { - const res = await request('/notes/replies', { noteId: tgt.id, limit: 100 }, other); + it("[replies] followers-reply が 非フォロワー (リプライ先ではない) から見れない", async(async () => { + const res = await request( + "/notes/replies", + { noteId: tgt.id, limit: 100 }, + other, + ); assert.strictEqual(res.status, 200); const notes = res.body.filter((n: any) => n.id == folR.id); assert.strictEqual(notes.length, 0); })); - it('[replies] followers-reply が 非フォロワー (リプライ先である) から見れる', async(async () => { - const res = await request('/notes/replies', { noteId: tgt.id, limit: 100 }, target); + it("[replies] followers-reply が 非フォロワー (リプライ先である) から見れる", async(async () => { + const res = await request( + "/notes/replies", + { noteId: tgt.id, limit: 100 }, + target, + ); assert.strictEqual(res.status, 200); const notes = res.body.filter((n: any) => n.id == folR.id); - assert.strictEqual(notes[0].text, 'x'); + assert.strictEqual(notes[0].text, "x"); })); //#endregion //#region MTL - it('[mentions] followers-reply が 非フォロワー (リプライ先である) から見れる', async(async () => { - const res = await request('/notes/mentions', { limit: 100 }, target); + it("[mentions] followers-reply が 非フォロワー (リプライ先である) から見れる", async(async () => { + const res = await request("/notes/mentions", { limit: 100 }, target); assert.strictEqual(res.status, 200); const notes = res.body.filter((n: any) => n.id == folR.id); - assert.strictEqual(notes[0].text, 'x'); + assert.strictEqual(notes[0].text, "x"); })); - it('[mentions] followers-mention が 非フォロワー (メンション先である) から見れる', async(async () => { - const res = await request('/notes/mentions', { limit: 100 }, target); + it("[mentions] followers-mention が 非フォロワー (メンション先である) から見れる", async(async () => { + const res = await request("/notes/mentions", { limit: 100 }, target); assert.strictEqual(res.status, 200); const notes = res.body.filter((n: any) => n.id == folM.id); - assert.strictEqual(notes[0].text, '@target x'); + assert.strictEqual(notes[0].text, "@target x"); })); //#endregion }); diff --git a/packages/backend/test/api.ts b/packages/backend/test/api.ts index b1b2ecafc..19a754552 100644 --- a/packages/backend/test/api.ts +++ b/packages/backend/test/api.ts @@ -1,10 +1,19 @@ -process.env.NODE_ENV = 'test'; +process.env.NODE_ENV = "test"; -import * as assert from 'assert'; -import * as childProcess from 'child_process'; -import { async, signup, request, post, react, uploadFile, startServer, shutdownServer } from './utils.js'; +import * as assert from "assert"; +import * as childProcess from "child_process"; +import { + async, + signup, + request, + post, + react, + uploadFile, + startServer, + shutdownServer, +} from "./utils.js"; -describe('API', () => { +describe("API", () => { let p: childProcess.ChildProcess; let alice: any; let bob: any; @@ -12,58 +21,58 @@ describe('API', () => { before(async () => { p = await startServer(); - alice = await signup({ username: 'alice' }); - bob = await signup({ username: 'bob' }); - carol = await signup({ username: 'carol' }); + alice = await signup({ username: "alice" }); + bob = await signup({ username: "bob" }); + carol = await signup({ username: "carol" }); }); after(async () => { await shutdownServer(p); }); - describe('General validation', () => { - it('wrong type', async(async () => { - const res = await request('/test', { + describe("General validation", () => { + it("wrong type", async(async () => { + const res = await request("/test", { required: true, string: 42, }); assert.strictEqual(res.status, 400); })); - it('missing require param', async(async () => { - const res = await request('/test', { - string: 'a', + it("missing require param", async(async () => { + const res = await request("/test", { + string: "a", }); assert.strictEqual(res.status, 400); })); - it('invalid misskey:id (empty string)', async(async () => { - const res = await request('/test', { + it("invalid misskey:id (empty string)", async(async () => { + const res = await request("/test", { required: true, - id: '', + id: "", }); assert.strictEqual(res.status, 400); })); - it('valid misskey:id', async(async () => { - const res = await request('/test', { + it("valid misskey:id", async(async () => { + const res = await request("/test", { required: true, - id: '8wvhjghbxu', + id: "8wvhjghbxu", }); assert.strictEqual(res.status, 200); })); - it('default value', async(async () => { - const res = await request('/test', { + it("default value", async(async () => { + const res = await request("/test", { required: true, - string: 'a', + string: "a", }); assert.strictEqual(res.status, 200); - assert.strictEqual(res.body.default, 'hello'); + assert.strictEqual(res.body.default, "hello"); })); - it('can set null even if it has default value', async(async () => { - const res = await request('/test', { + it("can set null even if it has default value", async(async () => { + const res = await request("/test", { required: true, nullableDefault: null, }); @@ -71,13 +80,13 @@ describe('API', () => { assert.strictEqual(res.body.nullableDefault, null); })); - it('cannot set undefined if it has default value', async(async () => { - const res = await request('/test', { + it("cannot set undefined if it has default value", async(async () => { + const res = await request("/test", { required: true, nullableDefault: undefined, }); assert.strictEqual(res.status, 200); - assert.strictEqual(res.body.nullableDefault, 'hello'); + assert.strictEqual(res.body.nullableDefault, "hello"); })); }); }); diff --git a/packages/backend/test/block.ts b/packages/backend/test/block.ts index b3343813c..08192e486 100644 --- a/packages/backend/test/block.ts +++ b/packages/backend/test/block.ts @@ -1,10 +1,17 @@ -process.env.NODE_ENV = 'test'; +process.env.NODE_ENV = "test"; -import * as assert from 'assert'; -import * as childProcess from 'child_process'; -import { async, signup, request, post, startServer, shutdownServer } from './utils.js'; +import * as assert from "assert"; +import * as childProcess from "child_process"; +import { + async, + signup, + request, + post, + startServer, + shutdownServer, +} from "./utils.js"; -describe('Block', () => { +describe("Block", () => { let p: childProcess.ChildProcess; // alice blocks bob @@ -14,72 +21,109 @@ describe('Block', () => { before(async () => { p = await startServer(); - alice = await signup({ username: 'alice' }); - bob = await signup({ username: 'bob' }); - carol = await signup({ username: 'carol' }); + alice = await signup({ username: "alice" }); + bob = await signup({ username: "bob" }); + carol = await signup({ username: "carol" }); }); after(async () => { await shutdownServer(p); }); - it('Block作成', async(async () => { - const res = await request('/blocking/create', { - userId: bob.id, - }, alice); + it("Block作成", async(async () => { + const res = await request( + "/blocking/create", + { + userId: bob.id, + }, + alice, + ); assert.strictEqual(res.status, 200); })); - it('ブロックされているユーザーをフォローできない', async(async () => { - const res = await request('/following/create', { userId: alice.id }, bob); + it("ブロックされているユーザーをフォローできない", async(async () => { + const res = await request("/following/create", { userId: alice.id }, bob); assert.strictEqual(res.status, 400); - assert.strictEqual(res.body.error.id, 'c4ab57cc-4e41-45e9-bfd9-584f61e35ce0'); + assert.strictEqual( + res.body.error.id, + "c4ab57cc-4e41-45e9-bfd9-584f61e35ce0", + ); })); - it('ブロックされているユーザーにリアクションできない', async(async () => { - const note = await post(alice, { text: 'hello' }); + it("ブロックされているユーザーにリアクションできない", async(async () => { + const note = await post(alice, { text: "hello" }); - const res = await request('/notes/reactions/create', { noteId: note.id, reaction: '👍' }, bob); + const res = await request( + "/notes/reactions/create", + { noteId: note.id, reaction: "👍" }, + bob, + ); assert.strictEqual(res.status, 400); - assert.strictEqual(res.body.error.id, '20ef5475-9f38-4e4c-bd33-de6d979498ec'); + assert.strictEqual( + res.body.error.id, + "20ef5475-9f38-4e4c-bd33-de6d979498ec", + ); })); - it('ブロックされているユーザーに返信できない', async(async () => { - const note = await post(alice, { text: 'hello' }); + it("ブロックされているユーザーに返信できない", async(async () => { + const note = await post(alice, { text: "hello" }); - const res = await request('/notes/create', { replyId: note.id, text: 'yo' }, bob); + const res = await request( + "/notes/create", + { replyId: note.id, text: "yo" }, + bob, + ); assert.strictEqual(res.status, 400); - assert.strictEqual(res.body.error.id, 'b390d7e1-8a5e-46ed-b625-06271cafd3d3'); + assert.strictEqual( + res.body.error.id, + "b390d7e1-8a5e-46ed-b625-06271cafd3d3", + ); })); - it('ブロックされているユーザーのノートをRenoteできない', async(async () => { - const note = await post(alice, { text: 'hello' }); + it("ブロックされているユーザーのノートをRenoteできない", async(async () => { + const note = await post(alice, { text: "hello" }); - const res = await request('/notes/create', { renoteId: note.id, text: 'yo' }, bob); + const res = await request( + "/notes/create", + { renoteId: note.id, text: "yo" }, + bob, + ); assert.strictEqual(res.status, 400); - assert.strictEqual(res.body.error.id, 'b390d7e1-8a5e-46ed-b625-06271cafd3d3'); + assert.strictEqual( + res.body.error.id, + "b390d7e1-8a5e-46ed-b625-06271cafd3d3", + ); })); // TODO: ユーザーリストに入れられないテスト // TODO: ユーザーリストから除外されるテスト - it('タイムライン(LTL)にブロックされているユーザーの投稿が含まれない', async(async () => { + it("タイムライン(LTL)にブロックされているユーザーの投稿が含まれない", async(async () => { const aliceNote = await post(alice); const bobNote = await post(bob); const carolNote = await post(carol); - const res = await request('/notes/local-timeline', {}, bob); + const res = await request("/notes/local-timeline", {}, bob); assert.strictEqual(res.status, 200); assert.strictEqual(Array.isArray(res.body), true); - assert.strictEqual(res.body.some((note: any) => note.id === aliceNote.id), false); - assert.strictEqual(res.body.some((note: any) => note.id === bobNote.id), true); - assert.strictEqual(res.body.some((note: any) => note.id === carolNote.id), true); + assert.strictEqual( + res.body.some((note: any) => note.id === aliceNote.id), + false, + ); + assert.strictEqual( + res.body.some((note: any) => note.id === bobNote.id), + true, + ); + assert.strictEqual( + res.body.some((note: any) => note.id === carolNote.id), + true, + ); })); }); diff --git a/packages/backend/test/chart.ts b/packages/backend/test/chart.ts index ac0844679..e194c6c19 100644 --- a/packages/backend/test/chart.ts +++ b/packages/backend/test/chart.ts @@ -1,14 +1,14 @@ -process.env.NODE_ENV = 'test'; +process.env.NODE_ENV = "test"; -import * as assert from 'assert'; -import * as lolex from '@sinonjs/fake-timers'; -import TestChart from '../src/services/chart/charts/test.js'; -import TestGroupedChart from '../src/services/chart/charts/test-grouped.js'; -import TestUniqueChart from '../src/services/chart/charts/test-unique.js'; -import TestIntersectionChart from '../src/services/chart/charts/test-intersection.js'; -import { initDb } from '../src/db/postgre.js'; +import * as assert from "assert"; +import * as lolex from "@sinonjs/fake-timers"; +import TestChart from "../src/services/chart/charts/test.js"; +import TestGroupedChart from "../src/services/chart/charts/test-grouped.js"; +import TestUniqueChart from "../src/services/chart/charts/test-unique.js"; +import TestIntersectionChart from "../src/services/chart/charts/test-intersection.js"; +import { initDb } from "../src/db/postgre.js"; -describe('Chart', () => { +describe("Chart", () => { let testChart: TestChart; let testGroupedChart: TestGroupedChart; let testUniqueChart: TestUniqueChart; @@ -33,12 +33,12 @@ describe('Chart', () => { clock.uninstall(); }); - it('Can updates', async () => { + it("Can updates", async () => { await testChart.increment(); await testChart.save(); - const chartHours = await testChart.getChart('hour', 3, null); - const chartDays = await testChart.getChart('day', 3, null); + const chartHours = await testChart.getChart("hour", 3, null); + const chartDays = await testChart.getChart("day", 3, null); assert.deepStrictEqual(chartHours, { foo: { @@ -57,12 +57,12 @@ describe('Chart', () => { }); }); - it('Can updates (dec)', async () => { + it("Can updates (dec)", async () => { await testChart.decrement(); await testChart.save(); - const chartHours = await testChart.getChart('hour', 3, null); - const chartDays = await testChart.getChart('day', 3, null); + const chartHours = await testChart.getChart("hour", 3, null); + const chartDays = await testChart.getChart("day", 3, null); assert.deepStrictEqual(chartHours, { foo: { @@ -81,9 +81,9 @@ describe('Chart', () => { }); }); - it('Empty chart', async () => { - const chartHours = await testChart.getChart('hour', 3, null); - const chartDays = await testChart.getChart('day', 3, null); + it("Empty chart", async () => { + const chartHours = await testChart.getChart("hour", 3, null); + const chartDays = await testChart.getChart("day", 3, null); assert.deepStrictEqual(chartHours, { foo: { @@ -102,14 +102,14 @@ describe('Chart', () => { }); }); - it('Can updates at multiple times at same time', async () => { + it("Can updates at multiple times at same time", async () => { await testChart.increment(); await testChart.increment(); await testChart.increment(); await testChart.save(); - const chartHours = await testChart.getChart('hour', 3, null); - const chartDays = await testChart.getChart('day', 3, null); + const chartHours = await testChart.getChart("hour", 3, null); + const chartDays = await testChart.getChart("day", 3, null); assert.deepStrictEqual(chartHours, { foo: { @@ -128,14 +128,14 @@ describe('Chart', () => { }); }); - it('複数回saveされてもデータの更新は一度だけ', async () => { + it("複数回saveされてもデータの更新は一度だけ", async () => { await testChart.increment(); await testChart.save(); await testChart.save(); await testChart.save(); - const chartHours = await testChart.getChart('hour', 3, null); - const chartDays = await testChart.getChart('day', 3, null); + const chartHours = await testChart.getChart("hour", 3, null); + const chartDays = await testChart.getChart("day", 3, null); assert.deepStrictEqual(chartHours, { foo: { @@ -154,17 +154,17 @@ describe('Chart', () => { }); }); - it('Can updates at different times', async () => { + it("Can updates at different times", async () => { await testChart.increment(); await testChart.save(); - clock.tick('01:00:00'); + clock.tick("01:00:00"); await testChart.increment(); await testChart.save(); - const chartHours = await testChart.getChart('hour', 3, null); - const chartDays = await testChart.getChart('day', 3, null); + const chartHours = await testChart.getChart("hour", 3, null); + const chartDays = await testChart.getChart("day", 3, null); assert.deepStrictEqual(chartHours, { foo: { @@ -214,17 +214,17 @@ describe('Chart', () => { }); */ - it('Can padding', async () => { + it("Can padding", async () => { await testChart.increment(); await testChart.save(); - clock.tick('02:00:00'); + clock.tick("02:00:00"); await testChart.increment(); await testChart.save(); - const chartHours = await testChart.getChart('hour', 3, null); - const chartDays = await testChart.getChart('day', 3, null); + const chartHours = await testChart.getChart("hour", 3, null); + const chartDays = await testChart.getChart("day", 3, null); assert.deepStrictEqual(chartHours, { foo: { @@ -244,14 +244,14 @@ describe('Chart', () => { }); // 要求された範囲にログがひとつもない場合でもパディングできる - it('Can padding from past range', async () => { + it("Can padding from past range", async () => { await testChart.increment(); await testChart.save(); - clock.tick('05:00:00'); + clock.tick("05:00:00"); - const chartHours = await testChart.getChart('hour', 3, null); - const chartDays = await testChart.getChart('day', 3, null); + const chartHours = await testChart.getChart("hour", 3, null); + const chartDays = await testChart.getChart("day", 3, null); assert.deepStrictEqual(chartHours, { foo: { @@ -272,17 +272,17 @@ describe('Chart', () => { // 要求された範囲の最も古い箇所に位置するログが存在しない場合でもパディングできる // Issue #3190 - it('Can padding from past range 2', async () => { + it("Can padding from past range 2", async () => { await testChart.increment(); await testChart.save(); - clock.tick('05:00:00'); + clock.tick("05:00:00"); await testChart.increment(); await testChart.save(); - const chartHours = await testChart.getChart('hour', 3, null); - const chartDays = await testChart.getChart('day', 3, null); + const chartHours = await testChart.getChart("hour", 3, null); + const chartDays = await testChart.getChart("day", 3, null); assert.deepStrictEqual(chartHours, { foo: { @@ -301,17 +301,25 @@ describe('Chart', () => { }); }); - it('Can specify offset', async () => { + it("Can specify offset", async () => { await testChart.increment(); await testChart.save(); - clock.tick('01:00:00'); + clock.tick("01:00:00"); await testChart.increment(); await testChart.save(); - const chartHours = await testChart.getChart('hour', 3, new Date(Date.UTC(2000, 0, 1, 0, 0, 0))); - const chartDays = await testChart.getChart('day', 3, new Date(Date.UTC(2000, 0, 1, 0, 0, 0))); + const chartHours = await testChart.getChart( + "hour", + 3, + new Date(Date.UTC(2000, 0, 1, 0, 0, 0)), + ); + const chartDays = await testChart.getChart( + "day", + 3, + new Date(Date.UTC(2000, 0, 1, 0, 0, 0)), + ); assert.deepStrictEqual(chartHours, { foo: { @@ -330,19 +338,27 @@ describe('Chart', () => { }); }); - it('Can specify offset (floor time)', async () => { - clock.tick('00:30:00'); + it("Can specify offset (floor time)", async () => { + clock.tick("00:30:00"); await testChart.increment(); await testChart.save(); - clock.tick('01:30:00'); + clock.tick("01:30:00"); await testChart.increment(); await testChart.save(); - const chartHours = await testChart.getChart('hour', 3, new Date(Date.UTC(2000, 0, 1, 0, 0, 0))); - const chartDays = await testChart.getChart('day', 3, new Date(Date.UTC(2000, 0, 1, 0, 0, 0))); + const chartHours = await testChart.getChart( + "hour", + 3, + new Date(Date.UTC(2000, 0, 1, 0, 0, 0)), + ); + const chartDays = await testChart.getChart( + "day", + 3, + new Date(Date.UTC(2000, 0, 1, 0, 0, 0)), + ); assert.deepStrictEqual(chartHours, { foo: { @@ -361,15 +377,35 @@ describe('Chart', () => { }); }); - describe('Grouped', () => { - it('Can updates', async () => { - await testGroupedChart.increment('alice'); + describe("Grouped", () => { + it("Can updates", async () => { + await testGroupedChart.increment("alice"); await testGroupedChart.save(); - const aliceChartHours = await testGroupedChart.getChart('hour', 3, null, 'alice'); - const aliceChartDays = await testGroupedChart.getChart('day', 3, null, 'alice'); - const bobChartHours = await testGroupedChart.getChart('hour', 3, null, 'bob'); - const bobChartDays = await testGroupedChart.getChart('day', 3, null, 'bob'); + const aliceChartHours = await testGroupedChart.getChart( + "hour", + 3, + null, + "alice", + ); + const aliceChartDays = await testGroupedChart.getChart( + "day", + 3, + null, + "alice", + ); + const bobChartHours = await testGroupedChart.getChart( + "hour", + 3, + null, + "bob", + ); + const bobChartDays = await testGroupedChart.getChart( + "day", + 3, + null, + "bob", + ); assert.deepStrictEqual(aliceChartHours, { foo: { @@ -405,15 +441,15 @@ describe('Chart', () => { }); }); - describe('Unique increment', () => { - it('Can updates', async () => { - await testUniqueChart.uniqueIncrement('alice'); - await testUniqueChart.uniqueIncrement('alice'); - await testUniqueChart.uniqueIncrement('bob'); + describe("Unique increment", () => { + it("Can updates", async () => { + await testUniqueChart.uniqueIncrement("alice"); + await testUniqueChart.uniqueIncrement("alice"); + await testUniqueChart.uniqueIncrement("bob"); await testUniqueChart.save(); - const chartHours = await testUniqueChart.getChart('hour', 3, null); - const chartDays = await testUniqueChart.getChart('day', 3, null); + const chartHours = await testUniqueChart.getChart("hour", 3, null); + const chartDays = await testUniqueChart.getChart("day", 3, null); assert.deepStrictEqual(chartHours, { foo: [2, 0, 0], @@ -424,22 +460,26 @@ describe('Chart', () => { }); }); - describe('Intersection', () => { - it('条件が満たされていない場合はカウントされない', async () => { - await testIntersectionChart.addA('alice'); - await testIntersectionChart.addA('bob'); - await testIntersectionChart.addB('carol'); + describe("Intersection", () => { + it("条件が満たされていない場合はカウントされない", async () => { + await testIntersectionChart.addA("alice"); + await testIntersectionChart.addA("bob"); + await testIntersectionChart.addB("carol"); await testIntersectionChart.save(); - - const chartHours = await testIntersectionChart.getChart('hour', 3, null); - const chartDays = await testIntersectionChart.getChart('day', 3, null); - + + const chartHours = await testIntersectionChart.getChart( + "hour", + 3, + null, + ); + const chartDays = await testIntersectionChart.getChart("day", 3, null); + assert.deepStrictEqual(chartHours, { a: [2, 0, 0], b: [1, 0, 0], aAndB: [0, 0, 0], }); - + assert.deepStrictEqual(chartDays, { a: [2, 0, 0], b: [1, 0, 0], @@ -447,22 +487,26 @@ describe('Chart', () => { }); }); - it('条件が満たされている場合にカウントされる', async () => { - await testIntersectionChart.addA('alice'); - await testIntersectionChart.addA('bob'); - await testIntersectionChart.addB('carol'); - await testIntersectionChart.addB('alice'); + it("条件が満たされている場合にカウントされる", async () => { + await testIntersectionChart.addA("alice"); + await testIntersectionChart.addA("bob"); + await testIntersectionChart.addB("carol"); + await testIntersectionChart.addB("alice"); await testIntersectionChart.save(); - - const chartHours = await testIntersectionChart.getChart('hour', 3, null); - const chartDays = await testIntersectionChart.getChart('day', 3, null); - + + const chartHours = await testIntersectionChart.getChart( + "hour", + 3, + null, + ); + const chartDays = await testIntersectionChart.getChart("day", 3, null); + assert.deepStrictEqual(chartHours, { a: [2, 0, 0], b: [2, 0, 0], aAndB: [1, 0, 0], }); - + assert.deepStrictEqual(chartDays, { a: [2, 0, 0], b: [2, 0, 0], @@ -472,14 +516,14 @@ describe('Chart', () => { }); }); - describe('Resync', () => { - it('Can resync', async () => { + describe("Resync", () => { + it("Can resync", async () => { testChart.total = 1; await testChart.resync(); - const chartHours = await testChart.getChart('hour', 3, null); - const chartDays = await testChart.getChart('day', 3, null); + const chartHours = await testChart.getChart("hour", 3, null); + const chartDays = await testChart.getChart("day", 3, null); assert.deepStrictEqual(chartHours, { foo: { @@ -498,18 +542,18 @@ describe('Chart', () => { }); }); - it('Can resync (2)', async () => { + it("Can resync (2)", async () => { await testChart.increment(); await testChart.save(); - clock.tick('01:00:00'); + clock.tick("01:00:00"); testChart.total = 100; await testChart.resync(); - const chartHours = await testChart.getChart('hour', 3, null); - const chartDays = await testChart.getChart('day', 3, null); + const chartHours = await testChart.getChart("hour", 3, null); + const chartDays = await testChart.getChart("day", 3, null); assert.deepStrictEqual(chartHours, { foo: { diff --git a/packages/backend/test/extract-mentions.ts b/packages/backend/test/extract-mentions.ts index 85afb098d..f400e1e63 100644 --- a/packages/backend/test/extract-mentions.ts +++ b/packages/backend/test/extract-mentions.ts @@ -1,42 +1,50 @@ -import * as assert from 'assert'; +import * as assert from "assert"; -import { parse } from 'mfm-js'; -import { extractMentions } from '../src/misc/extract-mentions.js'; +import { parse } from "mfm-js"; +import { extractMentions } from "../src/misc/extract-mentions.js"; -describe('Extract mentions', () => { - it('simple', () => { - const ast = parse('@foo @bar @baz')!; +describe("Extract mentions", () => { + it("simple", () => { + const ast = parse("@foo @bar @baz")!; const mentions = extractMentions(ast); - assert.deepStrictEqual(mentions, [{ - username: 'foo', - acct: '@foo', - host: null, - }, { - username: 'bar', - acct: '@bar', - host: null, - }, { - username: 'baz', - acct: '@baz', - host: null, - }]); + assert.deepStrictEqual(mentions, [ + { + username: "foo", + acct: "@foo", + host: null, + }, + { + username: "bar", + acct: "@bar", + host: null, + }, + { + username: "baz", + acct: "@baz", + host: null, + }, + ]); }); - it('nested', () => { - const ast = parse('@foo **@bar** @baz')!; + it("nested", () => { + const ast = parse("@foo **@bar** @baz")!; const mentions = extractMentions(ast); - assert.deepStrictEqual(mentions, [{ - username: 'foo', - acct: '@foo', - host: null, - }, { - username: 'bar', - acct: '@bar', - host: null, - }, { - username: 'baz', - acct: '@baz', - host: null, - }]); + assert.deepStrictEqual(mentions, [ + { + username: "foo", + acct: "@foo", + host: null, + }, + { + username: "bar", + acct: "@bar", + host: null, + }, + { + username: "baz", + acct: "@baz", + host: null, + }, + ]); }); }); diff --git a/packages/backend/test/fetch-resource.ts b/packages/backend/test/fetch-resource.ts index ddb0e94b8..da3116f0e 100644 --- a/packages/backend/test/fetch-resource.ts +++ b/packages/backend/test/fetch-resource.ts @@ -1,22 +1,31 @@ -process.env.NODE_ENV = 'test'; +process.env.NODE_ENV = "test"; -import * as assert from 'assert'; -import * as childProcess from 'child_process'; -import * as openapi from '@redocly/openapi-core'; -import { async, startServer, signup, post, request, simpleGet, port, shutdownServer } from './utils.js'; +import * as assert from "assert"; +import * as childProcess from "child_process"; +import * as openapi from "@redocly/openapi-core"; +import { + async, + startServer, + signup, + post, + request, + simpleGet, + port, + shutdownServer, +} from "./utils.js"; // Request Accept -const ONLY_AP = 'application/activity+json'; -const PREFER_AP = 'application/activity+json, */*'; -const PREFER_HTML = 'text/html, */*'; -const UNSPECIFIED = '*/*'; +const ONLY_AP = "application/activity+json"; +const PREFER_AP = "application/activity+json, */*"; +const PREFER_HTML = "text/html, */*"; +const UNSPECIFIED = "*/*"; // Response Contet-Type -const AP = 'application/activity+json; charset=utf-8'; -const JSON = 'application/json; charset=utf-8'; -const HTML = 'text/html; charset=utf-8'; +const AP = "application/activity+json; charset=utf-8"; +const JSON = "application/json; charset=utf-8"; +const HTML = "text/html; charset=utf-8"; -describe('Fetch resource', () => { +describe("Fetch resource", () => { let p: childProcess.ChildProcess; let alice: any; @@ -24,9 +33,9 @@ describe('Fetch resource', () => { before(async () => { p = await startServer(); - alice = await signup({ username: 'alice' }); + alice = await signup({ username: "alice" }); alicesPost = await post(alice, { - text: 'test', + text: "test", }); }); @@ -34,39 +43,38 @@ describe('Fetch resource', () => { await shutdownServer(p); }); - describe('Common', () => { - it('meta', async(async () => { - const res = await request('/meta', { - }); + describe("Common", () => { + it("meta", async(async () => { + const res = await request("/meta", {}); assert.strictEqual(res.status, 200); })); - it('GET root', async(async () => { - const res = await simpleGet('/'); + it("GET root", async(async () => { + const res = await simpleGet("/"); assert.strictEqual(res.status, 200); assert.strictEqual(res.type, HTML); })); - it('GET docs', async(async () => { - const res = await simpleGet('/docs/ja-JP/about'); + it("GET docs", async(async () => { + const res = await simpleGet("/docs/ja-JP/about"); assert.strictEqual(res.status, 200); assert.strictEqual(res.type, HTML); })); - it('GET api-doc', async(async () => { - const res = await simpleGet('/api-doc'); + it("GET api-doc", async(async () => { + const res = await simpleGet("/api-doc"); assert.strictEqual(res.status, 200); assert.strictEqual(res.type, HTML); })); - it('GET api.json', async(async () => { - const res = await simpleGet('/api.json'); + it("GET api.json", async(async () => { + const res = await simpleGet("/api.json"); assert.strictEqual(res.status, 200); assert.strictEqual(res.type, JSON); })); - it('Validate api.json', async(async () => { + it("Validate api.json", async(async () => { const config = await openapi.loadConfig(); const result = await openapi.bundle({ config, @@ -80,126 +88,126 @@ describe('Fetch resource', () => { assert.strictEqual(result.problems.length, 0); })); - it('GET favicon.ico', async(async () => { - const res = await simpleGet('/favicon.ico'); + it("GET favicon.ico", async(async () => { + const res = await simpleGet("/favicon.ico"); assert.strictEqual(res.status, 200); - assert.strictEqual(res.type, 'image/x-icon'); + assert.strictEqual(res.type, "image/x-icon"); })); - it('GET apple-touch-icon.png', async(async () => { - const res = await simpleGet('/apple-touch-icon.png'); + it("GET apple-touch-icon.png", async(async () => { + const res = await simpleGet("/apple-touch-icon.png"); assert.strictEqual(res.status, 200); - assert.strictEqual(res.type, 'image/png'); + assert.strictEqual(res.type, "image/png"); })); - it('GET twemoji svg', async(async () => { - const res = await simpleGet('/twemoji/2764.svg'); + it("GET twemoji svg", async(async () => { + const res = await simpleGet("/twemoji/2764.svg"); assert.strictEqual(res.status, 200); - assert.strictEqual(res.type, 'image/svg+xml'); + assert.strictEqual(res.type, "image/svg+xml"); })); - it('GET twemoji svg with hyphen', async(async () => { - const res = await simpleGet('/twemoji/2764-fe0f-200d-1f525.svg'); + it("GET twemoji svg with hyphen", async(async () => { + const res = await simpleGet("/twemoji/2764-fe0f-200d-1f525.svg"); assert.strictEqual(res.status, 200); - assert.strictEqual(res.type, 'image/svg+xml'); + assert.strictEqual(res.type, "image/svg+xml"); })); }); - describe('/@:username', () => { - it('Only AP => AP', async(async () => { + describe("/@:username", () => { + it("Only AP => AP", async(async () => { const res = await simpleGet(`/@${alice.username}`, ONLY_AP); assert.strictEqual(res.status, 200); assert.strictEqual(res.type, AP); })); - it('Prefer AP => AP', async(async () => { + it("Prefer AP => AP", async(async () => { const res = await simpleGet(`/@${alice.username}`, PREFER_AP); assert.strictEqual(res.status, 200); assert.strictEqual(res.type, AP); })); - it('Prefer HTML => HTML', async(async () => { + it("Prefer HTML => HTML", async(async () => { const res = await simpleGet(`/@${alice.username}`, PREFER_HTML); assert.strictEqual(res.status, 200); assert.strictEqual(res.type, HTML); })); - it('Unspecified => HTML', async(async () => { + it("Unspecified => HTML", async(async () => { const res = await simpleGet(`/@${alice.username}`, UNSPECIFIED); assert.strictEqual(res.status, 200); assert.strictEqual(res.type, HTML); })); }); - describe('/users/:id', () => { - it('Only AP => AP', async(async () => { + describe("/users/:id", () => { + it("Only AP => AP", async(async () => { const res = await simpleGet(`/users/${alice.id}`, ONLY_AP); assert.strictEqual(res.status, 200); assert.strictEqual(res.type, AP); })); - it('Prefer AP => AP', async(async () => { + it("Prefer AP => AP", async(async () => { const res = await simpleGet(`/users/${alice.id}`, PREFER_AP); assert.strictEqual(res.status, 200); assert.strictEqual(res.type, AP); })); - it('Prefer HTML => Redirect to /@:username', async(async () => { + it("Prefer HTML => Redirect to /@:username", async(async () => { const res = await simpleGet(`/users/${alice.id}`, PREFER_HTML); assert.strictEqual(res.status, 302); assert.strictEqual(res.location, `/@${alice.username}`); })); - it('Undecided => HTML', async(async () => { + it("Undecided => HTML", async(async () => { const res = await simpleGet(`/users/${alice.id}`, UNSPECIFIED); assert.strictEqual(res.status, 302); assert.strictEqual(res.location, `/@${alice.username}`); })); }); - describe('/notes/:id', () => { - it('Only AP => AP', async(async () => { + describe("/notes/:id", () => { + it("Only AP => AP", async(async () => { const res = await simpleGet(`/notes/${alicesPost.id}`, ONLY_AP); assert.strictEqual(res.status, 200); assert.strictEqual(res.type, AP); })); - it('Prefer AP => AP', async(async () => { + it("Prefer AP => AP", async(async () => { const res = await simpleGet(`/notes/${alicesPost.id}`, PREFER_AP); assert.strictEqual(res.status, 200); assert.strictEqual(res.type, AP); })); - it('Prefer HTML => HTML', async(async () => { + it("Prefer HTML => HTML", async(async () => { const res = await simpleGet(`/notes/${alicesPost.id}`, PREFER_HTML); assert.strictEqual(res.status, 200); assert.strictEqual(res.type, HTML); })); - it('Unspecified => HTML', async(async () => { + it("Unspecified => HTML", async(async () => { const res = await simpleGet(`/notes/${alicesPost.id}`, UNSPECIFIED); assert.strictEqual(res.status, 200); assert.strictEqual(res.type, HTML); })); }); - describe('Feeds', () => { - it('RSS', async(async () => { + describe("Feeds", () => { + it("RSS", async(async () => { const res = await simpleGet(`/@${alice.username}.rss`, UNSPECIFIED); assert.strictEqual(res.status, 200); - assert.strictEqual(res.type, 'application/rss+xml; charset=utf-8'); + assert.strictEqual(res.type, "application/rss+xml; charset=utf-8"); })); - it('ATOM', async(async () => { + it("ATOM", async(async () => { const res = await simpleGet(`/@${alice.username}.atom`, UNSPECIFIED); assert.strictEqual(res.status, 200); - assert.strictEqual(res.type, 'application/atom+xml; charset=utf-8'); + assert.strictEqual(res.type, "application/atom+xml; charset=utf-8"); })); - it('JSON', async(async () => { + it("JSON", async(async () => { const res = await simpleGet(`/@${alice.username}.json`, UNSPECIFIED); assert.strictEqual(res.status, 200); - assert.strictEqual(res.type, 'application/json; charset=utf-8'); + assert.strictEqual(res.type, "application/json; charset=utf-8"); })); }); }); diff --git a/packages/backend/test/ff-visibility.ts b/packages/backend/test/ff-visibility.ts index 4f6847be6..f898926d9 100644 --- a/packages/backend/test/ff-visibility.ts +++ b/packages/backend/test/ff-visibility.ts @@ -1,10 +1,20 @@ -process.env.NODE_ENV = 'test'; +process.env.NODE_ENV = "test"; -import * as assert from 'assert'; -import * as childProcess from 'child_process'; -import { async, signup, request, post, react, connectStream, startServer, shutdownServer, simpleGet } from './utils.js'; +import * as assert from "assert"; +import * as childProcess from "child_process"; +import { + async, + signup, + request, + post, + react, + connectStream, + startServer, + shutdownServer, + simpleGet, +} from "./utils.js"; -describe('FF visibility', () => { +describe("FF visibility", () => { let p: childProcess.ChildProcess; let alice: any; @@ -13,152 +23,258 @@ describe('FF visibility', () => { before(async () => { p = await startServer(); - alice = await signup({ username: 'alice' }); - bob = await signup({ username: 'bob' }); - carol = await signup({ username: 'carol' }); + alice = await signup({ username: "alice" }); + bob = await signup({ username: "bob" }); + carol = await signup({ username: "carol" }); }); after(async () => { await shutdownServer(p); }); - it('ffVisibility が public なユーザーのフォロー/フォロワーを誰でも見れる', async(async () => { - await request('/i/update', { - ffVisibility: 'public', - }, alice); - - const followingRes = await request('/users/following', { - userId: alice.id, - }, bob); - const followersRes = await request('/users/followers', { - userId: alice.id, - }, bob); - - assert.strictEqual(followingRes.status, 200); - assert.strictEqual(Array.isArray(followingRes.body), true); - assert.strictEqual(followersRes.status, 200); - assert.strictEqual(Array.isArray(followersRes.body), true); - })); - - it('ffVisibility が followers なユーザーのフォロー/フォロワーを自分で見れる', async(async () => { - await request('/i/update', { - ffVisibility: 'followers', - }, alice); - - const followingRes = await request('/users/following', { - userId: alice.id, - }, alice); - const followersRes = await request('/users/followers', { - userId: alice.id, - }, alice); - - assert.strictEqual(followingRes.status, 200); - assert.strictEqual(Array.isArray(followingRes.body), true); - assert.strictEqual(followersRes.status, 200); - assert.strictEqual(Array.isArray(followersRes.body), true); - })); - - it('ffVisibility が followers なユーザーのフォロー/フォロワーを非フォロワーが見れない', async(async () => { - await request('/i/update', { - ffVisibility: 'followers', - }, alice); - - const followingRes = await request('/users/following', { - userId: alice.id, - }, bob); - const followersRes = await request('/users/followers', { - userId: alice.id, - }, bob); - - assert.strictEqual(followingRes.status, 400); - assert.strictEqual(followersRes.status, 400); - })); - - it('ffVisibility が followers なユーザーのフォロー/フォロワーをフォロワーが見れる', async(async () => { - await request('/i/update', { - ffVisibility: 'followers', - }, alice); - - await request('/following/create', { - userId: alice.id, - }, bob); - - const followingRes = await request('/users/following', { - userId: alice.id, - }, bob); - const followersRes = await request('/users/followers', { - userId: alice.id, - }, bob); - - assert.strictEqual(followingRes.status, 200); - assert.strictEqual(Array.isArray(followingRes.body), true); - assert.strictEqual(followersRes.status, 200); - assert.strictEqual(Array.isArray(followersRes.body), true); - })); - - it('ffVisibility が private なユーザーのフォロー/フォロワーを自分で見れる', async(async () => { - await request('/i/update', { - ffVisibility: 'private', - }, alice); - - const followingRes = await request('/users/following', { - userId: alice.id, - }, alice); - const followersRes = await request('/users/followers', { - userId: alice.id, - }, alice); - - assert.strictEqual(followingRes.status, 200); - assert.strictEqual(Array.isArray(followingRes.body), true); - assert.strictEqual(followersRes.status, 200); - assert.strictEqual(Array.isArray(followersRes.body), true); - })); - - it('ffVisibility が private なユーザーのフォロー/フォロワーを他人が見れない', async(async () => { - await request('/i/update', { - ffVisibility: 'private', - }, alice); - - const followingRes = await request('/users/following', { - userId: alice.id, - }, bob); - const followersRes = await request('/users/followers', { - userId: alice.id, - }, bob); - - assert.strictEqual(followingRes.status, 400); - assert.strictEqual(followersRes.status, 400); - })); - - describe('AP', () => { - it('ffVisibility が public 以外ならばAPからは取得できない', async(async () => { + it("ffVisibility が public なユーザーのフォロー/フォロワーを誰でも見れる", async(async () => { + await request( + "/i/update", { - await request('/i/update', { - ffVisibility: 'public', - }, alice); + ffVisibility: "public", + }, + alice, + ); - const followingRes = await simpleGet(`/users/${alice.id}/following`, 'application/activity+json'); - const followersRes = await simpleGet(`/users/${alice.id}/followers`, 'application/activity+json'); + const followingRes = await request( + "/users/following", + { + userId: alice.id, + }, + bob, + ); + const followersRes = await request( + "/users/followers", + { + userId: alice.id, + }, + bob, + ); + + assert.strictEqual(followingRes.status, 200); + assert.strictEqual(Array.isArray(followingRes.body), true); + assert.strictEqual(followersRes.status, 200); + assert.strictEqual(Array.isArray(followersRes.body), true); + })); + + it("ffVisibility が followers なユーザーのフォロー/フォロワーを自分で見れる", async(async () => { + await request( + "/i/update", + { + ffVisibility: "followers", + }, + alice, + ); + + const followingRes = await request( + "/users/following", + { + userId: alice.id, + }, + alice, + ); + const followersRes = await request( + "/users/followers", + { + userId: alice.id, + }, + alice, + ); + + assert.strictEqual(followingRes.status, 200); + assert.strictEqual(Array.isArray(followingRes.body), true); + assert.strictEqual(followersRes.status, 200); + assert.strictEqual(Array.isArray(followersRes.body), true); + })); + + it("ffVisibility が followers なユーザーのフォロー/フォロワーを非フォロワーが見れない", async(async () => { + await request( + "/i/update", + { + ffVisibility: "followers", + }, + alice, + ); + + const followingRes = await request( + "/users/following", + { + userId: alice.id, + }, + bob, + ); + const followersRes = await request( + "/users/followers", + { + userId: alice.id, + }, + bob, + ); + + assert.strictEqual(followingRes.status, 400); + assert.strictEqual(followersRes.status, 400); + })); + + it("ffVisibility が followers なユーザーのフォロー/フォロワーをフォロワーが見れる", async(async () => { + await request( + "/i/update", + { + ffVisibility: "followers", + }, + alice, + ); + + await request( + "/following/create", + { + userId: alice.id, + }, + bob, + ); + + const followingRes = await request( + "/users/following", + { + userId: alice.id, + }, + bob, + ); + const followersRes = await request( + "/users/followers", + { + userId: alice.id, + }, + bob, + ); + + assert.strictEqual(followingRes.status, 200); + assert.strictEqual(Array.isArray(followingRes.body), true); + assert.strictEqual(followersRes.status, 200); + assert.strictEqual(Array.isArray(followersRes.body), true); + })); + + it("ffVisibility が private なユーザーのフォロー/フォロワーを自分で見れる", async(async () => { + await request( + "/i/update", + { + ffVisibility: "private", + }, + alice, + ); + + const followingRes = await request( + "/users/following", + { + userId: alice.id, + }, + alice, + ); + const followersRes = await request( + "/users/followers", + { + userId: alice.id, + }, + alice, + ); + + assert.strictEqual(followingRes.status, 200); + assert.strictEqual(Array.isArray(followingRes.body), true); + assert.strictEqual(followersRes.status, 200); + assert.strictEqual(Array.isArray(followersRes.body), true); + })); + + it("ffVisibility が private なユーザーのフォロー/フォロワーを他人が見れない", async(async () => { + await request( + "/i/update", + { + ffVisibility: "private", + }, + alice, + ); + + const followingRes = await request( + "/users/following", + { + userId: alice.id, + }, + bob, + ); + const followersRes = await request( + "/users/followers", + { + userId: alice.id, + }, + bob, + ); + + assert.strictEqual(followingRes.status, 400); + assert.strictEqual(followersRes.status, 400); + })); + + describe("AP", () => { + it("ffVisibility が public 以外ならばAPからは取得できない", async(async () => { + { + await request( + "/i/update", + { + ffVisibility: "public", + }, + alice, + ); + + const followingRes = await simpleGet( + `/users/${alice.id}/following`, + "application/activity+json", + ); + const followersRes = await simpleGet( + `/users/${alice.id}/followers`, + "application/activity+json", + ); assert.strictEqual(followingRes.status, 200); assert.strictEqual(followersRes.status, 200); } { - await request('/i/update', { - ffVisibility: 'followers', - }, alice); + await request( + "/i/update", + { + ffVisibility: "followers", + }, + alice, + ); - const followingRes = await simpleGet(`/users/${alice.id}/following`, 'application/activity+json').catch(res => ({ status: res.statusCode })); - const followersRes = await simpleGet(`/users/${alice.id}/followers`, 'application/activity+json').catch(res => ({ status: res.statusCode })); + const followingRes = await simpleGet( + `/users/${alice.id}/following`, + "application/activity+json", + ).catch((res) => ({ status: res.statusCode })); + const followersRes = await simpleGet( + `/users/${alice.id}/followers`, + "application/activity+json", + ).catch((res) => ({ status: res.statusCode })); assert.strictEqual(followingRes.status, 403); assert.strictEqual(followersRes.status, 403); } { - await request('/i/update', { - ffVisibility: 'private', - }, alice); + await request( + "/i/update", + { + ffVisibility: "private", + }, + alice, + ); - const followingRes = await simpleGet(`/users/${alice.id}/following`, 'application/activity+json').catch(res => ({ status: res.statusCode })); - const followersRes = await simpleGet(`/users/${alice.id}/followers`, 'application/activity+json').catch(res => ({ status: res.statusCode })); + const followingRes = await simpleGet( + `/users/${alice.id}/following`, + "application/activity+json", + ).catch((res) => ({ status: res.statusCode })); + const followersRes = await simpleGet( + `/users/${alice.id}/followers`, + "application/activity+json", + ).catch((res) => ({ status: res.statusCode })); assert.strictEqual(followingRes.status, 403); assert.strictEqual(followersRes.status, 403); } diff --git a/packages/backend/test/get-file-info.ts b/packages/backend/test/get-file-info.ts index 09378fec8..22dc28c8e 100644 --- a/packages/backend/test/get-file-info.ts +++ b/packages/backend/test/get-file-info.ts @@ -1,25 +1,27 @@ -import * as assert from 'assert'; -import { fileURLToPath } from 'node:url'; -import { dirname } from 'node:path'; -import { getFileInfo } from '../src/misc/get-file-info.js'; -import { async } from './utils.js'; +import * as assert from "assert"; +import { fileURLToPath } from "node:url"; +import { dirname } from "node:path"; +import { getFileInfo } from "../src/misc/get-file-info.js"; +import { async } from "./utils.js"; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); -describe('Get file info', () => { - it('Empty file', async (async () => { +describe("Get file info", () => { + it("Empty file", async(async () => { const path = `${_dirname}/resources/emptyfile`; - const info = await getFileInfo(path, { skipSensitiveDetection: true }) as any; + const info = (await getFileInfo(path, { + skipSensitiveDetection: true, + })) as any; delete info.warnings; delete info.blurhash; delete info.sensitive; delete info.porn; assert.deepStrictEqual(info, { size: 0, - md5: 'd41d8cd98f00b204e9800998ecf8427e', + md5: "d41d8cd98f00b204e9800998ecf8427e", type: { - mime: 'application/octet-stream', + mime: "application/octet-stream", ext: null, }, width: undefined, @@ -28,19 +30,21 @@ describe('Get file info', () => { }); })); - it('Generic JPEG', async (async () => { + it("Generic JPEG", async(async () => { const path = `${_dirname}/resources/Lenna.jpg`; - const info = await getFileInfo(path, { skipSensitiveDetection: true }) as any; + const info = (await getFileInfo(path, { + skipSensitiveDetection: true, + })) as any; delete info.warnings; delete info.blurhash; delete info.sensitive; delete info.porn; assert.deepStrictEqual(info, { size: 25360, - md5: '091b3f259662aa31e2ffef4519951168', + md5: "091b3f259662aa31e2ffef4519951168", type: { - mime: 'image/jpeg', - ext: 'jpg', + mime: "image/jpeg", + ext: "jpg", }, width: 512, height: 512, @@ -48,19 +52,21 @@ describe('Get file info', () => { }); })); - it('Generic APNG', async (async () => { + it("Generic APNG", async(async () => { const path = `${_dirname}/resources/anime.png`; - const info = await getFileInfo(path, { skipSensitiveDetection: true }) as any; + const info = (await getFileInfo(path, { + skipSensitiveDetection: true, + })) as any; delete info.warnings; delete info.blurhash; delete info.sensitive; delete info.porn; assert.deepStrictEqual(info, { size: 1868, - md5: '08189c607bea3b952704676bb3c979e0', + md5: "08189c607bea3b952704676bb3c979e0", type: { - mime: 'image/apng', - ext: 'apng', + mime: "image/apng", + ext: "apng", }, width: 256, height: 256, @@ -68,19 +74,21 @@ describe('Get file info', () => { }); })); - it('Generic AGIF', async (async () => { + it("Generic AGIF", async(async () => { const path = `${_dirname}/resources/anime.gif`; - const info = await getFileInfo(path, { skipSensitiveDetection: true }) as any; + const info = (await getFileInfo(path, { + skipSensitiveDetection: true, + })) as any; delete info.warnings; delete info.blurhash; delete info.sensitive; delete info.porn; assert.deepStrictEqual(info, { size: 2248, - md5: '32c47a11555675d9267aee1a86571e7e', + md5: "32c47a11555675d9267aee1a86571e7e", type: { - mime: 'image/gif', - ext: 'gif', + mime: "image/gif", + ext: "gif", }, width: 256, height: 256, @@ -88,19 +96,21 @@ describe('Get file info', () => { }); })); - it('PNG with alpha', async (async () => { + it("PNG with alpha", async(async () => { const path = `${_dirname}/resources/with-alpha.png`; - const info = await getFileInfo(path, { skipSensitiveDetection: true }) as any; + const info = (await getFileInfo(path, { + skipSensitiveDetection: true, + })) as any; delete info.warnings; delete info.blurhash; delete info.sensitive; delete info.porn; assert.deepStrictEqual(info, { size: 3772, - md5: 'f73535c3e1e27508885b69b10cf6e991', + md5: "f73535c3e1e27508885b69b10cf6e991", type: { - mime: 'image/png', - ext: 'png', + mime: "image/png", + ext: "png", }, width: 256, height: 256, @@ -108,19 +118,21 @@ describe('Get file info', () => { }); })); - it('Generic SVG', async (async () => { + it("Generic SVG", async(async () => { const path = `${_dirname}/resources/image.svg`; - const info = await getFileInfo(path, { skipSensitiveDetection: true }) as any; + const info = (await getFileInfo(path, { + skipSensitiveDetection: true, + })) as any; delete info.warnings; delete info.blurhash; delete info.sensitive; delete info.porn; assert.deepStrictEqual(info, { size: 505, - md5: 'b6f52b4b021e7b92cdd04509c7267965', + md5: "b6f52b4b021e7b92cdd04509c7267965", type: { - mime: 'image/svg+xml', - ext: 'svg', + mime: "image/svg+xml", + ext: "svg", }, width: 256, height: 256, @@ -128,20 +140,22 @@ describe('Get file info', () => { }); })); - it('SVG with XML definition', async (async () => { + it("SVG with XML definition", async(async () => { // https://github.com/misskey-dev/misskey/issues/4413 const path = `${_dirname}/resources/with-xml-def.svg`; - const info = await getFileInfo(path, { skipSensitiveDetection: true }) as any; + const info = (await getFileInfo(path, { + skipSensitiveDetection: true, + })) as any; delete info.warnings; delete info.blurhash; delete info.sensitive; delete info.porn; assert.deepStrictEqual(info, { size: 544, - md5: '4b7a346cde9ccbeb267e812567e33397', + md5: "4b7a346cde9ccbeb267e812567e33397", type: { - mime: 'image/svg+xml', - ext: 'svg', + mime: "image/svg+xml", + ext: "svg", }, width: 256, height: 256, @@ -149,18 +163,20 @@ describe('Get file info', () => { }); })); - it('Dimension limit', async (async () => { + it("Dimension limit", async(async () => { const path = `${_dirname}/resources/25000x25000.png`; - const info = await getFileInfo(path, { skipSensitiveDetection: true }) as any; + const info = (await getFileInfo(path, { + skipSensitiveDetection: true, + })) as any; delete info.warnings; delete info.blurhash; delete info.sensitive; delete info.porn; assert.deepStrictEqual(info, { size: 75933, - md5: '268c5dde99e17cf8fe09f1ab3f97df56', + md5: "268c5dde99e17cf8fe09f1ab3f97df56", type: { - mime: 'application/octet-stream', // do not treat as image + mime: "application/octet-stream", // do not treat as image ext: null, }, width: 25000, @@ -169,19 +185,21 @@ describe('Get file info', () => { }); })); - it('Rotate JPEG', async (async () => { + it("Rotate JPEG", async(async () => { const path = `${_dirname}/resources/rotate.jpg`; - const info = await getFileInfo(path, { skipSensitiveDetection: true }) as any; + const info = (await getFileInfo(path, { + skipSensitiveDetection: true, + })) as any; delete info.warnings; delete info.blurhash; delete info.sensitive; delete info.porn; assert.deepStrictEqual(info, { size: 12624, - md5: '68d5b2d8d1d1acbbce99203e3ec3857e', + md5: "68d5b2d8d1d1acbbce99203e3ec3857e", type: { - mime: 'image/jpeg', - ext: 'jpg', + mime: "image/jpeg", + ext: "jpg", }, width: 512, height: 256, diff --git a/packages/backend/test/loader.js b/packages/backend/test/loader.js index 6b21587e3..7e1bf379d 100644 --- a/packages/backend/test/loader.js +++ b/packages/backend/test/loader.js @@ -6,18 +6,21 @@ * ※ https://github.com/TypeStrong/ts-node/pull/1585 が取り込まれたらこのカスタムローダーは必要なくなる */ -import { resolve as resolveTs, load } from 'ts-node/esm'; -import { loadConfig, createMatchPath } from 'tsconfig-paths'; -import { pathToFileURL } from 'url'; +import { resolve as resolveTs, load } from "ts-node/esm"; +import { loadConfig, createMatchPath } from "tsconfig-paths"; +import { pathToFileURL } from "url"; const tsconfig = loadConfig(); const matchPath = createMatchPath(tsconfig.absoluteBaseUrl, tsconfig.paths); export function resolve(specifier, ctx, defaultResolve) { let resolvedSpecifier; - if (specifier.endsWith('.js')) { + if (specifier.endsWith(".js")) { // maybe transpiled - const specifierWithoutExtension = specifier.substring(0, specifier.length - '.js'.length); + const specifierWithoutExtension = specifier.substring( + 0, + specifier.length - ".js".length, + ); const matchedSpecifier = matchPath(specifierWithoutExtension); if (matchedSpecifier) { resolvedSpecifier = pathToFileURL(`${matchedSpecifier}.js`).href; diff --git a/packages/backend/test/mfm.ts b/packages/backend/test/mfm.ts index 5218942a5..605daa710 100644 --- a/packages/backend/test/mfm.ts +++ b/packages/backend/test/mfm.ts @@ -1,89 +1,127 @@ -import * as assert from 'assert'; -import * as mfm from 'mfm-js'; +import * as assert from "assert"; +import * as mfm from "mfm-js"; -import { toHtml } from '../src/mfm/to-html.js'; -import { fromHtml } from '../src/mfm/from-html.js'; +import { toHtml } from "../src/mfm/to-html.js"; +import { fromHtml } from "../src/mfm/from-html.js"; -describe('toHtml', () => { - it('br', () => { - const input = 'foo\nbar\nbaz'; - const output = '

foo
bar
baz

'; +describe("toHtml", () => { + it("br", () => { + const input = "foo\nbar\nbaz"; + const output = "

foo
bar
baz

"; assert.equal(toHtml(mfm.parse(input)), output); }); - it('br alt', () => { - const input = 'foo\r\nbar\rbaz'; - const output = '

foo
bar
baz

'; + it("br alt", () => { + const input = "foo\r\nbar\rbaz"; + const output = "

foo
bar
baz

"; assert.equal(toHtml(mfm.parse(input)), output); }); }); -describe('fromHtml', () => { - it('p', () => { - assert.deepStrictEqual(fromHtml('

a

b

'), 'a\n\nb'); +describe("fromHtml", () => { + it("p", () => { + assert.deepStrictEqual(fromHtml("

a

b

"), "a\n\nb"); }); - it('block element', () => { - assert.deepStrictEqual(fromHtml('
a
b
'), 'a\nb'); + it("block element", () => { + assert.deepStrictEqual(fromHtml("
a
b
"), "a\nb"); }); - it('inline element', () => { - assert.deepStrictEqual(fromHtml(''), 'a\nb'); + it("inline element", () => { + assert.deepStrictEqual(fromHtml(""), "a\nb"); }); - it('block code', () => { - assert.deepStrictEqual(fromHtml('
a\nb
'), '```\na\nb\n```'); + it("block code", () => { + assert.deepStrictEqual( + fromHtml("
a\nb
"), + "```\na\nb\n```", + ); }); - it('inline code', () => { - assert.deepStrictEqual(fromHtml('a'), '`a`'); + it("inline code", () => { + assert.deepStrictEqual(fromHtml("a"), "`a`"); }); - it('quote', () => { - assert.deepStrictEqual(fromHtml('
a\nb
'), '> a\n> b'); + it("quote", () => { + assert.deepStrictEqual( + fromHtml("
a\nb
"), + "> a\n> b", + ); }); - it('br', () => { - assert.deepStrictEqual(fromHtml('

abc

d

'), 'abc\n\nd'); + it("br", () => { + assert.deepStrictEqual(fromHtml("

abc

d

"), "abc\n\nd"); }); - it('link with different text', () => { - assert.deepStrictEqual(fromHtml('

a c d

'), 'a [c](https://example.com/b) d'); + it("link with different text", () => { + assert.deepStrictEqual( + fromHtml('

a c d

'), + "a [c](https://example.com/b) d", + ); }); - it('link with different text, but not encoded', () => { - assert.deepStrictEqual(fromHtml('

a c d

'), 'a [c]() d'); + it("link with different text, but not encoded", () => { + assert.deepStrictEqual( + fromHtml('

a c d

'), + "a [c]() d", + ); }); - it('link with same text', () => { - assert.deepStrictEqual(fromHtml('

a https://example.com/b d

'), 'a https://example.com/b d'); + it("link with same text", () => { + assert.deepStrictEqual( + fromHtml( + '

a https://example.com/b d

', + ), + "a https://example.com/b d", + ); }); - it('link with same text, but not encoded', () => { - assert.deepStrictEqual(fromHtml('

a https://example.com/ä d

'), 'a d'); + it("link with same text, but not encoded", () => { + assert.deepStrictEqual( + fromHtml( + '

a https://example.com/ä d

', + ), + "a d", + ); }); - it('link with no url', () => { - assert.deepStrictEqual(fromHtml('

a c d

'), 'a [c](b) d'); + it("link with no url", () => { + assert.deepStrictEqual( + fromHtml('

a c d

'), + "a [c](b) d", + ); }); - it('link without href', () => { - assert.deepStrictEqual(fromHtml('

a c d

'), 'a c d'); + it("link without href", () => { + assert.deepStrictEqual(fromHtml("

a c d

"), "a c d"); }); - it('link without text', () => { - assert.deepStrictEqual(fromHtml('

a d

'), 'a https://example.com/b d'); + it("link without text", () => { + assert.deepStrictEqual( + fromHtml('

a d

'), + "a https://example.com/b d", + ); }); - it('link without both', () => { - assert.deepStrictEqual(fromHtml('

a d

'), 'a d'); + it("link without both", () => { + assert.deepStrictEqual(fromHtml("

a d

"), "a d"); }); - it('mention', () => { - assert.deepStrictEqual(fromHtml('

a @user d

'), 'a @user@example.com d'); + it("mention", () => { + assert.deepStrictEqual( + fromHtml( + '

a @user d

', + ), + "a @user@example.com d", + ); }); - it('hashtag', () => { - assert.deepStrictEqual(fromHtml('

a #a d

', ['#a']), 'a #a d'); + it("hashtag", () => { + assert.deepStrictEqual( + fromHtml('

a #a d

', [ + "#a", + ]), + "a #a d", + ); }); }); diff --git a/packages/backend/test/misc/mock-resolver.ts b/packages/backend/test/misc/mock-resolver.ts index ba89ac329..74c67e3d3 100644 --- a/packages/backend/test/misc/mock-resolver.ts +++ b/packages/backend/test/misc/mock-resolver.ts @@ -1,5 +1,5 @@ -import Resolver from '../../src/remote/activitypub/resolver.js'; -import { IObject } from '../../src/remote/activitypub/type.js'; +import Resolver from "../../src/remote/activitypub/resolver.js"; +import { IObject } from "../../src/remote/activitypub/type.js"; type MockResponse = { type: string; @@ -8,23 +8,27 @@ type MockResponse = { export class MockResolver extends Resolver { private _rs = new Map(); - public async _register(uri: string, content: string | Record, type = 'application/activity+json') { + public async _register( + uri: string, + content: string | Record, + type = "application/activity+json", + ) { this._rs.set(uri, { type, - content: typeof content === 'string' ? content : JSON.stringify(content), + content: typeof content === "string" ? content : JSON.stringify(content), }); } public async resolve(value: string | IObject): Promise { - if (typeof value !== 'string') return value; + if (typeof value !== "string") return value; const r = this._rs.get(value); if (!r) { throw { - name: 'StatusError', + name: "StatusError", statusCode: 404, - message: 'Not registed for mock', + message: "Not registed for mock", }; } diff --git a/packages/backend/test/mute.ts b/packages/backend/test/mute.ts index 465633973..c51162834 100644 --- a/packages/backend/test/mute.ts +++ b/packages/backend/test/mute.ts @@ -1,10 +1,19 @@ -process.env.NODE_ENV = 'test'; +process.env.NODE_ENV = "test"; -import * as assert from 'assert'; -import * as childProcess from 'child_process'; -import { async, signup, request, post, react, startServer, shutdownServer, waitFire } from './utils.js'; +import * as assert from "assert"; +import * as childProcess from "child_process"; +import { + async, + signup, + request, + post, + react, + startServer, + shutdownServer, + waitFire, +} from "./utils.js"; -describe('Mute', () => { +describe("Mute", () => { let p: childProcess.ChildProcess; // alice mutes carol @@ -14,110 +23,154 @@ describe('Mute', () => { before(async () => { p = await startServer(); - alice = await signup({ username: 'alice' }); - bob = await signup({ username: 'bob' }); - carol = await signup({ username: 'carol' }); + alice = await signup({ username: "alice" }); + bob = await signup({ username: "bob" }); + carol = await signup({ username: "carol" }); }); after(async () => { await shutdownServer(p); }); - it('ミュート作成', async(async () => { - const res = await request('/mute/create', { - userId: carol.id, - }, alice); + it("ミュート作成", async(async () => { + const res = await request( + "/mute/create", + { + userId: carol.id, + }, + alice, + ); assert.strictEqual(res.status, 204); })); - it('「自分宛ての投稿」にミュートしているユーザーの投稿が含まれない', async(async () => { - const bobNote = await post(bob, { text: '@alice hi' }); - const carolNote = await post(carol, { text: '@alice hi' }); + it("「自分宛ての投稿」にミュートしているユーザーの投稿が含まれない", async(async () => { + const bobNote = await post(bob, { text: "@alice hi" }); + const carolNote = await post(carol, { text: "@alice hi" }); - const res = await request('/notes/mentions', {}, alice); + const res = await request("/notes/mentions", {}, alice); assert.strictEqual(res.status, 200); assert.strictEqual(Array.isArray(res.body), true); - assert.strictEqual(res.body.some((note: any) => note.id === bobNote.id), true); - assert.strictEqual(res.body.some((note: any) => note.id === carolNote.id), false); + assert.strictEqual( + res.body.some((note: any) => note.id === bobNote.id), + true, + ); + assert.strictEqual( + res.body.some((note: any) => note.id === carolNote.id), + false, + ); })); - it('ミュートしているユーザーからメンションされても、hasUnreadMentions が true にならない', async(async () => { + it("ミュートしているユーザーからメンションされても、hasUnreadMentions が true にならない", async(async () => { // 状態リセット - await request('/i/read-all-unread-notes', {}, alice); + await request("/i/read-all-unread-notes", {}, alice); - await post(carol, { text: '@alice hi' }); + await post(carol, { text: "@alice hi" }); - const res = await request('/i', {}, alice); + const res = await request("/i", {}, alice); assert.strictEqual(res.status, 200); assert.strictEqual(res.body.hasUnreadMentions, false); })); - it('ミュートしているユーザーからメンションされても、ストリームに unreadMention イベントが流れてこない', async () => { + it("ミュートしているユーザーからメンションされても、ストリームに unreadMention イベントが流れてこない", async () => { // 状態リセット - await request('/i/read-all-unread-notes', {}, alice); + await request("/i/read-all-unread-notes", {}, alice); - const fired = await waitFire(alice, 'main', () => post(carol, { text: '@alice hi' }), msg => msg.type === 'unreadMention'); + const fired = await waitFire( + alice, + "main", + () => post(carol, { text: "@alice hi" }), + (msg) => msg.type === "unreadMention", + ); assert.strictEqual(fired, false); }); - it('ミュートしているユーザーからメンションされても、ストリームに unreadNotification イベントが流れてこない', async () => { + it("ミュートしているユーザーからメンションされても、ストリームに unreadNotification イベントが流れてこない", async () => { // 状態リセット - await request('/i/read-all-unread-notes', {}, alice); - await request('/notifications/mark-all-as-read', {}, alice); + await request("/i/read-all-unread-notes", {}, alice); + await request("/notifications/mark-all-as-read", {}, alice); - const fired = await waitFire(alice, 'main', () => post(carol, { text: '@alice hi' }), msg => msg.type === 'unreadNotification'); + const fired = await waitFire( + alice, + "main", + () => post(carol, { text: "@alice hi" }), + (msg) => msg.type === "unreadNotification", + ); assert.strictEqual(fired, false); }); - describe('Timeline', () => { - it('タイムラインにミュートしているユーザーの投稿が含まれない', async(async () => { + describe("Timeline", () => { + it("タイムラインにミュートしているユーザーの投稿が含まれない", async(async () => { const aliceNote = await post(alice); const bobNote = await post(bob); const carolNote = await post(carol); - const res = await request('/notes/local-timeline', {}, alice); + const res = await request("/notes/local-timeline", {}, alice); assert.strictEqual(res.status, 200); assert.strictEqual(Array.isArray(res.body), true); - assert.strictEqual(res.body.some((note: any) => note.id === aliceNote.id), true); - assert.strictEqual(res.body.some((note: any) => note.id === bobNote.id), true); - assert.strictEqual(res.body.some((note: any) => note.id === carolNote.id), false); + assert.strictEqual( + res.body.some((note: any) => note.id === aliceNote.id), + true, + ); + assert.strictEqual( + res.body.some((note: any) => note.id === bobNote.id), + true, + ); + assert.strictEqual( + res.body.some((note: any) => note.id === carolNote.id), + false, + ); })); - it('タイムラインにミュートしているユーザーの投稿のRenoteが含まれない', async(async () => { + it("タイムラインにミュートしているユーザーの投稿のRenoteが含まれない", async(async () => { const aliceNote = await post(alice); const carolNote = await post(carol); const bobNote = await post(bob, { renoteId: carolNote.id, }); - const res = await request('/notes/local-timeline', {}, alice); + const res = await request("/notes/local-timeline", {}, alice); assert.strictEqual(res.status, 200); assert.strictEqual(Array.isArray(res.body), true); - assert.strictEqual(res.body.some((note: any) => note.id === aliceNote.id), true); - assert.strictEqual(res.body.some((note: any) => note.id === bobNote.id), false); - assert.strictEqual(res.body.some((note: any) => note.id === carolNote.id), false); + assert.strictEqual( + res.body.some((note: any) => note.id === aliceNote.id), + true, + ); + assert.strictEqual( + res.body.some((note: any) => note.id === bobNote.id), + false, + ); + assert.strictEqual( + res.body.some((note: any) => note.id === carolNote.id), + false, + ); })); }); - describe('Notification', () => { - it('通知にミュートしているユーザーの通知が含まれない(リアクション)', async(async () => { + describe("Notification", () => { + it("通知にミュートしているユーザーの通知が含まれない(リアクション)", async(async () => { const aliceNote = await post(alice); - await react(bob, aliceNote, 'like'); - await react(carol, aliceNote, 'like'); + await react(bob, aliceNote, "like"); + await react(carol, aliceNote, "like"); - const res = await request('/i/notifications', {}, alice); + const res = await request("/i/notifications", {}, alice); assert.strictEqual(res.status, 200); assert.strictEqual(Array.isArray(res.body), true); - assert.strictEqual(res.body.some((notification: any) => notification.userId === bob.id), true); - assert.strictEqual(res.body.some((notification: any) => notification.userId === carol.id), false); + assert.strictEqual( + res.body.some((notification: any) => notification.userId === bob.id), + true, + ); + assert.strictEqual( + res.body.some((notification: any) => notification.userId === carol.id), + false, + ); })); }); }); diff --git a/packages/backend/test/note.ts b/packages/backend/test/note.ts index b495d8b7b..3af4b88d8 100644 --- a/packages/backend/test/note.ts +++ b/packages/backend/test/note.ts @@ -1,11 +1,21 @@ -process.env.NODE_ENV = 'test'; +process.env.NODE_ENV = "test"; -import * as assert from 'assert'; -import * as childProcess from 'child_process'; -import { Note } from '../src/models/entities/note.js'; -import { async, signup, request, post, uploadUrl, startServer, shutdownServer, initTestDb, api } from './utils.js'; +import * as assert from "assert"; +import * as childProcess from "child_process"; +import { Note } from "../src/models/entities/note.js"; +import { + async, + signup, + request, + post, + uploadUrl, + startServer, + shutdownServer, + initTestDb, + api, +} from "./utils.js"; -describe('Note', () => { +describe("Note", () => { let p: childProcess.ChildProcess; let Notes: any; @@ -16,351 +26,488 @@ describe('Note', () => { p = await startServer(); const connection = await initTestDb(true); Notes = connection.getRepository(Note); - alice = await signup({ username: 'alice' }); - bob = await signup({ username: 'bob' }); + alice = await signup({ username: "alice" }); + bob = await signup({ username: "bob" }); }); after(async () => { await shutdownServer(p); }); - it('投稿できる', async(async () => { + it("投稿できる", async(async () => { const post = { - text: 'test', + text: "test", }; - const res = await request('/notes/create', post, alice); + const res = await request("/notes/create", post, alice); assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual( + typeof res.body === "object" && !Array.isArray(res.body), + true, + ); assert.strictEqual(res.body.createdNote.text, post.text); })); - it('ファイルを添付できる', async(async () => { - const file = await uploadUrl(alice, 'https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/Lenna.jpg'); + it("ファイルを添付できる", async(async () => { + const file = await uploadUrl( + alice, + "https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/Lenna.jpg", + ); - const res = await request('/notes/create', { - fileIds: [file.id], - }, alice); + const res = await request( + "/notes/create", + { + fileIds: [file.id], + }, + alice, + ); assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual( + typeof res.body === "object" && !Array.isArray(res.body), + true, + ); assert.deepStrictEqual(res.body.createdNote.fileIds, [file.id]); })); - it('他人のファイルは無視', async(async () => { - const file = await uploadUrl(bob, 'https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/Lenna.jpg'); + it("他人のファイルは無視", async(async () => { + const file = await uploadUrl( + bob, + "https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/Lenna.jpg", + ); - const res = await request('/notes/create', { - text: 'test', - fileIds: [file.id], - }, alice); + const res = await request( + "/notes/create", + { + text: "test", + fileIds: [file.id], + }, + alice, + ); assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual( + typeof res.body === "object" && !Array.isArray(res.body), + true, + ); assert.deepStrictEqual(res.body.createdNote.fileIds, []); })); - it('存在しないファイルは無視', async(async () => { - const res = await request('/notes/create', { - text: 'test', - fileIds: ['000000000000000000000000'], - }, alice); + it("存在しないファイルは無視", async(async () => { + const res = await request( + "/notes/create", + { + text: "test", + fileIds: ["000000000000000000000000"], + }, + alice, + ); assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual( + typeof res.body === "object" && !Array.isArray(res.body), + true, + ); assert.deepStrictEqual(res.body.createdNote.fileIds, []); })); - it('不正なファイルIDは無視', async(async () => { - const res = await request('/notes/create', { - fileIds: ['kyoppie'], - }, alice); + it("不正なファイルIDは無視", async(async () => { + const res = await request( + "/notes/create", + { + fileIds: ["kyoppie"], + }, + alice, + ); assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual( + typeof res.body === "object" && !Array.isArray(res.body), + true, + ); assert.deepStrictEqual(res.body.createdNote.fileIds, []); })); - it('返信できる', async(async () => { + it("返信できる", async(async () => { const bobPost = await post(bob, { - text: 'foo', + text: "foo", }); const alicePost = { - text: 'bar', + text: "bar", replyId: bobPost.id, }; - const res = await request('/notes/create', alicePost, alice); + const res = await request("/notes/create", alicePost, alice); assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual( + typeof res.body === "object" && !Array.isArray(res.body), + true, + ); assert.strictEqual(res.body.createdNote.text, alicePost.text); assert.strictEqual(res.body.createdNote.replyId, alicePost.replyId); assert.strictEqual(res.body.createdNote.reply.text, bobPost.text); })); - it('renoteできる', async(async () => { + it("renoteできる", async(async () => { const bobPost = await post(bob, { - text: 'test', + text: "test", }); const alicePost = { renoteId: bobPost.id, }; - const res = await request('/notes/create', alicePost, alice); + const res = await request("/notes/create", alicePost, alice); assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual( + typeof res.body === "object" && !Array.isArray(res.body), + true, + ); assert.strictEqual(res.body.createdNote.renoteId, alicePost.renoteId); assert.strictEqual(res.body.createdNote.renote.text, bobPost.text); })); - it('引用renoteできる', async(async () => { + it("引用renoteできる", async(async () => { const bobPost = await post(bob, { - text: 'test', + text: "test", }); const alicePost = { - text: 'test', + text: "test", renoteId: bobPost.id, }; - const res = await request('/notes/create', alicePost, alice); + const res = await request("/notes/create", alicePost, alice); assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual( + typeof res.body === "object" && !Array.isArray(res.body), + true, + ); assert.strictEqual(res.body.createdNote.text, alicePost.text); assert.strictEqual(res.body.createdNote.renoteId, alicePost.renoteId); assert.strictEqual(res.body.createdNote.renote.text, bobPost.text); })); - it('文字数ぎりぎりで怒られない', async(async () => { + it("文字数ぎりぎりで怒られない", async(async () => { const post = { - text: '!'.repeat(3000), + text: "!".repeat(3000), }; - const res = await request('/notes/create', post, alice); + const res = await request("/notes/create", post, alice); assert.strictEqual(res.status, 200); })); - it('文字数オーバーで怒られる', async(async () => { + it("文字数オーバーで怒られる", async(async () => { const post = { - text: '!'.repeat(3001), + text: "!".repeat(3001), }; - const res = await request('/notes/create', post, alice); + const res = await request("/notes/create", post, alice); assert.strictEqual(res.status, 400); })); - it('存在しないリプライ先で怒られる', async(async () => { + it("存在しないリプライ先で怒られる", async(async () => { const post = { - text: 'test', - replyId: '000000000000000000000000', + text: "test", + replyId: "000000000000000000000000", }; - const res = await request('/notes/create', post, alice); + const res = await request("/notes/create", post, alice); assert.strictEqual(res.status, 400); })); - it('存在しないrenote対象で怒られる', async(async () => { + it("存在しないrenote対象で怒られる", async(async () => { const post = { - renoteId: '000000000000000000000000', + renoteId: "000000000000000000000000", }; - const res = await request('/notes/create', post, alice); + const res = await request("/notes/create", post, alice); assert.strictEqual(res.status, 400); })); - it('不正なリプライ先IDで怒られる', async(async () => { + it("不正なリプライ先IDで怒られる", async(async () => { const post = { - text: 'test', - replyId: 'foo', + text: "test", + replyId: "foo", }; - const res = await request('/notes/create', post, alice); + const res = await request("/notes/create", post, alice); assert.strictEqual(res.status, 400); })); - it('不正なrenote対象IDで怒られる', async(async () => { + it("不正なrenote対象IDで怒られる", async(async () => { const post = { - renoteId: 'foo', + renoteId: "foo", }; - const res = await request('/notes/create', post, alice); + const res = await request("/notes/create", post, alice); assert.strictEqual(res.status, 400); })); - it('存在しないユーザーにメンションできる', async(async () => { + it("存在しないユーザーにメンションできる", async(async () => { const post = { - text: '@ghost yo', + text: "@ghost yo", }; - const res = await request('/notes/create', post, alice); + const res = await request("/notes/create", post, alice); assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual( + typeof res.body === "object" && !Array.isArray(res.body), + true, + ); assert.strictEqual(res.body.createdNote.text, post.text); })); - it('同じユーザーに複数メンションしても内部的にまとめられる', async(async () => { + it("同じユーザーに複数メンションしても内部的にまとめられる", async(async () => { const post = { - text: '@bob @bob @bob yo', + text: "@bob @bob @bob yo", }; - const res = await request('/notes/create', post, alice); + const res = await request("/notes/create", post, alice); assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual( + typeof res.body === "object" && !Array.isArray(res.body), + true, + ); assert.strictEqual(res.body.createdNote.text, post.text); const noteDoc = await Notes.findOneBy({ id: res.body.createdNote.id }); assert.deepStrictEqual(noteDoc.mentions, [bob.id]); })); - describe('notes/create', () => { - it('投票を添付できる', async(async () => { - const res = await request('/notes/create', { - text: 'test', - poll: { - choices: ['foo', 'bar'], + describe("notes/create", () => { + it("投票を添付できる", async(async () => { + const res = await request( + "/notes/create", + { + text: "test", + poll: { + choices: ["foo", "bar"], + }, }, - }, alice); + alice, + ); assert.strictEqual(res.status, 200); - assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true); + assert.strictEqual( + typeof res.body === "object" && !Array.isArray(res.body), + true, + ); assert.strictEqual(res.body.createdNote.poll != null, true); })); - it('投票の選択肢が無くて怒られる', async(async () => { - const res = await request('/notes/create', { - poll: {}, - }, alice); + it("投票の選択肢が無くて怒られる", async(async () => { + const res = await request( + "/notes/create", + { + poll: {}, + }, + alice, + ); assert.strictEqual(res.status, 400); })); - it('投票の選択肢が無くて怒られる (空の配列)', async(async () => { - const res = await request('/notes/create', { - poll: { - choices: [], + it("投票の選択肢が無くて怒られる (空の配列)", async(async () => { + const res = await request( + "/notes/create", + { + poll: { + choices: [], + }, }, - }, alice); + alice, + ); assert.strictEqual(res.status, 400); })); - it('投票の選択肢が1つで怒られる', async(async () => { - const res = await request('/notes/create', { - poll: { - choices: ['Strawberry Pasta'], + it("投票の選択肢が1つで怒られる", async(async () => { + const res = await request( + "/notes/create", + { + poll: { + choices: ["Strawberry Pasta"], + }, }, - }, alice); + alice, + ); assert.strictEqual(res.status, 400); })); - it('投票できる', async(async () => { - const { body } = await request('/notes/create', { - text: 'test', - poll: { - choices: ['sakura', 'izumi', 'ako'], + it("投票できる", async(async () => { + const { body } = await request( + "/notes/create", + { + text: "test", + poll: { + choices: ["sakura", "izumi", "ako"], + }, }, - }, alice); + alice, + ); - const res = await request('/notes/polls/vote', { - noteId: body.createdNote.id, - choice: 1, - }, alice); + const res = await request( + "/notes/polls/vote", + { + noteId: body.createdNote.id, + choice: 1, + }, + alice, + ); assert.strictEqual(res.status, 204); })); - it('複数投票できない', async(async () => { - const { body } = await request('/notes/create', { - text: 'test', - poll: { - choices: ['sakura', 'izumi', 'ako'], + it("複数投票できない", async(async () => { + const { body } = await request( + "/notes/create", + { + text: "test", + poll: { + choices: ["sakura", "izumi", "ako"], + }, }, - }, alice); + alice, + ); - await request('/notes/polls/vote', { - noteId: body.createdNote.id, - choice: 0, - }, alice); + await request( + "/notes/polls/vote", + { + noteId: body.createdNote.id, + choice: 0, + }, + alice, + ); - const res = await request('/notes/polls/vote', { - noteId: body.createdNote.id, - choice: 2, - }, alice); + const res = await request( + "/notes/polls/vote", + { + noteId: body.createdNote.id, + choice: 2, + }, + alice, + ); assert.strictEqual(res.status, 400); })); - it('許可されている場合は複数投票できる', async(async () => { - const { body } = await request('/notes/create', { - text: 'test', - poll: { - choices: ['sakura', 'izumi', 'ako'], - multiple: true, + it("許可されている場合は複数投票できる", async(async () => { + const { body } = await request( + "/notes/create", + { + text: "test", + poll: { + choices: ["sakura", "izumi", "ako"], + multiple: true, + }, }, - }, alice); + alice, + ); - await request('/notes/polls/vote', { - noteId: body.createdNote.id, - choice: 0, - }, alice); + await request( + "/notes/polls/vote", + { + noteId: body.createdNote.id, + choice: 0, + }, + alice, + ); - await request('/notes/polls/vote', { - noteId: body.createdNote.id, - choice: 1, - }, alice); + await request( + "/notes/polls/vote", + { + noteId: body.createdNote.id, + choice: 1, + }, + alice, + ); - const res = await request('/notes/polls/vote', { - noteId: body.createdNote.id, - choice: 2, - }, alice); + const res = await request( + "/notes/polls/vote", + { + noteId: body.createdNote.id, + choice: 2, + }, + alice, + ); assert.strictEqual(res.status, 204); })); - it('締め切られている場合は投票できない', async(async () => { - const { body } = await request('/notes/create', { - text: 'test', - poll: { - choices: ['sakura', 'izumi', 'ako'], - expiredAfter: 1, + it("締め切られている場合は投票できない", async(async () => { + const { body } = await request( + "/notes/create", + { + text: "test", + poll: { + choices: ["sakura", "izumi", "ako"], + expiredAfter: 1, + }, }, - }, alice); + alice, + ); - await new Promise(x => setTimeout(x, 2)); + await new Promise((x) => setTimeout(x, 2)); - const res = await request('/notes/polls/vote', { - noteId: body.createdNote.id, - choice: 1, - }, alice); + const res = await request( + "/notes/polls/vote", + { + noteId: body.createdNote.id, + choice: 1, + }, + alice, + ); assert.strictEqual(res.status, 400); })); }); - describe('notes/delete', () => { - it('delete a reply', async(async () => { - const mainNoteRes = await api('notes/create', { - text: 'main post', - }, alice); - const replyOneRes = await api('notes/create', { - text: 'reply one', - replyId: mainNoteRes.body.createdNote.id, - }, alice); - const replyTwoRes = await api('notes/create', { - text: 'reply two', - replyId: mainNoteRes.body.createdNote.id, - }, alice); + describe("notes/delete", () => { + it("delete a reply", async(async () => { + const mainNoteRes = await api( + "notes/create", + { + text: "main post", + }, + alice, + ); + const replyOneRes = await api( + "notes/create", + { + text: "reply one", + replyId: mainNoteRes.body.createdNote.id, + }, + alice, + ); + const replyTwoRes = await api( + "notes/create", + { + text: "reply two", + replyId: mainNoteRes.body.createdNote.id, + }, + alice, + ); - const deleteOneRes = await api('notes/delete', { - noteId: replyOneRes.body.createdNote.id, - }, alice); + const deleteOneRes = await api( + "notes/delete", + { + noteId: replyOneRes.body.createdNote.id, + }, + alice, + ); assert.strictEqual(deleteOneRes.status, 204); - let mainNote = await Notes.findOneBy({ id: mainNoteRes.body.createdNote.id }); + let mainNote = await Notes.findOneBy({ + id: mainNoteRes.body.createdNote.id, + }); assert.strictEqual(mainNote.repliesCount, 1); - const deleteTwoRes = await api('notes/delete', { - noteId: replyTwoRes.body.createdNote.id, - }, alice); + const deleteTwoRes = await api( + "notes/delete", + { + noteId: replyTwoRes.body.createdNote.id, + }, + alice, + ); assert.strictEqual(deleteTwoRes.status, 204); mainNote = await Notes.findOneBy({ id: mainNoteRes.body.createdNote.id }); diff --git a/packages/backend/test/prelude/maybe.ts b/packages/backend/test/prelude/maybe.ts index 0f4b00065..df589981c 100644 --- a/packages/backend/test/prelude/maybe.ts +++ b/packages/backend/test/prelude/maybe.ts @@ -1,18 +1,18 @@ -import * as assert from 'assert'; -import { just, nothing } from '../../src/prelude/maybe.js'; +import * as assert from "assert"; +import { just, nothing } from "../../src/prelude/maybe.js"; -describe('just', () => { - it('has a value', () => { +describe("just", () => { + it("has a value", () => { assert.deepStrictEqual(just(3).isJust(), true); }); - it('has the inverse called get', () => { + it("has the inverse called get", () => { assert.deepStrictEqual(just(3).get(), 3); }); }); -describe('nothing', () => { - it('has no value', () => { +describe("nothing", () => { + it("has no value", () => { assert.deepStrictEqual(nothing().isJust(), false); }); }); diff --git a/packages/backend/test/prelude/url.ts b/packages/backend/test/prelude/url.ts index df102c8df..5d08ff892 100644 --- a/packages/backend/test/prelude/url.ts +++ b/packages/backend/test/prelude/url.ts @@ -1,13 +1,13 @@ -import * as assert from 'assert'; -import { query } from '../../src/prelude/url.js'; +import * as assert from "assert"; +import { query } from "../../src/prelude/url.js"; -describe('url', () => { - it('query', () => { +describe("url", () => { + it("query", () => { const s = query({ - foo: 'ふぅ', - bar: 'b a r', + foo: "ふぅ", + bar: "b a r", baz: undefined, }); - assert.deepStrictEqual(s, 'foo=%E3%81%B5%E3%81%85&bar=b%20a%20r'); + assert.deepStrictEqual(s, "foo=%E3%81%B5%E3%81%85&bar=b%20a%20r"); }); }); diff --git a/packages/backend/test/streaming.ts b/packages/backend/test/streaming.ts index c2043ea56..3292c66e1 100644 --- a/packages/backend/test/streaming.ts +++ b/packages/backend/test/streaming.ts @@ -1,17 +1,26 @@ -process.env.NODE_ENV = 'test'; +process.env.NODE_ENV = "test"; -import * as assert from 'assert'; -import * as childProcess from 'child_process'; -import { Following } from '../src/models/entities/following.js'; -import { connectStream, signup, api, post, startServer, shutdownServer, initTestDb, waitFire } from './utils.js'; +import * as assert from "assert"; +import * as childProcess from "child_process"; +import { Following } from "../src/models/entities/following.js"; +import { + connectStream, + signup, + api, + post, + startServer, + shutdownServer, + initTestDb, + waitFire, +} from "./utils.js"; -describe('Streaming', () => { +describe("Streaming", () => { let p: childProcess.ChildProcess; let Followings: any; const follow = async (follower: any, followee: any) => { await Followings.save({ - id: 'a', + id: "a", createdAt: new Date(), followerId: follower.id, followeeId: followee.id, @@ -24,7 +33,7 @@ describe('Streaming', () => { }); }; - describe('Streaming', () => { + describe("Streaming", () => { // Local users let ayano: any; let kyoko: any; @@ -42,576 +51,716 @@ describe('Streaming', () => { const connection = await initTestDb(true); Followings = connection.getRepository(Following); - ayano = await signup({ username: 'ayano' }); - kyoko = await signup({ username: 'kyoko' }); - chitose = await signup({ username: 'chitose' }); + ayano = await signup({ username: "ayano" }); + kyoko = await signup({ username: "kyoko" }); + chitose = await signup({ username: "chitose" }); - akari = await signup({ username: 'akari', host: 'example.com' }); - chinatsu = await signup({ username: 'chinatsu', host: 'example.com' }); + akari = await signup({ username: "akari", host: "example.com" }); + chinatsu = await signup({ username: "chinatsu", host: "example.com" }); - kyokoNote = await post(kyoko, { text: 'foo' }); + kyokoNote = await post(kyoko, { text: "foo" }); // Follow: ayano => kyoko - await api('following/create', { userId: kyoko.id }, ayano); + await api("following/create", { userId: kyoko.id }, ayano); // Follow: ayano => akari await follow(ayano, akari); // List: chitose => ayano, kyoko - list = await api('users/lists/create', { - name: 'my list', - }, chitose).then(x => x.body); + list = await api( + "users/lists/create", + { + name: "my list", + }, + chitose, + ).then((x) => x.body); - await api('users/lists/push', { - listId: list.id, - userId: ayano.id, - }, chitose); + await api( + "users/lists/push", + { + listId: list.id, + userId: ayano.id, + }, + chitose, + ); - await api('users/lists/push', { - listId: list.id, - userId: kyoko.id, - }, chitose); + await api( + "users/lists/push", + { + listId: list.id, + userId: kyoko.id, + }, + chitose, + ); }); after(async () => { await shutdownServer(p); }); - describe('Events', () => { - it('mention event', async () => { + describe("Events", () => { + it("mention event", async () => { const fired = await waitFire( - kyoko, 'main', // kyoko:main - () => post(ayano, { text: 'foo @kyoko bar' }), // ayano mention => kyoko - msg => msg.type === 'mention' && msg.body.userId === ayano.id // wait ayano + kyoko, + "main", // kyoko:main + () => post(ayano, { text: "foo @kyoko bar" }), // ayano mention => kyoko + (msg) => msg.type === "mention" && msg.body.userId === ayano.id, // wait ayano ); assert.strictEqual(fired, true); }); - it('renote event', async () => { + it("renote event", async () => { const fired = await waitFire( - kyoko, 'main', // kyoko:main - () => post(ayano, { renoteId: kyokoNote.id }), // ayano renote - msg => msg.type === 'renote' && msg.body.renoteId === kyokoNote.id // wait renote + kyoko, + "main", // kyoko:main + () => post(ayano, { renoteId: kyokoNote.id }), // ayano renote + (msg) => msg.type === "renote" && msg.body.renoteId === kyokoNote.id, // wait renote ); assert.strictEqual(fired, true); }); }); - describe('Home Timeline', () => { - it('自分の投稿が流れる', async () => { + describe("Home Timeline", () => { + it("自分の投稿が流れる", async () => { const fired = await waitFire( - ayano, 'homeTimeline', // ayano:Home - () => api('notes/create', { text: 'foo' }, ayano), // ayano posts - msg => msg.type === 'note' && msg.body.text === 'foo' + ayano, + "homeTimeline", // ayano:Home + () => api("notes/create", { text: "foo" }, ayano), // ayano posts + (msg) => msg.type === "note" && msg.body.text === "foo", ); assert.strictEqual(fired, true); }); - it('フォローしているユーザーの投稿が流れる', async () => { + it("フォローしているユーザーの投稿が流れる", async () => { const fired = await waitFire( - ayano, 'homeTimeline', // ayano:home - () => api('notes/create', { text: 'foo' }, kyoko), // kyoko posts - msg => msg.type === 'note' && msg.body.userId === kyoko.id // wait kyoko + ayano, + "homeTimeline", // ayano:home + () => api("notes/create", { text: "foo" }, kyoko), // kyoko posts + (msg) => msg.type === "note" && msg.body.userId === kyoko.id, // wait kyoko ); assert.strictEqual(fired, true); }); - it('フォローしていないユーザーの投稿は流れない', async () => { + it("フォローしていないユーザーの投稿は流れない", async () => { const fired = await waitFire( - kyoko, 'homeTimeline', // kyoko:home - () => api('notes/create', { text: 'foo' }, ayano), // ayano posts - msg => msg.type === 'note' && msg.body.userId === ayano.id // wait ayano + kyoko, + "homeTimeline", // kyoko:home + () => api("notes/create", { text: "foo" }, ayano), // ayano posts + (msg) => msg.type === "note" && msg.body.userId === ayano.id, // wait ayano ); assert.strictEqual(fired, false); }); - it('フォローしているユーザーのダイレクト投稿が流れる', async () => { + it("フォローしているユーザーのダイレクト投稿が流れる", async () => { const fired = await waitFire( - ayano, 'homeTimeline', // ayano:home - () => api('notes/create', { text: 'foo', visibility: 'specified', visibleUserIds: [ayano.id], }, kyoko), // kyoko dm => ayano - msg => msg.type === 'note' && msg.body.userId === kyoko.id // wait kyoko + ayano, + "homeTimeline", // ayano:home + () => + api( + "notes/create", + { + text: "foo", + visibility: "specified", + visibleUserIds: [ayano.id], + }, + kyoko, + ), // kyoko dm => ayano + (msg) => msg.type === "note" && msg.body.userId === kyoko.id, // wait kyoko ); assert.strictEqual(fired, true); }); - it('フォローしているユーザーでも自分が指定されていないダイレクト投稿は流れない', async () => { + it("フォローしているユーザーでも自分が指定されていないダイレクト投稿は流れない", async () => { const fired = await waitFire( - ayano, 'homeTimeline', // ayano:home - () => api('notes/create', { text: 'foo', visibility: 'specified', visibleUserIds: [chitose.id], }, kyoko), // kyoko dm => chitose - msg => msg.type === 'note' && msg.body.userId === kyoko.id // wait kyoko + ayano, + "homeTimeline", // ayano:home + () => + api( + "notes/create", + { + text: "foo", + visibility: "specified", + visibleUserIds: [chitose.id], + }, + kyoko, + ), // kyoko dm => chitose + (msg) => msg.type === "note" && msg.body.userId === kyoko.id, // wait kyoko ); assert.strictEqual(fired, false); }); - }); // Home + }); // Home - describe('Local Timeline', () => { - it('自分の投稿が流れる', async () => { + describe("Local Timeline", () => { + it("自分の投稿が流れる", async () => { const fired = await waitFire( - ayano, 'localTimeline', // ayano:Local - () => api('notes/create', { text: 'foo' }, ayano), // ayano posts - msg => msg.type === 'note' && msg.body.text === 'foo' + ayano, + "localTimeline", // ayano:Local + () => api("notes/create", { text: "foo" }, ayano), // ayano posts + (msg) => msg.type === "note" && msg.body.text === "foo", ); assert.strictEqual(fired, true); }); - it('フォローしていないローカルユーザーの投稿が流れる', async () => { + it("フォローしていないローカルユーザーの投稿が流れる", async () => { const fired = await waitFire( - ayano, 'localTimeline', // ayano:Local - () => api('notes/create', { text: 'foo' }, chitose), // chitose posts - msg => msg.type === 'note' && msg.body.userId === chitose.id // wait chitose + ayano, + "localTimeline", // ayano:Local + () => api("notes/create", { text: "foo" }, chitose), // chitose posts + (msg) => msg.type === "note" && msg.body.userId === chitose.id, // wait chitose ); assert.strictEqual(fired, true); }); - it('リモートユーザーの投稿は流れない', async () => { + it("リモートユーザーの投稿は流れない", async () => { const fired = await waitFire( - ayano, 'localTimeline', // ayano:Local - () => api('notes/create', { text: 'foo' }, chinatsu), // chinatsu posts - msg => msg.type === 'note' && msg.body.userId === chinatsu.id // wait chinatsu + ayano, + "localTimeline", // ayano:Local + () => api("notes/create", { text: "foo" }, chinatsu), // chinatsu posts + (msg) => msg.type === "note" && msg.body.userId === chinatsu.id, // wait chinatsu ); assert.strictEqual(fired, false); }); - it('フォローしてたとしてもリモートユーザーの投稿は流れない', async () => { + it("フォローしてたとしてもリモートユーザーの投稿は流れない", async () => { const fired = await waitFire( - ayano, 'localTimeline', // ayano:Local - () => api('notes/create', { text: 'foo' }, akari), // akari posts - msg => msg.type === 'note' && msg.body.userId === akari.id // wait akari + ayano, + "localTimeline", // ayano:Local + () => api("notes/create", { text: "foo" }, akari), // akari posts + (msg) => msg.type === "note" && msg.body.userId === akari.id, // wait akari ); assert.strictEqual(fired, false); }); - it('ホーム指定の投稿は流れない', async () => { + it("ホーム指定の投稿は流れない", async () => { const fired = await waitFire( - ayano, 'localTimeline', // ayano:Local - () => api('notes/create', { text: 'foo', visibility: 'home' }, kyoko), // kyoko home posts - msg => msg.type === 'note' && msg.body.userId === kyoko.id // wait kyoko + ayano, + "localTimeline", // ayano:Local + () => api("notes/create", { text: "foo", visibility: "home" }, kyoko), // kyoko home posts + (msg) => msg.type === "note" && msg.body.userId === kyoko.id, // wait kyoko ); assert.strictEqual(fired, false); }); - it('フォローしているローカルユーザーのダイレクト投稿は流れない', async () => { + it("フォローしているローカルユーザーのダイレクト投稿は流れない", async () => { const fired = await waitFire( - ayano, 'localTimeline', // ayano:Local - () => api('notes/create', { text: 'foo', visibility: 'specified', visibleUserIds: [ayano.id] }, kyoko), // kyoko DM => ayano - msg => msg.type === 'note' && msg.body.userId === kyoko.id // wait kyoko + ayano, + "localTimeline", // ayano:Local + () => + api( + "notes/create", + { + text: "foo", + visibility: "specified", + visibleUserIds: [ayano.id], + }, + kyoko, + ), // kyoko DM => ayano + (msg) => msg.type === "note" && msg.body.userId === kyoko.id, // wait kyoko ); assert.strictEqual(fired, false); }); - it('フォローしていないローカルユーザーのフォロワー宛て投稿は流れない', async () => { + it("フォローしていないローカルユーザーのフォロワー宛て投稿は流れない", async () => { const fired = await waitFire( - ayano, 'localTimeline', // ayano:Local - () => api('notes/create', { text: 'foo', visibility: 'followers' }, chitose), - msg => msg.type === 'note' && msg.body.userId === chitose.id // wait chitose + ayano, + "localTimeline", // ayano:Local + () => + api( + "notes/create", + { text: "foo", visibility: "followers" }, + chitose, + ), + (msg) => msg.type === "note" && msg.body.userId === chitose.id, // wait chitose ); assert.strictEqual(fired, false); }); }); - describe('Recommended Timeline', () => { - it('自分の投稿が流れる', async () => { + describe("Recommended Timeline", () => { + it("自分の投稿が流れる", async () => { const fired = await waitFire( - ayano, 'recommendedTimeline', // ayano:Local - () => api('notes/create', { text: 'foo' }, ayano), // ayano posts - msg => msg.type === 'note' && msg.body.text === 'foo' + ayano, + "recommendedTimeline", // ayano:Local + () => api("notes/create", { text: "foo" }, ayano), // ayano posts + (msg) => msg.type === "note" && msg.body.text === "foo", ); assert.strictEqual(fired, true); }); - it('フォローしていないローカルユーザーの投稿が流れる', async () => { + it("フォローしていないローカルユーザーの投稿が流れる", async () => { const fired = await waitFire( - ayano, 'recommendedTimeline', // ayano:Local - () => api('notes/create', { text: 'foo' }, chitose), // chitose posts - msg => msg.type === 'note' && msg.body.userId === chitose.id // wait chitose + ayano, + "recommendedTimeline", // ayano:Local + () => api("notes/create", { text: "foo" }, chitose), // chitose posts + (msg) => msg.type === "note" && msg.body.userId === chitose.id, // wait chitose ); assert.strictEqual(fired, true); }); - it('リモートユーザーの投稿は流れない', async () => { + it("リモートユーザーの投稿は流れない", async () => { const fired = await waitFire( - ayano, 'recommendedTimeline', // ayano:Local - () => api('notes/create', { text: 'foo' }, chinatsu), // chinatsu posts - msg => msg.type === 'note' && msg.body.userId === chinatsu.id // wait chinatsu + ayano, + "recommendedTimeline", // ayano:Local + () => api("notes/create", { text: "foo" }, chinatsu), // chinatsu posts + (msg) => msg.type === "note" && msg.body.userId === chinatsu.id, // wait chinatsu ); assert.strictEqual(fired, false); }); - it('フォローしてたとしてもリモートユーザーの投稿は流れない', async () => { + it("フォローしてたとしてもリモートユーザーの投稿は流れない", async () => { const fired = await waitFire( - ayano, 'recommendedTimeline', // ayano:Local - () => api('notes/create', { text: 'foo' }, akari), // akari posts - msg => msg.type === 'note' && msg.body.userId === akari.id // wait akari + ayano, + "recommendedTimeline", // ayano:Local + () => api("notes/create", { text: "foo" }, akari), // akari posts + (msg) => msg.type === "note" && msg.body.userId === akari.id, // wait akari ); assert.strictEqual(fired, false); }); - it('ホーム指定の投稿は流れない', async () => { + it("ホーム指定の投稿は流れない", async () => { const fired = await waitFire( - ayano, 'recommendedTimeline', // ayano:Local - () => api('notes/create', { text: 'foo', visibility: 'home' }, kyoko), // kyoko home posts - msg => msg.type === 'note' && msg.body.userId === kyoko.id // wait kyoko + ayano, + "recommendedTimeline", // ayano:Local + () => api("notes/create", { text: "foo", visibility: "home" }, kyoko), // kyoko home posts + (msg) => msg.type === "note" && msg.body.userId === kyoko.id, // wait kyoko ); assert.strictEqual(fired, false); }); - it('フォローしているローカルユーザーのダイレクト投稿は流れない', async () => { + it("フォローしているローカルユーザーのダイレクト投稿は流れない", async () => { const fired = await waitFire( - ayano, 'recommendedTimeline', // ayano:Local - () => api('notes/create', { text: 'foo', visibility: 'specified', visibleUserIds: [ayano.id] }, kyoko), // kyoko DM => ayano - msg => msg.type === 'note' && msg.body.userId === kyoko.id // wait kyoko + ayano, + "recommendedTimeline", // ayano:Local + () => + api( + "notes/create", + { + text: "foo", + visibility: "specified", + visibleUserIds: [ayano.id], + }, + kyoko, + ), // kyoko DM => ayano + (msg) => msg.type === "note" && msg.body.userId === kyoko.id, // wait kyoko ); assert.strictEqual(fired, false); }); - it('フォローしていないローカルユーザーのフォロワー宛て投稿は流れない', async () => { + it("フォローしていないローカルユーザーのフォロワー宛て投稿は流れない", async () => { const fired = await waitFire( - ayano, 'recommendedTimeline', // ayano:Local - () => api('notes/create', { text: 'foo', visibility: 'followers' }, chitose), - msg => msg.type === 'note' && msg.body.userId === chitose.id // wait chitose + ayano, + "recommendedTimeline", // ayano:Local + () => + api( + "notes/create", + { text: "foo", visibility: "followers" }, + chitose, + ), + (msg) => msg.type === "note" && msg.body.userId === chitose.id, // wait chitose ); assert.strictEqual(fired, false); }); }); - describe('Hybrid Timeline', () => { - it('自分の投稿が流れる', async () => { + describe("Hybrid Timeline", () => { + it("自分の投稿が流れる", async () => { const fired = await waitFire( - ayano, 'hybridTimeline', // ayano:Hybrid - () => api('notes/create', { text: 'foo' }, ayano), // ayano posts - msg => msg.type === 'note' && msg.body.text === 'foo' + ayano, + "hybridTimeline", // ayano:Hybrid + () => api("notes/create", { text: "foo" }, ayano), // ayano posts + (msg) => msg.type === "note" && msg.body.text === "foo", ); assert.strictEqual(fired, true); }); - it('フォローしていないローカルユーザーの投稿が流れる', async () => { + it("フォローしていないローカルユーザーの投稿が流れる", async () => { const fired = await waitFire( - ayano, 'hybridTimeline', // ayano:Hybrid - () => api('notes/create', { text: 'foo' }, chitose), // chitose posts - msg => msg.type === 'note' && msg.body.userId === chitose.id // wait chitose + ayano, + "hybridTimeline", // ayano:Hybrid + () => api("notes/create", { text: "foo" }, chitose), // chitose posts + (msg) => msg.type === "note" && msg.body.userId === chitose.id, // wait chitose ); assert.strictEqual(fired, true); }); - it('フォローしているリモートユーザーの投稿が流れる', async () => { + it("フォローしているリモートユーザーの投稿が流れる", async () => { const fired = await waitFire( - ayano, 'hybridTimeline', // ayano:Hybrid - () => api('notes/create', { text: 'foo' }, akari), // akari posts - msg => msg.type === 'note' && msg.body.userId === akari.id // wait akari + ayano, + "hybridTimeline", // ayano:Hybrid + () => api("notes/create", { text: "foo" }, akari), // akari posts + (msg) => msg.type === "note" && msg.body.userId === akari.id, // wait akari ); assert.strictEqual(fired, true); }); - it('フォローしていないリモートユーザーの投稿は流れない', async () => { + it("フォローしていないリモートユーザーの投稿は流れない", async () => { const fired = await waitFire( - ayano, 'hybridTimeline', // ayano:Hybrid - () => api('notes/create', { text: 'foo' }, chinatsu), // chinatsu posts - msg => msg.type === 'note' && msg.body.userId === chinatsu.id // wait chinatsu + ayano, + "hybridTimeline", // ayano:Hybrid + () => api("notes/create", { text: "foo" }, chinatsu), // chinatsu posts + (msg) => msg.type === "note" && msg.body.userId === chinatsu.id, // wait chinatsu ); assert.strictEqual(fired, false); }); - it('フォローしているユーザーのダイレクト投稿が流れる', async () => { + it("フォローしているユーザーのダイレクト投稿が流れる", async () => { const fired = await waitFire( - ayano, 'hybridTimeline', // ayano:Hybrid - () => api('notes/create', { text: 'foo', visibility: 'specified', visibleUserIds: [ayano.id] }, kyoko), - msg => msg.type === 'note' && msg.body.userId === kyoko.id // wait kyoko + ayano, + "hybridTimeline", // ayano:Hybrid + () => + api( + "notes/create", + { + text: "foo", + visibility: "specified", + visibleUserIds: [ayano.id], + }, + kyoko, + ), + (msg) => msg.type === "note" && msg.body.userId === kyoko.id, // wait kyoko ); assert.strictEqual(fired, true); }); - it('フォローしているユーザーのホーム投稿が流れる', async () => { + it("フォローしているユーザーのホーム投稿が流れる", async () => { const fired = await waitFire( - ayano, 'hybridTimeline', // ayano:Hybrid - () => api('notes/create', { text: 'foo', visibility: 'home' }, kyoko), - msg => msg.type === 'note' && msg.body.userId === kyoko.id // wait kyoko + ayano, + "hybridTimeline", // ayano:Hybrid + () => api("notes/create", { text: "foo", visibility: "home" }, kyoko), + (msg) => msg.type === "note" && msg.body.userId === kyoko.id, // wait kyoko ); assert.strictEqual(fired, true); }); - it('フォローしていないローカルユーザーのホーム投稿は流れない', async () => { + it("フォローしていないローカルユーザーのホーム投稿は流れない", async () => { const fired = await waitFire( - ayano, 'hybridTimeline', // ayano:Hybrid - () => api('notes/create', { text: 'foo', visibility: 'home' }, chitose), - msg => msg.type === 'note' && msg.body.userId === chitose.id + ayano, + "hybridTimeline", // ayano:Hybrid + () => + api("notes/create", { text: "foo", visibility: "home" }, chitose), + (msg) => msg.type === "note" && msg.body.userId === chitose.id, ); assert.strictEqual(fired, false); }); - it('フォローしていないローカルユーザーのフォロワー宛て投稿は流れない', () => async () => { + it("フォローしていないローカルユーザーのフォロワー宛て投稿は流れない", () => + async () => { + const fired = await waitFire( + ayano, + "hybridTimeline", // ayano:Hybrid + () => + api( + "notes/create", + { text: "foo", visibility: "followers" }, + chitose, + ), + (msg) => msg.type === "note" && msg.body.userId === chitose.id, + ); + + assert.strictEqual(fired, false); + }); + }); + + describe("Global Timeline", () => { + it("フォローしていないローカルユーザーの投稿が流れる", () => async () => { const fired = await waitFire( - ayano, 'hybridTimeline', // ayano:Hybrid - () => api('notes/create', { text: 'foo', visibility: 'followers' }, chitose), - msg => msg.type === 'note' && msg.body.userId === chitose.id + ayano, + "globalTimeline", // ayano:Global + () => api("notes/create", { text: "foo" }, chitose), // chitose posts + (msg) => msg.type === "note" && msg.body.userId === chitose.id, // wait chitose + ); + + assert.strictEqual(fired, true); + }); + + it("フォローしていないリモートユーザーの投稿が流れる", () => async () => { + const fired = await waitFire( + ayano, + "globalTimeline", // ayano:Global + () => api("notes/create", { text: "foo" }, chinatsu), // chinatsu posts + (msg) => msg.type === "note" && msg.body.userId === chinatsu.id, // wait chinatsu + ); + + assert.strictEqual(fired, true); + }); + + it("ホーム投稿は流れない", () => async () => { + const fired = await waitFire( + ayano, + "globalTimeline", // ayano:Global + () => api("notes/create", { text: "foo", visibility: "home" }, kyoko), // kyoko posts + (msg) => msg.type === "note" && msg.body.userId === kyoko.id, // wait kyoko ); assert.strictEqual(fired, false); }); }); - describe('Global Timeline', () => { - it('フォローしていないローカルユーザーの投稿が流れる', () => async () => { + describe("UserList Timeline", () => { + it("リストに入れているユーザーの投稿が流れる", () => async () => { const fired = await waitFire( - ayano, 'globalTimeline', // ayano:Global - () => api('notes/create', { text: 'foo' }, chitose), // chitose posts - msg => msg.type === 'note' && msg.body.userId === chitose.id // wait chitose + chitose, + "userList", + () => api("notes/create", { text: "foo" }, ayano), + (msg) => msg.type === "note" && msg.body.userId === ayano.id, + { listId: list.id }, ); assert.strictEqual(fired, true); }); - it('フォローしていないリモートユーザーの投稿が流れる', () => async () => { + it("リストに入れていないユーザーの投稿は流れない", () => async () => { const fired = await waitFire( - ayano, 'globalTimeline', // ayano:Global - () => api('notes/create', { text: 'foo' }, chinatsu), // chinatsu posts - msg => msg.type === 'note' && msg.body.userId === chinatsu.id // wait chinatsu - ); - - assert.strictEqual(fired, true); - }); - - it('ホーム投稿は流れない', () => async () => { - const fired = await waitFire( - ayano, 'globalTimeline', // ayano:Global - () => api('notes/create', { text: 'foo', visibility: 'home' }, kyoko), // kyoko posts - msg => msg.type === 'note' && msg.body.userId === kyoko.id // wait kyoko - ); - - assert.strictEqual(fired, false); - }); - }); - - describe('UserList Timeline', () => { - it('リストに入れているユーザーの投稿が流れる', () => async () => { - const fired = await waitFire( - chitose, 'userList', - () => api('notes/create', { text: 'foo' }, ayano), - msg => msg.type === 'note' && msg.body.userId === ayano.id, - { listId: list.id, } - ); - - assert.strictEqual(fired, true); - }); - - it('リストに入れていないユーザーの投稿は流れない', () => async () => { - const fired = await waitFire( - chitose, 'userList', - () => api('notes/create', { text: 'foo' }, chinatsu), - msg => msg.type === 'note' && msg.body.userId === chinatsu.id, - { listId: list.id, } + chitose, + "userList", + () => api("notes/create", { text: "foo" }, chinatsu), + (msg) => msg.type === "note" && msg.body.userId === chinatsu.id, + { listId: list.id }, ); assert.strictEqual(fired, false); }); // #4471 - it('リストに入れているユーザーのダイレクト投稿が流れる', () => async () => { - const fired = await waitFire( - chitose, 'userList', - () => api('notes/create', { text: 'foo', visibility: 'specified', visibleUserIds: [chitose.id] }, ayano), - msg => msg.type === 'note' && msg.body.userId === ayano.id, - { listId: list.id, } - ); + it("リストに入れているユーザーのダイレクト投稿が流れる", () => + async () => { + const fired = await waitFire( + chitose, + "userList", + () => + api( + "notes/create", + { + text: "foo", + visibility: "specified", + visibleUserIds: [chitose.id], + }, + ayano, + ), + (msg) => msg.type === "note" && msg.body.userId === ayano.id, + { listId: list.id }, + ); - assert.strictEqual(fired, true); - }); + assert.strictEqual(fired, true); + }); // #4335 - it('リストに入れているがフォローはしてないユーザーのフォロワー宛て投稿は流れない', () => async () => { - const fired = await waitFire( - chitose, 'userList', - () => api('notes/create', { text: 'foo', visibility: 'followers' }, kyoko), - msg => msg.type === 'note' && msg.body.userId === kyoko.id, - { listId: list.id, } - ); + it("リストに入れているがフォローはしてないユーザーのフォロワー宛て投稿は流れない", () => + async () => { + const fired = await waitFire( + chitose, + "userList", + () => + api( + "notes/create", + { text: "foo", visibility: "followers" }, + kyoko, + ), + (msg) => msg.type === "note" && msg.body.userId === kyoko.id, + { listId: list.id }, + ); - assert.strictEqual(fired, false); - }); + assert.strictEqual(fired, false); + }); }); - describe('Hashtag Timeline', () => { - it('指定したハッシュタグの投稿が流れる', () => new Promise(async done => { - const ws = await connectStream(chitose, 'hashtag', ({ type, body }) => { - if (type == 'note') { - assert.deepStrictEqual(body.text, '#foo'); + describe("Hashtag Timeline", () => { + it("指定したハッシュタグの投稿が流れる", () => + new Promise(async (done) => { + const ws = await connectStream( + chitose, + "hashtag", + ({ type, body }) => { + if (type == "note") { + assert.deepStrictEqual(body.text, "#foo"); + ws.close(); + done(); + } + }, + { + q: [["foo"]], + }, + ); + + post(chitose, { + text: "#foo", + }); + })); + + it("指定したハッシュタグの投稿が流れる (AND)", () => + new Promise(async (done) => { + let fooCount = 0; + let barCount = 0; + let fooBarCount = 0; + + const ws = await connectStream( + chitose, + "hashtag", + ({ type, body }) => { + if (type == "note") { + if (body.text === "#foo") fooCount++; + if (body.text === "#bar") barCount++; + if (body.text === "#foo #bar") fooBarCount++; + } + }, + { + q: [["foo", "bar"]], + }, + ); + + post(chitose, { + text: "#foo", + }); + + post(chitose, { + text: "#bar", + }); + + post(chitose, { + text: "#foo #bar", + }); + + setTimeout(() => { + assert.strictEqual(fooCount, 0); + assert.strictEqual(barCount, 0); + assert.strictEqual(fooBarCount, 1); ws.close(); done(); - } - }, { - q: [ - ['foo'], - ], - }); + }, 3000); + })); - post(chitose, { - text: '#foo', - }); - })); + it("指定したハッシュタグの投稿が流れる (OR)", () => + new Promise(async (done) => { + let fooCount = 0; + let barCount = 0; + let fooBarCount = 0; + let piyoCount = 0; - it('指定したハッシュタグの投稿が流れる (AND)', () => new Promise(async done => { - let fooCount = 0; - let barCount = 0; - let fooBarCount = 0; - - const ws = await connectStream(chitose, 'hashtag', ({ type, body }) => { - if (type == 'note') { - if (body.text === '#foo') fooCount++; - if (body.text === '#bar') barCount++; - if (body.text === '#foo #bar') fooBarCount++; - } - }, { - q: [ - ['foo', 'bar'], - ], - }); - - post(chitose, { - text: '#foo', - }); - - post(chitose, { - text: '#bar', - }); - - post(chitose, { - text: '#foo #bar', - }); - - setTimeout(() => { - assert.strictEqual(fooCount, 0); - assert.strictEqual(barCount, 0); - assert.strictEqual(fooBarCount, 1); - ws.close(); - done(); - }, 3000); - })); + const ws = await connectStream( + chitose, + "hashtag", + ({ type, body }) => { + if (type == "note") { + if (body.text === "#foo") fooCount++; + if (body.text === "#bar") barCount++; + if (body.text === "#foo #bar") fooBarCount++; + if (body.text === "#piyo") piyoCount++; + } + }, + { + q: [["foo"], ["bar"]], + }, + ); - it('指定したハッシュタグの投稿が流れる (OR)', () => new Promise(async done => { - let fooCount = 0; - let barCount = 0; - let fooBarCount = 0; - let piyoCount = 0; + post(chitose, { + text: "#foo", + }); - const ws = await connectStream(chitose, 'hashtag', ({ type, body }) => { - if (type == 'note') { - if (body.text === '#foo') fooCount++; - if (body.text === '#bar') barCount++; - if (body.text === '#foo #bar') fooBarCount++; - if (body.text === '#piyo') piyoCount++; - } - }, { - q: [ - ['foo'], - ['bar'], - ], - }); + post(chitose, { + text: "#bar", + }); - post(chitose, { - text: '#foo', - }); + post(chitose, { + text: "#foo #bar", + }); - post(chitose, { - text: '#bar', - }); + post(chitose, { + text: "#piyo", + }); - post(chitose, { - text: '#foo #bar', - }); + setTimeout(() => { + assert.strictEqual(fooCount, 1); + assert.strictEqual(barCount, 1); + assert.strictEqual(fooBarCount, 1); + assert.strictEqual(piyoCount, 0); + ws.close(); + done(); + }, 3000); + })); - post(chitose, { - text: '#piyo', - }); + it("指定したハッシュタグの投稿が流れる (AND + OR)", () => + new Promise(async (done) => { + let fooCount = 0; + let barCount = 0; + let fooBarCount = 0; + let piyoCount = 0; + let waaaCount = 0; - setTimeout(() => { - assert.strictEqual(fooCount, 1); - assert.strictEqual(barCount, 1); - assert.strictEqual(fooBarCount, 1); - assert.strictEqual(piyoCount, 0); - ws.close(); - done(); - }, 3000); - })); + const ws = await connectStream( + chitose, + "hashtag", + ({ type, body }) => { + if (type == "note") { + if (body.text === "#foo") fooCount++; + if (body.text === "#bar") barCount++; + if (body.text === "#foo #bar") fooBarCount++; + if (body.text === "#piyo") piyoCount++; + if (body.text === "#waaa") waaaCount++; + } + }, + { + q: [["foo", "bar"], ["piyo"]], + }, + ); - it('指定したハッシュタグの投稿が流れる (AND + OR)', () => new Promise(async done => { - let fooCount = 0; - let barCount = 0; - let fooBarCount = 0; - let piyoCount = 0; - let waaaCount = 0; + post(chitose, { + text: "#foo", + }); - const ws = await connectStream(chitose, 'hashtag', ({ type, body }) => { - if (type == 'note') { - if (body.text === '#foo') fooCount++; - if (body.text === '#bar') barCount++; - if (body.text === '#foo #bar') fooBarCount++; - if (body.text === '#piyo') piyoCount++; - if (body.text === '#waaa') waaaCount++; - } - }, { - q: [ - ['foo', 'bar'], - ['piyo'], - ], - }); + post(chitose, { + text: "#bar", + }); - post(chitose, { - text: '#foo', - }); + post(chitose, { + text: "#foo #bar", + }); - post(chitose, { - text: '#bar', - }); + post(chitose, { + text: "#piyo", + }); - post(chitose, { - text: '#foo #bar', - }); + post(chitose, { + text: "#waaa", + }); - post(chitose, { - text: '#piyo', - }); - - post(chitose, { - text: '#waaa', - }); - - setTimeout(() => { - assert.strictEqual(fooCount, 0); - assert.strictEqual(barCount, 0); - assert.strictEqual(fooBarCount, 1); - assert.strictEqual(piyoCount, 1); - assert.strictEqual(waaaCount, 0); - ws.close(); - done(); - }, 3000); - })); + setTimeout(() => { + assert.strictEqual(fooCount, 0); + assert.strictEqual(barCount, 0); + assert.strictEqual(fooBarCount, 1); + assert.strictEqual(piyoCount, 1); + assert.strictEqual(waaaCount, 0); + ws.close(); + done(); + }, 3000); + })); }); }); }); diff --git a/packages/backend/test/thread-mute.ts b/packages/backend/test/thread-mute.ts index cd3e51939..9b3bb8dfe 100644 --- a/packages/backend/test/thread-mute.ts +++ b/packages/backend/test/thread-mute.ts @@ -1,10 +1,19 @@ -process.env.NODE_ENV = 'test'; +process.env.NODE_ENV = "test"; -import * as assert from 'assert'; -import * as childProcess from 'child_process'; -import { async, signup, request, post, react, connectStream, startServer, shutdownServer } from './utils.js'; +import * as assert from "assert"; +import * as childProcess from "child_process"; +import { + async, + signup, + request, + post, + react, + connectStream, + startServer, + shutdownServer, +} from "./utils.js"; -describe('Note thread mute', () => { +describe("Note thread mute", () => { let p: childProcess.ChildProcess; let alice: any; @@ -13,90 +22,139 @@ describe('Note thread mute', () => { before(async () => { p = await startServer(); - alice = await signup({ username: 'alice' }); - bob = await signup({ username: 'bob' }); - carol = await signup({ username: 'carol' }); + alice = await signup({ username: "alice" }); + bob = await signup({ username: "bob" }); + carol = await signup({ username: "carol" }); }); after(async () => { await shutdownServer(p); }); - it('notes/mentions にミュートしているスレッドの投稿が含まれない', async(async () => { - const bobNote = await post(bob, { text: '@alice @carol root note' }); - const aliceReply = await post(alice, { replyId: bobNote.id, text: '@bob @carol child note' }); + it("notes/mentions にミュートしているスレッドの投稿が含まれない", async(async () => { + const bobNote = await post(bob, { text: "@alice @carol root note" }); + const aliceReply = await post(alice, { + replyId: bobNote.id, + text: "@bob @carol child note", + }); - await request('/notes/thread-muting/create', { noteId: bobNote.id }, alice); + await request("/notes/thread-muting/create", { noteId: bobNote.id }, alice); - const carolReply = await post(carol, { replyId: bobNote.id, text: '@bob @alice child note' }); - const carolReplyWithoutMention = await post(carol, { replyId: aliceReply.id, text: 'child note' }); + const carolReply = await post(carol, { + replyId: bobNote.id, + text: "@bob @alice child note", + }); + const carolReplyWithoutMention = await post(carol, { + replyId: aliceReply.id, + text: "child note", + }); - const res = await request('/notes/mentions', {}, alice); + const res = await request("/notes/mentions", {}, alice); assert.strictEqual(res.status, 200); assert.strictEqual(Array.isArray(res.body), true); - assert.strictEqual(res.body.some((note: any) => note.id === bobNote.id), false); - assert.strictEqual(res.body.some((note: any) => note.id === carolReply.id), false); - assert.strictEqual(res.body.some((note: any) => note.id === carolReplyWithoutMention.id), false); + assert.strictEqual( + res.body.some((note: any) => note.id === bobNote.id), + false, + ); + assert.strictEqual( + res.body.some((note: any) => note.id === carolReply.id), + false, + ); + assert.strictEqual( + res.body.some((note: any) => note.id === carolReplyWithoutMention.id), + false, + ); })); - it('ミュートしているスレッドからメンションされても、hasUnreadMentions が true にならない', async(async () => { + it("ミュートしているスレッドからメンションされても、hasUnreadMentions が true にならない", async(async () => { // 状態リセット - await request('/i/read-all-unread-notes', {}, alice); + await request("/i/read-all-unread-notes", {}, alice); - const bobNote = await post(bob, { text: '@alice @carol root note' }); + const bobNote = await post(bob, { text: "@alice @carol root note" }); - await request('/notes/thread-muting/create', { noteId: bobNote.id }, alice); + await request("/notes/thread-muting/create", { noteId: bobNote.id }, alice); - const carolReply = await post(carol, { replyId: bobNote.id, text: '@bob @alice child note' }); + const carolReply = await post(carol, { + replyId: bobNote.id, + text: "@bob @alice child note", + }); - const res = await request('/i', {}, alice); + const res = await request("/i", {}, alice); assert.strictEqual(res.status, 200); assert.strictEqual(res.body.hasUnreadMentions, false); })); - it('ミュートしているスレッドからメンションされても、ストリームに unreadMention イベントが流れてこない', () => new Promise(async done => { - // 状態リセット - await request('/i/read-all-unread-notes', {}, alice); + it("ミュートしているスレッドからメンションされても、ストリームに unreadMention イベントが流れてこない", () => + new Promise(async (done) => { + // 状態リセット + await request("/i/read-all-unread-notes", {}, alice); - const bobNote = await post(bob, { text: '@alice @carol root note' }); + const bobNote = await post(bob, { text: "@alice @carol root note" }); - await request('/notes/thread-muting/create', { noteId: bobNote.id }, alice); + await request( + "/notes/thread-muting/create", + { noteId: bobNote.id }, + alice, + ); - let fired = false; + let fired = false; - const ws = await connectStream(alice, 'main', async ({ type, body }) => { - if (type === 'unreadMention') { - if (body === bobNote.id) return; - fired = true; - } + const ws = await connectStream(alice, "main", async ({ type, body }) => { + if (type === "unreadMention") { + if (body === bobNote.id) return; + fired = true; + } + }); + + const carolReply = await post(carol, { + replyId: bobNote.id, + text: "@bob @alice child note", + }); + + setTimeout(() => { + assert.strictEqual(fired, false); + ws.close(); + done(); + }, 5000); + })); + + it("i/notifications にミュートしているスレッドの通知が含まれない", async(async () => { + const bobNote = await post(bob, { text: "@alice @carol root note" }); + const aliceReply = await post(alice, { + replyId: bobNote.id, + text: "@bob @carol child note", }); - const carolReply = await post(carol, { replyId: bobNote.id, text: '@bob @alice child note' }); + await request("/notes/thread-muting/create", { noteId: bobNote.id }, alice); - setTimeout(() => { - assert.strictEqual(fired, false); - ws.close(); - done(); - }, 5000); - })); + const carolReply = await post(carol, { + replyId: bobNote.id, + text: "@bob @alice child note", + }); + const carolReplyWithoutMention = await post(carol, { + replyId: aliceReply.id, + text: "child note", + }); - it('i/notifications にミュートしているスレッドの通知が含まれない', async(async () => { - const bobNote = await post(bob, { text: '@alice @carol root note' }); - const aliceReply = await post(alice, { replyId: bobNote.id, text: '@bob @carol child note' }); - - await request('/notes/thread-muting/create', { noteId: bobNote.id }, alice); - - const carolReply = await post(carol, { replyId: bobNote.id, text: '@bob @alice child note' }); - const carolReplyWithoutMention = await post(carol, { replyId: aliceReply.id, text: 'child note' }); - - const res = await request('/i/notifications', {}, alice); + const res = await request("/i/notifications", {}, alice); assert.strictEqual(res.status, 200); assert.strictEqual(Array.isArray(res.body), true); - assert.strictEqual(res.body.some((notification: any) => notification.note.id === carolReply.id), false); - assert.strictEqual(res.body.some((notification: any) => notification.note.id === carolReplyWithoutMention.id), false); + assert.strictEqual( + res.body.some( + (notification: any) => notification.note.id === carolReply.id, + ), + false, + ); + assert.strictEqual( + res.body.some( + (notification: any) => + notification.note.id === carolReplyWithoutMention.id, + ), + false, + ); // NOTE: bobの投稿はスレッドミュート前に行われたため通知に含まれていてもよい })); diff --git a/packages/backend/test/user-notes.ts b/packages/backend/test/user-notes.ts index 4447754d6..86a541c10 100644 --- a/packages/backend/test/user-notes.ts +++ b/packages/backend/test/user-notes.ts @@ -1,10 +1,18 @@ -process.env.NODE_ENV = 'test'; +process.env.NODE_ENV = "test"; -import * as assert from 'assert'; -import * as childProcess from 'child_process'; -import { async, signup, request, post, uploadUrl, startServer, shutdownServer } from './utils.js'; +import * as assert from "assert"; +import * as childProcess from "child_process"; +import { + async, + signup, + request, + post, + uploadUrl, + startServer, + shutdownServer, +} from "./utils.js"; -describe('users/notes', () => { +describe("users/notes", () => { let p: childProcess.ChildProcess; let alice: any; @@ -14,9 +22,15 @@ describe('users/notes', () => { before(async () => { p = await startServer(); - alice = await signup({ username: 'alice' }); - const jpg = await uploadUrl(alice, 'https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/Lenna.jpg'); - const png = await uploadUrl(alice, 'https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/Lenna.png'); + alice = await signup({ username: "alice" }); + const jpg = await uploadUrl( + alice, + "https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/Lenna.jpg", + ); + const png = await uploadUrl( + alice, + "https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/Lenna.png", + ); jpgNote = await post(alice, { fileIds: [jpg.id], }); @@ -28,34 +42,57 @@ describe('users/notes', () => { }); }); - after(async() => { + after(async () => { await shutdownServer(p); }); - it('ファイルタイプ指定 (jpg)', async(async () => { - const res = await request('/users/notes', { - userId: alice.id, - fileType: ['image/jpeg'], - }, alice); + it("ファイルタイプ指定 (jpg)", async(async () => { + const res = await request( + "/users/notes", + { + userId: alice.id, + fileType: ["image/jpeg"], + }, + alice, + ); assert.strictEqual(res.status, 200); assert.strictEqual(Array.isArray(res.body), true); assert.strictEqual(res.body.length, 2); - assert.strictEqual(res.body.some((note: any) => note.id === jpgNote.id), true); - assert.strictEqual(res.body.some((note: any) => note.id === jpgPngNote.id), true); + assert.strictEqual( + res.body.some((note: any) => note.id === jpgNote.id), + true, + ); + assert.strictEqual( + res.body.some((note: any) => note.id === jpgPngNote.id), + true, + ); })); - it('ファイルタイプ指定 (jpg or png)', async(async () => { - const res = await request('/users/notes', { - userId: alice.id, - fileType: ['image/jpeg', 'image/png'], - }, alice); + it("ファイルタイプ指定 (jpg or png)", async(async () => { + const res = await request( + "/users/notes", + { + userId: alice.id, + fileType: ["image/jpeg", "image/png"], + }, + alice, + ); assert.strictEqual(res.status, 200); assert.strictEqual(Array.isArray(res.body), true); assert.strictEqual(res.body.length, 3); - assert.strictEqual(res.body.some((note: any) => note.id === jpgNote.id), true); - assert.strictEqual(res.body.some((note: any) => note.id === pngNote.id), true); - assert.strictEqual(res.body.some((note: any) => note.id === jpgPngNote.id), true); + assert.strictEqual( + res.body.some((note: any) => note.id === jpgNote.id), + true, + ); + assert.strictEqual( + res.body.some((note: any) => note.id === pngNote.id), + true, + ); + assert.strictEqual( + res.body.some((note: any) => note.id === jpgPngNote.id), + true, + ); })); }); diff --git a/packages/backend/test/utils.ts b/packages/backend/test/utils.ts index 6833e6eb5..f3f68b260 100644 --- a/packages/backend/test/utils.ts +++ b/packages/backend/test/utils.ts @@ -1,18 +1,18 @@ -import * as fs from 'node:fs'; -import * as path from 'node:path'; -import { fileURLToPath } from 'node:url'; -import { dirname } from 'node:path'; -import * as childProcess from 'child_process'; -import * as http from 'node:http'; -import { SIGKILL } from 'constants'; -import WebSocket from 'ws'; -import * as misskey from 'calckey-js'; -import fetch from 'node-fetch'; -import FormData from 'form-data'; -import { DataSource } from 'typeorm'; -import loadConfig from '../src/config/load.js'; -import { entities } from '../src/db/postgre.js'; -import got from 'got'; +import * as fs from "node:fs"; +import * as path from "node:path"; +import { fileURLToPath } from "node:url"; +import { dirname } from "node:path"; +import * as childProcess from "child_process"; +import * as http from "node:http"; +import { SIGKILL } from "constants"; +import WebSocket from "ws"; +import * as misskey from "calckey-js"; +import fetch from "node-fetch"; +import FormData from "form-data"; +import { DataSource } from "typeorm"; +import loadConfig from "../src/config/load.js"; +import { entities } from "../src/db/postgre.js"; +import got from "got"; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); @@ -21,24 +21,29 @@ const config = loadConfig(); export const port = config.port; export const async = (fn: Function) => (done: Function) => { - fn().then(() => { - done(); - }, (err: Error) => { - done(err); - }); + fn().then( + () => { + done(); + }, + (err: Error) => { + done(err); + }, + ); }; export const api = async (endpoint: string, params: any, me?: any) => { - endpoint = endpoint.replace(/^\//, ''); + endpoint = endpoint.replace(/^\//, ""); - const auth = me ? { - i: me.token - } : {}; + const auth = me + ? { + i: me.token, + } + : {}; const res = await got(`http://localhost:${port}/api/${endpoint}`, { - method: 'POST', + method: "POST", headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json", }, body: JSON.stringify(Object.assign(auth, params)), retry: { @@ -46,12 +51,12 @@ export const api = async (endpoint: string, params: any, me?: any) => { }, hooks: { beforeError: [ - error => { + (error) => { const { response } = error; if (response && response.body) console.warn(response.body); return error; - } - ] + }, + ], }, }); @@ -60,19 +65,25 @@ export const api = async (endpoint: string, params: any, me?: any) => { return { status, - body + body, }; }; -export const request = async (endpoint: string, params: any, me?: any): Promise<{ body: any, status: number }> => { - const auth = me ? { - i: me.token, - } : {}; +export const request = async ( + endpoint: string, + params: any, + me?: any, +): Promise<{ body: any; status: number }> => { + const auth = me + ? { + i: me.token, + } + : {}; const res = await fetch(`http://localhost:${port}/api${endpoint}`, { - method: 'POST', + method: "POST", headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", }, body: JSON.stringify(Object.assign(auth, params)), }); @@ -81,36 +92,54 @@ export const request = async (endpoint: string, params: any, me?: any): Promise< const body = res.status !== 204 ? await res.json().catch() : null; return { - body, status, + body, + status, }; }; export const signup = async (params?: any): Promise => { - const q = Object.assign({ - username: 'test', - password: 'test', - }, params); + const q = Object.assign( + { + username: "test", + password: "test", + }, + params, + ); - const res = await api('signup', q); + const res = await api("signup", q); return res.body; }; -export const post = async (user: any, params?: misskey.Endpoints['notes/create']['req']): Promise => { - const q = Object.assign({ - text: 'test', - }, params); +export const post = async ( + user: any, + params?: misskey.Endpoints["notes/create"]["req"], +): Promise => { + const q = Object.assign( + { + text: "test", + }, + params, + ); - const res = await api('notes/create', q, user); + const res = await api("notes/create", q, user); return res.body ? res.body.createdNote : null; }; -export const react = async (user: any, note: any, reaction: string): Promise => { - await api('notes/reactions/create', { - noteId: note.id, - reaction: reaction, - }, user); +export const react = async ( + user: any, + note: any, + reaction: string, +): Promise => { + await api( + "notes/reactions/create", + { + noteId: note.id, + reaction: reaction, + }, + user, + ); }; /** @@ -119,20 +148,28 @@ export const react = async (user: any, note: any, reaction: string): Promise => { - const absPath = _path == null ? `${_dirname}/resources/Lenna.jpg` : path.isAbsolute(_path) ? _path : `${_dirname}/resources/${_path}`; + const absPath = + _path == null + ? `${_dirname}/resources/Lenna.jpg` + : path.isAbsolute(_path) + ? _path + : `${_dirname}/resources/${_path}`; const formData = new FormData() as any; - formData.append('i', user.token); - formData.append('file', fs.createReadStream(absPath)); - formData.append('force', 'true'); + formData.append("i", user.token); + formData.append("file", fs.createReadStream(absPath)); + formData.append("force", "true"); - const res = await got(`http://localhost:${port}/api/drive/files/create`, { - method: 'POST', - body: formData, - retry: { - limit: 0, + const res = await got( + `http://localhost:${port}/api/drive/files/create`, + { + method: "POST", + body: formData, + retry: { + limit: 0, + }, }, - }); + ); const body = res.statusCode !== 204 ? await JSON.parse(res.body) : null; @@ -142,16 +179,20 @@ export const uploadFile = async (user: any, _path?: string): Promise => { export const uploadUrl = async (user: any, url: string) => { let file: any; - const ws = await connectStream(user, 'main', (msg) => { - if (msg.type === 'driveFileCreated') { + const ws = await connectStream(user, "main", (msg) => { + if (msg.type === "driveFileCreated") { file = msg.body; } }); - await api('drive/files/upload-from-url', { - url, - force: true, - }, user); + await api( + "drive/files/upload-from-url", + { + url, + force: true, + }, + user, + ); await sleep(5000); ws.close(); @@ -159,46 +200,66 @@ export const uploadUrl = async (user: any, url: string) => { return file; }; -export function connectStream(user: any, channel: string, listener: (message: Record) => any, params?: any): Promise { +export function connectStream( + user: any, + channel: string, + listener: (message: Record) => any, + params?: any, +): Promise { return new Promise((res, rej) => { - const ws = new WebSocket(`ws://localhost:${port}/streaming?i=${user.token}`); + const ws = new WebSocket( + `ws://localhost:${port}/streaming?i=${user.token}`, + ); - ws.on('open', () => { - ws.on('message', data => { + ws.on("open", () => { + ws.on("message", (data) => { const msg = JSON.parse(data.toString()); - if (msg.type === 'channel' && msg.body.id === 'a') { + if (msg.type === "channel" && msg.body.id === "a") { listener(msg.body); - } else if (msg.type === 'connected' && msg.body.id === 'a') { + } else if (msg.type === "connected" && msg.body.id === "a") { res(ws); } }); - ws.send(JSON.stringify({ - type: 'connect', - body: { - channel: channel, - id: 'a', - pong: true, - params: params, - }, - })); + ws.send( + JSON.stringify({ + type: "connect", + body: { + channel: channel, + id: "a", + pong: true, + params: params, + }, + }), + ); }); }); } -export const waitFire = async (user: any, channel: string, trgr: () => any, cond: (msg: Record) => boolean, params?: any) => { +export const waitFire = async ( + user: any, + channel: string, + trgr: () => any, + cond: (msg: Record) => boolean, + params?: any, +) => { return new Promise(async (res, rej) => { let timer: NodeJS.Timeout; let ws: WebSocket; try { - ws = await connectStream(user, channel, msg => { - if (cond(msg)) { - ws.close(); - if (timer) clearTimeout(timer); - res(true); - } - }, params); + ws = await connectStream( + user, + channel, + (msg) => { + if (cond(msg)) { + ws.close(); + if (timer) clearTimeout(timer); + res(true); + } + }, + params, + ); } catch (e) { rej(e); } @@ -217,50 +278,63 @@ export const waitFire = async (user: any, channel: string, trgr: () => any, cond if (timer) clearTimeout(timer); rej(e); } - }) + }); }; -export const simpleGet = async (path: string, accept = '*/*'): Promise<{ status?: number, type?: string, location?: string }> => { +export const simpleGet = async ( + path: string, + accept = "*/*", +): Promise<{ status?: number; type?: string; location?: string }> => { // node-fetchだと3xxを取れない return await new Promise((resolve, reject) => { - const req = http.request(`http://localhost:${port}${path}`, { - headers: { - Accept: accept, + const req = http.request( + `http://localhost:${port}${path}`, + { + headers: { + Accept: accept, + }, }, - }, res => { - if (res.statusCode! >= 400) { - reject(res); - } else { - resolve({ - status: res.statusCode, - type: res.headers['content-type'], - location: res.headers.location, - }); - } - }); + (res) => { + if (res.statusCode! >= 400) { + reject(res); + } else { + resolve({ + status: res.statusCode, + type: res.headers["content-type"], + location: res.headers.location, + }); + } + }, + ); req.end(); }); }; -export function launchServer(callbackSpawnedProcess: (p: childProcess.ChildProcess) => void, moreProcess: () => Promise = async () => {}) { +export function launchServer( + callbackSpawnedProcess: (p: childProcess.ChildProcess) => void, + moreProcess: () => Promise = async () => {}, +) { return (done: (err?: Error) => any) => { - const p = childProcess.spawn('node', [_dirname + '/../index.js'], { - stdio: ['inherit', 'inherit', 'inherit', 'ipc'], - env: { NODE_ENV: 'test', PATH: process.env.PATH }, + const p = childProcess.spawn("node", [_dirname + "/../index.js"], { + stdio: ["inherit", "inherit", "inherit", "ipc"], + env: { NODE_ENV: "test", PATH: process.env.PATH }, }); callbackSpawnedProcess(p); - p.on('message', message => { - if (message === 'ok') moreProcess().then(() => done()).catch(e => done(e)); + p.on("message", (message) => { + if (message === "ok") + moreProcess() + .then(() => done()) + .catch((e) => done(e)); }); }; } export async function initTestDb(justBorrow = false, initEntities?: any[]) { - if (process.env.NODE_ENV !== 'test') throw 'NODE_ENV is not a test'; + if (process.env.NODE_ENV !== "test") throw "NODE_ENV is not a test"; const db = new DataSource({ - type: 'postgres', + type: "postgres", host: config.db.host, port: config.db.port, username: config.db.user, @@ -276,22 +350,24 @@ export async function initTestDb(justBorrow = false, initEntities?: any[]) { return db; } -export function startServer(timeout = 60 * 1000): Promise { +export function startServer( + timeout = 60 * 1000, +): Promise { return new Promise((res, rej) => { const t = setTimeout(() => { p.kill(SIGKILL); - rej('timeout to start'); + rej("timeout to start"); }, timeout); - const p = childProcess.spawn('node', [_dirname + '/../built/index.js'], { - stdio: ['inherit', 'inherit', 'inherit', 'ipc'], - env: { NODE_ENV: 'test', PATH: process.env.PATH }, + const p = childProcess.spawn("node", [_dirname + "/../built/index.js"], { + stdio: ["inherit", "inherit", "inherit", "ipc"], + env: { NODE_ENV: "test", PATH: process.env.PATH }, }); - p.on('error', e => rej(e)); + p.on("error", (e) => rej(e)); - p.on('message', message => { - if (message === 'ok') { + p.on("message", (message) => { + if (message === "ok") { clearTimeout(t); res(p); } @@ -299,16 +375,19 @@ export function startServer(timeout = 60 * 1000): Promise { const t = setTimeout(() => { p.kill(SIGKILL); - res('force exit'); + res("force exit"); }, timeout); - p.once('exit', () => { + p.once("exit", () => { clearTimeout(t); - res('exited'); + res("exited"); }); p.kill(); @@ -316,7 +395,7 @@ export function shutdownServer(p: childProcess.ChildProcess, timeout = 20 * 1000 } export function sleep(msec: number) { - return new Promise(res => { + return new Promise((res) => { setTimeout(() => { res(); }, msec); diff --git a/packages/client/@types/theme.d.ts b/packages/client/@types/theme.d.ts index 67f724a9a..5f1b81603 100644 --- a/packages/client/@types/theme.d.ts +++ b/packages/client/@types/theme.d.ts @@ -1,4 +1,4 @@ -declare module '@/themes/*.json5' { +declare module "@/themes/*.json5" { import { Theme } from "@/scripts/theme"; const theme: Theme; diff --git a/packages/client/@types/vue.d.ts b/packages/client/@types/vue.d.ts index f6b66228f..2cd2e3971 100644 --- a/packages/client/@types/vue.d.ts +++ b/packages/client/@types/vue.d.ts @@ -1,7 +1,7 @@ /// -declare module '*.vue' { - import type { DefineComponent } from 'vue'; +declare module "*.vue" { + import type { DefineComponent } from "vue"; const component: DefineComponent<{}, {}, any>; export default component; } diff --git a/packages/client/assets/tagcanvas.min.js b/packages/client/assets/tagcanvas.min.js index bcee46e68..562fe02cd 100644 --- a/packages/client/assets/tagcanvas.min.js +++ b/packages/client/assets/tagcanvas.min.js @@ -10,7 +10,7 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ @@ -18,4 +18,2536 @@ * TagCanvas 2.11 * For more information, please contact */ - (function(){"use strict";var r,C,p=Math.abs,o=Math.sin,l=Math.cos,g=Math.max,h=Math.min,af=Math.ceil,E=Math.sqrt,w=Math.pow,I={},D={},R={0:"0,",1:"17,",2:"34,",3:"51,",4:"68,",5:"85,",6:"102,",7:"119,",8:"136,",9:"153,",a:"170,",A:"170,",b:"187,",B:"187,",c:"204,",C:"204,",d:"221,",D:"221,",e:"238,",E:"238,",f:"255,",F:"255,"},f,d,b,T,z,F,M,c=document,v,e,P,j={};for(r=0;r<256;++r)C=r.toString(16),r<16&&(C='0'+C),D[C]=D[C.toUpperCase()]=r.toString()+',';function n(a){return typeof a!='undefined'}function B(a){return typeof a=='object'&&a!=null}function G(a,c,b){return isNaN(a)?b:h(b,g(c,a))}function x(){return!1}function q(){return(new Date).valueOf()}function ak(c,d){var b=[],e=c.length,a;for(a=0;a=1)?0:a<=-1?Math.PI:Math.acos(a)},z.unit=function(){var a=this.length();return new s(this.x/a,this.y/a,this.z/a)};function ay(b,a){a=a*Math.PI/180,b=b*Math.PI/180;var c=o(b)*l(a),d=-o(a),e=-l(b)*l(a);return new s(c,d,e)}function m(a){this[1]={1:a[0],2:a[1],3:a[2]},this[2]={1:a[3],2:a[4],3:a[5]},this[3]={1:a[6],2:a[7],3:a[8]}}T=m.prototype,m.Identity=function(){return new m([1,0,0,0,1,0,0,0,1])},m.Rotation=function(e,a){var c=o(e),d=l(e),b=1-d;return new m([d+w(a.x,2)*b,a.x*a.y*b-a.z*c,a.x*a.z*b+a.y*c,a.y*a.x*b+a.z*c,d+w(a.y,2)*b,a.y*a.z*b-a.x*c,a.z*a.x*b-a.y*c,a.z*a.y*b+a.x*c,d+w(a.z,2)*b])},T.mul=function(c){var d=[],a,b,e=c.xform?1:0;for(a=1;a<=3;++a)for(b=1;b<=3;++b)e?d.push(this[a][1]*c[1][b]+this[a][2]*c[2][b]+this[a][3]*c[3][b]):d.push(this[a][b]*c);return new m(d)},T.xform=function(b){var a={},c=b.x,d=b.y,e=b.z;return a.x=c*this[1][1]+d*this[2][1]+e*this[3][1],a.y=c*this[1][2]+d*this[2][2]+e*this[3][2],a.z=c*this[1][3]+d*this[2][3]+e*this[3][3],a};function aB(g,j,k,m,f){var a,b,c,d,e=[],h=2/g,i;i=Math.PI*(3-E(5)+(parseFloat(f)?parseFloat(f):0));for(a=0;a0)}function aC(a,c,f,d){var e=a.createLinearGradient(0,0,c,0),b;for(b in d)e.addColorStop(1-b,d[b]);a.fillStyle=e,a.fillRect(0,f,c,1)}function L(a,m,j){var l=1024,d=1,e=a.weightGradient,i,f,b,c;if(a.gCanvas)f=a.gCanvas.getContext('2d'),d=a.gCanvas.height;else{if(B(e[0])?d=e.length:e=[e],a.gCanvas=i=k(l,d),!i)return null;f=i.getContext('2d');for(b=0;b0?b=i*b/100:b=b*j,a=e.getContext('2d'),a.globalCompositeOperation='source-over',a.fillStyle='#fff',b>=i/2?(b=h(c,d)/2,a.beginPath(),a.moveTo(c/2,d/2),a.arc(c/2,d/2,b,0,2*Math.PI,!1),a.fill(),a.closePath()):(b=h(c/2,d/2,b),y(a,0,0,c,d,b,!0),a.fill()),a.globalCompositeOperation='source-in',a.drawImage(l,0,0,c,d),e)}function ao(q,m,i,b,h,a,c){var g=p(c[0]),f=p(c[1]),j=m+(g>a?g+a:a*2)*b,l=i+(f>a?f+a:a*2)*b,n=b*((a||0)+(c[0]<0?g:0)),o=b*((a||0)+(c[1]<0?f:0)),e,d;return e=k(j,l),!e?null:(d=e.getContext('2d'),h&&(d.shadowColor=h),a&&(d.shadowBlur=a*b),c&&(d.shadowOffsetX=c[0]*b,d.shadowOffsetY=c[1]*b),d.drawImage(q,n,o,m,i),{image:e,width:j/b,height:l/b})}function ae(m,o,l){var c=parseInt(m.toString().length*l),h=parseInt(l*2*m.length),j=k(c,h),g,i,e,f,b,d,n,a;if(!j)return null;g=j.getContext('2d'),g.fillStyle='#000',g.fillRect(0,0,c,h),Y(g,l+'px '+o,'#fff',m,0,0,0,0,[],'centre'),i=g.getImageData(0,0,c,h),e=i.width,f=i.height,a={min:{x:e,y:f},max:{x:-1,y:-1}};for(d=0;d0&&(ba.max.x&&(a.max.x=b),da.max.y&&(a.max.y=d));return e!=c&&(a.min.x*=c/e,a.max.x*=c/e),f!=h&&(a.min.y*=c/f,a.max.y*=c/f),j=null,a}function Q(a){return"'"+a.replace(/(\'|\")/g,'').replace(/\s*,\s*/g,"', '")+"'"}function t(b,d,a){a=a||c,a.addEventListener?a.addEventListener(b,d,!1):a.attachEvent('on'+b,d)}function am(b,d,a){a=a||c,a.removeEventListener?a.removeEventListener(b,d):a.detachEvent('on'+b,d)}function A(g,e,j,a,b){var l=b.imageScale,h,c,k,m,f,d;if(!e.complete)return t('load',function(){A(g,e,j,a,b)},e);if(!g.complete)return t('load',function(){A(g,e,j,a,b)},g);if(j&&!j.complete)return t('load',function(){A(g,e,j,a,b)},j);e.width=e.width,e.height=e.height,l&&(g.width=e.width*l,g.height=e.height*l),a.iw=g.width,a.ih=g.height,b.txtOpt&&(c=g,h=b.zoomMax*b.txtScale,f=a.iw*h,d=a.ih*h,f0?(a.iw+=2*b.outlineIncrease,a.ih+=2*b.outlineIncrease,f=h*a.iw,d=h*a.ih,c=S(a.fimage,f,d),a.oimage=c,a.fimage=H(a.fimage,a.oimage.width,a.oimage.height)):(f=h*(a.iw+2*b.outlineIncrease),d=h*(a.ih+2*b.outlineIncrease),c=S(a.fimage,f,d),a.oimage=H(c,a.fimage.width,a.fimage.height))))),a.alt=j,a.Init()}function i(a,d){var b=c.defaultView,e=d.replace(/\-([a-z])/g,function(a){return a.charAt(1).toUpperCase()});return b&&b.getComputedStyle&&b.getComputedStyle(a,null).getPropertyValue(d)||a.currentStyle&&a.currentStyle[e]}function aj(c,d,e){var b=1,a;return d?b=1*(c.getAttribute(d)||e):(a=i(c,'font-size'))&&(b=a.indexOf('px')>-1&&a.replace('px','')*1||a.indexOf('pt')>-1&&a.replace('pt','')*1.25||a*3.3),b}function u(a){return a.target&&n(a.target.id)?a.target.id:a.srcElement.parentNode.id}function K(a,c){var b,d,e=parseInt(i(c,'width'))/c.width,f=parseInt(i(c,'height'))/c.height;return n(a.offsetX)?b={x:a.offsetX,y:a.offsetY}:(d=X(c.id),n(a.changedTouches)&&(a=a.changedTouches[0]),a.pageX&&(b={x:a.pageX-d.x,y:a.pageY-d.y})),b&&e&&f&&(b.x/=e,b.y/=f),b}function an(c){var d=c.target||c.fromElement.parentNode,b=a.tc[d.id];b&&(b.mx=b.my=-1,b.UnFreeze(),b.EndDrag())}function ad(e){var g,c=a,b,d,f=u(e);for(g in c.tc)b=c.tc[g],b.tttimer&&(clearTimeout(b.tttimer),b.tttimer=null);f&&c.tc[f]&&(b=c.tc[f],(d=K(e,b.canvas))&&(b.mx=d.x,b.my=d.y,b.Drag(e,d)),b.drawn=0)}function ap(b){var e=a,f=c.addEventListener?0:1,d=u(b);d&&b.button==f&&e.tc[d]&&e.tc[d].BeginDrag(b)}function aq(b){var f=a,g=c.addEventListener?0:1,e=u(b),d;e&&b.button==g&&f.tc[e]&&(d=f.tc[e],ad(b),!d.EndDrag()&&!d.touchState&&d.Clicked(b))}function ar(c){var e=u(c),b=e&&a.tc[e],d;b&&c.changedTouches&&(c.touches.length==1&&b.touchState==0?(b.touchState=1,b.BeginDrag(c),(d=K(c,b.canvas))&&(b.mx=d.x,b.my=d.y,b.drawn=0)):c.targetTouches.length==2&&b.pinchZoom?(b.touchState=3,b.EndDrag(),b.BeginPinch(c)):(b.EndDrag(),b.EndPinch(),b.touchState=0))}function ac(c){var d=u(c),b=d&&a.tc[d];if(b&&c.changedTouches){switch(b.touchState){case 1:b.Draw(),b.Clicked();break;break;case 2:b.EndDrag();break;case 3:b.EndPinch()}b.touchState=0}}function au(c){var f,e=a,b,d,g=u(c);for(f in e.tc)b=e.tc[f],b.tttimer&&(clearTimeout(b.tttimer),b.tttimer=null);if(b=g&&e.tc[g],b&&c.changedTouches&&b.touchState){switch(b.touchState){case 1:case 2:(d=K(c,b.canvas))&&(b.mx=d.x,b.my=d.y,b.Drag(c,d)&&(b.touchState=2));break;case 3:b.Pinch(c)}b.drawn=0}}function ab(b){var d=a,c=u(b);c&&d.tc[c]&&(b.cancelBubble=!0,b.returnValue=!1,b.preventDefault&&b.preventDefault(),d.tc[c].Wheel((b.wheelDelta||b.detail)>0))}function aw(d){var c,b=a;clearTimeout(b.scrollTimer);for(c in b.tc)b.tc[c].Pause();b.scrollTimer=setTimeout(function(){var b,c=a;for(b in c.tc)c.tc[b].Resume()},b.scrollPause)}function al(){Z(q())}function Z(b){var c=a.tc,d;a.NextFrame(a.interval),b=b||q();for(d in c)c[d].Draw(b)}function az(){requestAnimationFrame(Z)}function aA(a){setTimeout(al,a)}function X(f){var g=c.getElementById(f),b=g.getBoundingClientRect(),a=c.documentElement,d=c.body,e=window,h=e.pageXOffset||a.scrollLeft,i=e.pageYOffset||a.scrollTop,j=a.clientLeft||d.clientLeft,k=a.clientTop||d.clientTop;return{x:b.left+h-j,y:b.top+i-k}}function aI(a,b,d,e){var c=a.radius*a.z1/(a.z1+a.z2+b.z);return{x:b.x*c*d,y:b.y*c*e,z:b.z,w:(a.z1-b.z)/a.z2}}function V(a){this.e=a,this.br=0,this.line=[],this.text=[],this.original=a.innerText||a.textContent}F=V.prototype,F.Empty=function(){for(var a=0;ah?(d.push(this.line.join(' ')),this.line=[a[b]]):this.line.push(a[b]);d.push(this.line.join(' '))}return this.text=d};function _(a,b){this.ts=null,this.tc=a,this.tag=b,this.x=this.y=this.w=this.h=this.sc=1,this.z=0,this.pulse=1,this.pulsate=a.pulsateTo<1,this.colour=a.outlineColour,this.adash=~~a.outlineDash,this.agap=~~a.outlineDashSpace||this.adash,this.aspeed=a.outlineDashSpeed*1,this.colour=='tag'?this.colour=i(b.a,'color'):this.colour=='tagbg'&&(this.colour=i(b.a,'background-color')),this.Draw=this.pulsate?this.DrawPulsate:this.DrawSimple,this.radius=a.outlineRadius|0,this.SetMethod(a.outlineMethod,a.altImage)}f=_.prototype,f.SetMethod=function(a,d){var b={block:['PreDraw','DrawBlock'],colour:['PreDraw','DrawColour'],outline:['PostDraw','DrawOutline'],classic:['LastDraw','DrawOutline'],size:['PreDraw','DrawSize'],none:['LastDraw']},c=b[a]||b.outline;a=='none'?this.Draw=function(){return 1}:this.drawFunc=this[c[1]],this[c[0]]=this.Draw,d&&(this.RealPreDraw=this.PreDraw,this.PreDraw=this.DrawAlt)},f.Update=function(d,e,i,j,a,f,g,h){var b=this.tc.outlineOffset,c=2*b;this.x=a*d+g-b,this.y=a*e+h-b,this.w=a*i+c,this.h=a*j+c,this.sc=a,this.z=f},f.Ants=function(k){if(!this.adash)return;var b=this.adash,c=this.agap,a=this.aspeed,j=b+c,h=0,g=b,f=c,i=0,d=0,e;a&&(d=p(a)*(q()-this.ts)/50,a<0&&(d=864e4-d),a=~~d%j),a?(b>=a?(h=b-a,g=a):(f=j-a,i=c-f),e=[h,f,g,i]):e=[b,c],k.setLineDash(e)},f.DrawOutline=function(a,d,e,b,c,f){var g=h(this.radius,c/2,b/2);a.strokeStyle=f,this.Ants(a),y(a,d,e,b,c,g,!0)},f.DrawSize=function(i,n,m,l,k,j,a,h,g){var f=a.w,e=a.h,c,b,d;return this.pulsate?(a.image?d=(a.image.height+this.tc.outlineIncrease)/a.image.height:d=a.oscale,b=a.fimage||a.image,c=1+(d-1)*(1-this.pulse),a.h*=c,a.w*=c):b=a.oimage,a.alpha=1,a.Draw(i,h,g,b),a.h=e,a.w=f,1},f.DrawColour=function(d,h,i,e,f,g,a,b,c){return a.oimage?(this.pulse<1?(a.alpha=1-w(this.pulse,2),a.Draw(d,b,c,a.fimage),a.alpha=this.pulse):a.alpha=1,a.Draw(d,b,c,a.oimage),1):this[a.image?'DrawColourImage':'DrawColourText'](d,h,i,e,f,g,a,b,c)},f.DrawColourText=function(f,h,i,j,g,e,a,b,c){var d=a.colour;return a.colour=e,a.alpha=1,a.Draw(f,b,c),a.colour=d,1},f.DrawColourImage=function(a,q,p,o,n,m,i,r,l){var f=a.canvas,e=~~g(q,0),d=~~g(p,0),c=h(f.width-e,o)+.5|0,b=h(f.height-d,n)+.5|0,j;return v?(v.width=c,v.height=b):v=k(c,b),!v?this.SetMethod('outline'):(j=v.getContext('2d'),j.drawImage(f,e,d,c,b,0,0,c,b),a.clearRect(e,d,c,b),this.pulsate?i.alpha=1-w(this.pulse,2):i.alpha=1,i.Draw(a,r,l),a.setTransform(1,0,0,1,0,0),a.save(),a.beginPath(),a.rect(e,d,c,b),a.clip(),a.globalCompositeOperation='source-in',a.fillStyle=m,a.fillRect(e,d,c,b),a.restore(),a.globalAlpha=1,a.globalCompositeOperation='destination-over',a.drawImage(v,0,0,c,b,e,d,c,b),a.globalCompositeOperation='source-over',1)},f.DrawAlt=function(b,a,c,d,f,g){var e=this.RealPreDraw(b,a,c,d,f,g);return a.alt&&(a.DrawImage(b,c,d,a.alt),e=1),e},f.DrawBlock=function(a,d,e,b,c,f){var g=h(this.radius,c/2,b/2);a.fillStyle=f,y(a,d,e,b,c,g)},f.DrawSimple=function(a,b,c,d,e,f){var g=this.tc;return a.setTransform(1,0,0,1,0,0),a.strokeStyle=this.colour,a.lineWidth=g.outlineThickness,a.shadowBlur=a.shadowOffsetX=a.shadowOffsetY=0,a.globalAlpha=f?e:1,this.drawFunc(a,this.x,this.y,this.w,this.h,this.colour,b,c,d)},f.DrawPulsate=function(h,d,e,f){var g=q()-this.ts,c=this.tc,b=c.pulsateTo+(1-c.pulsateTo)*(.5+l(2*Math.PI*g/(1e3*c.pulsateTime))/2);return this.pulse=b=a.Smooth(1,b),this.DrawSimple(h,d,e,f,b,1)},f.Active=function(d,a,b){var c=a>=this.x&&b>=this.y&&a<=this.x+this.w&&b<=this.y+this.h;return c?this.ts=this.ts||q():this.ts=null,c},f.PreDraw=f.PostDraw=f.LastDraw=x;function J(a,h,c,b,e,f,g,d,i,j,k,l,m,n){this.tc=a,this.image=null,this.text=h,this.text_original=n,this.line_widths=[],this.title=c.title||null,this.a=c,this.position=new s(b[0],b[1],b[2]),this.x=this.y=this.z=0,this.w=e,this.h=f,this.colour=g||a.textColour,this.bgColour=d||a.bgColour,this.bgRadius=i|0,this.bgOutline=j||this.colour,this.bgOutlineThickness=k|0,this.textFont=l||a.textFont,this.padding=m|0,this.sc=this.alpha=1,this.weighted=!a.weight,this.outline=new _(a,this),this.audio=null}d=J.prototype,d.Init=function(b){var a=this.tc;this.textHeight=a.textHeight,this.HasText()?this.Measure(a.ctxt,a):(this.w=this.iw,this.h=this.ih),this.SetShadowColour=a.shadowAlpha?this.SetShadowColourAlpha:this.SetShadowColourFixed,this.SetDraw(a)},d.Draw=x,d.HasText=function(){return this.text&&this.text[0].length>0},d.EqualTo=function(a){var b=a.getElementsByTagName('img');return this.a.href!=a.href?0:b.length?this.image.src==b[0].src:(a.innerText||a.textContent)==this.text_original},d.SetImage=function(a){this.image=this.fimage=a},d.SetAudio=function(a){this.audio=a,this.audio.load()},d.SetDraw=function(a){this.Draw=this.fimage?a.ie>7?this.DrawImageIE:this.DrawImage:this.DrawText,a.noSelect&&(this.CheckActive=x)},d.MeasureText=function(d){var a,e=this.text.length,b=0,c;for(a=0;a0?c=H(c,this.oimage.width,this.oimage.height):this.oimage=H(this.oimage,c.width,c.height)),c&&(this.fimage=c,l=this.fimage.width/b,j=this.fimage.height/b),this.SetDraw(a),a.txtOpt=!!this.fimage),this.h=j,this.w=l},d.SetFont=function(a,b,c,d){this.textFont=a,this.colour=b,this.bgColour=c,this.bgOutline=d,this.Measure(this.tc.ctxt,this.tc)},d.SetWeight=function(c){var b=this.tc,e=b.weightMode.split(/[, ]/),d,a,f=c.length;if(!this.HasText())return;this.weighted=!0;for(a=0;a0&&a.weightSizeMax>a.weightSizeMin?this.textHeight=a.weightSize*(a.weightSizeMin+(a.weightSizeMax-a.weightSizeMin)*c):this.textHeight=g(1,b*a.weightSize))},d.SetShadowColourFixed=function(a,b,c){a.shadowColor=b},d.SetShadowColourAlpha=function(a,b,c){a.shadowColor=aE(b,c)},d.DrawText=function(a,h,i){var e=this.tc,g=this.x,f=this.y,c=this.sc,b,d;a.globalAlpha=this.alpha,a.fillStyle=this.colour,e.shadow&&this.SetShadowColour(a,e.shadow,this.alpha),a.font=this.font,g+=h/c,f+=i/c-this.h/2;for(b=0;b{this.stopped?this.audio.pause():this.playing=1}),1}};function a(f,o,k){var d,i,b=c.getElementById(f),l=['id','class','innerHTML'];if(!b)throw 0;if(n(window.G_vmlCanvasManager)&&(b=window.G_vmlCanvasManager.initElement(b),this.ie=parseFloat(navigator.appVersion.split('MSIE')[1])),b&&(!b.getContext||!b.getContext('2d').fillText)){i=c.createElement('DIV');for(d=0;d0?a.scrollPause=~~this.scrollPause:this.scrollPause=0,this.minTags>0&&this.repeatTags<1&&(d=this.GetTags().length)&&(this.repeatTags=af(this.minTags/d)-1),this.transform=m.Identity(),this.startTime=this.time=q(),this.mx=this.my=-1,this.centreImage&&av(this),this.Animate=this.dragControl?this.AnimateDrag:this.AnimatePosition,this.animTiming=typeof a[this.animTiming]=='function'?a[this.animTiming]:a.Smooth,this.shadowBlur||this.shadowOffset[0]||this.shadowOffset[1]?(this.ctxt.shadowColor=this.shadow,this.shadow=this.ctxt.shadowColor,this.shadowAlpha=aD()):delete this.shadow,this.activeAudio===!1?e='off':this.activeAudio&&this.LoadAudio(),this.Load(),o&&this.hideTags&&function(b){a.loaded?b.HideTags():t('load',function(){b.HideTags()},window)}(this),this.yaw=this.initial?this.initial[0]*this.maxSpeed:0,this.pitch=this.initial?this.initial[1]*this.maxSpeed:0,this.tooltip?(this.ctitle=b.title,b.title='',this.tooltip=='native'?this.Tooltip=this.TooltipNative:(this.Tooltip=this.TooltipDiv,this.ttdiv||(this.ttdiv=c.createElement('div'),this.ttdiv.className=this.tooltipClass,this.ttdiv.style.position='absolute',this.ttdiv.style.zIndex=b.style.zIndex+1,t('mouseover',function(a){a.target.style.display='none'},this.ttdiv),c.body.appendChild(this.ttdiv)))):this.Tooltip=this.TooltipNone,!this.noMouse&&!j[f]){j[f]=[['mousemove',ad],['mouseout',an],['mouseup',aq],['touchstart',ar],['touchend',ac],['touchcancel',ac],['touchmove',au]],this.dragControl&&(j[f].push(['mousedown',ap]),j[f].push(['selectstart',x])),this.wheelZoom&&(j[f].push(['mousewheel',ab]),j[f].push(['DOMMouseScroll',ab])),this.scrollPause&&j[f].push(['scroll',aw,window]);for(d=0;dthis.max_weight[a])&&(this.max_weight[a]=c),(!this.min_weight[a]||cthis.min_weight[a]&&(g=1);if(g)for(b=0;b=d&&this.my>=e)return!0},b.ToggleAudio=function(){var a=this.audioOff||e&&e.state==='suspended';a||this.currentAudio&&this.currentAudio.StopAudio(),this.audioOff=!a},b.Draw=function(s){if(this.paused)return;var l=this.canvas,i=l.width,j=l.height,q=0,p=(s-this.time)*a.interval/1e3,h=i/2+this.offsetX,g=j/2+this.offsetY,d=this.ctxt,b,f,c,o=-1,e=this.taglist,k=e.length,t=this.active&&this.active.tag,m='',u=this.frontSelect,r=this.centreFunc==x,n;if(this.time=s,this.frozen&&this.drawn)return this.Animate(i,j,p);n=this.AnimateFixed(),d.setTransform(1,0,0,1,0,0);for(c=0;c=0&&this.my>=0&&this.taglist[c].CheckActive(d,h,g),f&&f.sc>q&&(!u||f.z<=0)&&(b=f,o=c,b.tag=this.taglist[c],q=f.sc);this.active=b}this.txtOpt||this.shadow&&this.SetShadow(d),d.clearRect(0,0,i,j);for(c=0;c=this.fadeIn?(this.fadeIn=0,this.fixedAlpha=1):this.fixedAlpha=b/this.fadeIn),this.fixedAnim)&&(this.fixedAnim.transform||(this.fixedAnim.transform=this.transform),a=this.fixedAnim,b=q()-a.t0,c=a.angle,d,e=this.animTiming(a.t,b),this.transform=a.transform,b>=a.t?(this.fixedCallbackTag=a.tag,this.fixedCallback=a.cb,this.fixedAnim=this.yaw=this.pitch=0):c*=e,d=m.Rotation(c,a.axis),this.transform=this.transform.mul(d),this.fixedAnim!=0)},b.AnimatePosition=function(g,h,f){var a=this,d=a.mx,e=a.my,b,c;!a.frozen&&d>=0&&e>=0&&db&&(a.yaw=c>a.z0?a.yaw*a.decel:0),!a.ly&&d>b&&(a.pitch=d>a.z0?a.pitch*a.decel:0)},b.Zoom=function(a){this.z2=this.z1*(1/a),this.drawn=0},b.Clicked=function(b){if(this.CheckAudioIcon()){this.ToggleAudio();return}var a=this.active;try{a&&a.tag&&(this.clickToFront===!1||this.clickToFront===null?a.tag.Clicked(b):this.TagToFront(a.tag,this.clickToFront,function(){a.tag.Clicked(b)},!0))}catch(a){}},b.Wheel=function(a){var b=this.zoom+this.zoomStep*(a?1:-1);this.zoom=h(this.zoomMax,g(this.zoomMin,b)),this.Zoom(this.zoom)},b.BeginDrag=function(a){this.down=K(a,this.canvas),a.cancelBubble=!0,a.returnValue=!1,a.preventDefault&&a.preventDefault()},b.Drag=function(e,a){if(this.dragControl&&this.down){var d=this.dragThreshold*this.dragThreshold,b=a.x-this.down.x,c=a.y-this.down.y;(this.dragging||b*b+c*c>d)&&(this.dx=b,this.dy=c,this.dragging=1,this.down=a)}return this.dragging},b.EndDrag=function(){var a=this.dragging;return this.dragging=this.down=null,a};function ah(a){var b=a.targetTouches[0],c=a.targetTouches[1];return E(w(c.pageX-b.pageX,2)+w(c.pageY-b.pageY,2))}b.BeginPinch=function(a){this.pinched=[ah(a),this.zoom],a.preventDefault&&a.preventDefault()},b.Pinch=function(d){var b,c,a=this.pinched;if(!a)return;c=ah(d),b=a[1]*c/a[0],this.zoom=h(this.zoomMax,g(this.zoomMin,b)),this.Zoom(this.zoom)},b.EndPinch=function(a){this.pinched=null},b.Pause=function(){this.paused=!0},b.Resume=function(){this.paused=!1},b.SetSpeed=function(a){this.initial=a,this.yaw=a[0]*this.maxSpeed,this.pitch=a[1]*this.maxSpeed},b.FindTag=function(a){if(!n(a))return null;if(n(a.index)&&(a=a.index),!B(a))return this.taglist[a];var c,d,b;n(a.id)?(c='id',d=a.id):n(a.text)&&(c='innerText',d=a.text);for(b=0;b= 1) + ? 0 + : a <= -1 + ? Math.PI + : Math.acos(a); + }), + (z.unit = function () { + var a = this.length(); + return new s(this.x / a, this.y / a, this.z / a); + }); + function ay(b, a) { + (a = (a * Math.PI) / 180), (b = (b * Math.PI) / 180); + var c = o(b) * l(a), + d = -o(a), + e = -l(b) * l(a); + return new s(c, d, e); + } + function m(a) { + (this[1] = { 1: a[0], 2: a[1], 3: a[2] }), + (this[2] = { 1: a[3], 2: a[4], 3: a[5] }), + (this[3] = { 1: a[6], 2: a[7], 3: a[8] }); + } + (T = m.prototype), + (m.Identity = function () { + return new m([1, 0, 0, 0, 1, 0, 0, 0, 1]); + }), + (m.Rotation = function (e, a) { + var c = o(e), + d = l(e), + b = 1 - d; + return new m([ + d + w(a.x, 2) * b, + a.x * a.y * b - a.z * c, + a.x * a.z * b + a.y * c, + a.y * a.x * b + a.z * c, + d + w(a.y, 2) * b, + a.y * a.z * b - a.x * c, + a.z * a.x * b - a.y * c, + a.z * a.y * b + a.x * c, + d + w(a.z, 2) * b, + ]); + }), + (T.mul = function (c) { + var d = [], + a, + b, + e = c.xform ? 1 : 0; + for (a = 1; a <= 3; ++a) + for (b = 1; b <= 3; ++b) + e + ? d.push( + this[a][1] * c[1][b] + + this[a][2] * c[2][b] + + this[a][3] * c[3][b], + ) + : d.push(this[a][b] * c); + return new m(d); + }), + (T.xform = function (b) { + var a = {}, + c = b.x, + d = b.y, + e = b.z; + return ( + (a.x = c * this[1][1] + d * this[2][1] + e * this[3][1]), + (a.y = c * this[1][2] + d * this[2][2] + e * this[3][2]), + (a.z = c * this[1][3] + d * this[2][3] + e * this[3][3]), + a + ); + }); + function aB(g, j, k, m, f) { + var a, + b, + c, + d, + e = [], + h = 2 / g, + i; + i = Math.PI * (3 - E(5) + (parseFloat(f) ? parseFloat(f) : 0)); + for (a = 0; a < g; ++a) + (b = a * h - 1 + h / 2), + (c = E(1 - b * b)), + (d = a * i), + e.push([l(d) * c * j, b * k, o(d) * c * m]); + return e; + } + function U(n, p, m, k, h, g) { + var b, + f = [], + i = 2 / n, + j, + a, + d, + c, + e; + j = Math.PI * (3 - E(5) + (parseFloat(g) ? parseFloat(g) : 0)); + for (a = 0; a < n; ++a) + (d = a * i - 1 + i / 2), + (b = a * j), + (c = l(b)), + (e = o(b)), + f.push(p ? [d * m, c * k, e * h] : [c * m, d * k, e * h]); + return f; + } + function aa(k, e, f, h, i, j) { + var b, + g = [], + m = (Math.PI * 2) / e, + a, + c, + d; + for (a = 0; a < e; ++a) + (b = a * m), + (c = l(b)), + (d = o(b)), + g.push(k ? [j * f, c * h, d * i] : [c * f, j * h, d * i]); + return g; + } + function ax(a, b, c, d, e) { + return U(a, 0, b, c, d, e); + } + function aH(a, b, c, d, e) { + return U(a, 1, b, c, d, e); + } + function aG(b, c, d, e, a) { + return (a = isNaN(a) ? 0 : a * 1), aa(0, b, c, d, e, a); + } + function aF(b, c, d, e, a) { + return (a = isNaN(a) ? 0 : a * 1), aa(1, b, c, d, e, a); + } + function av(b) { + var a = new Image(); + (a.onload = function () { + var c = a.width / 2, + d = a.height / 2; + b.centreFunc = function (b, g, h, e, f) { + b.setTransform(1, 0, 0, 1, 0, 0), + (b.globalAlpha = 1), + b.drawImage(a, e - c, f - d); + }; + }), + (a.src = b.centreImage); + } + function aE(a, c) { + var b = a, + d, + e, + f = (c * 1).toPrecision(3) + ")"; + return ( + a[0] === "#" + ? (I[a] || + (a.length === 4 + ? (I[a] = "rgba(" + R[a[1]] + R[a[2]] + R[a[3]]) + : (I[a] = + "rgba(" + + D[a.substr(1, 2)] + + D[a.substr(3, 2)] + + D[a.substr(5, 2)])), + (b = I[a] + f)) + : a.substr(0, 4) === "rgb(" || a.substr(0, 4) === "hsl(" + ? (b = a.replace("(", "a(").replace(")", "," + f)) + : (a.substr(0, 5) === "rgba(" || a.substr(0, 5) === "hsla(") && + ((d = a.lastIndexOf(",") + 1), + (e = a.indexOf(")")), + (c *= parseFloat(a.substring(d, e))), + (b = a.substr(0, d) + c.toPrecision(3) + ")")), + b + ); + } + function k(b, d) { + if (window.G_vmlCanvasManager) return null; + var a = c.createElement("canvas"); + return (a.width = b), (a.height = d), a; + } + function aD() { + var b = k(3, 3), + a, + c; + return ( + !!b && + ((a = b.getContext("2d")), + (a.strokeStyle = "#000"), + (a.shadowColor = "#fff"), + (a.shadowBlur = 3), + (a.globalAlpha = 0), + a.strokeRect(2, 2, 2, 2), + (a.globalAlpha = 1), + (c = a.getImageData(2, 2, 1, 1)), + (b = null), + c.data[0] > 0) + ); + } + function aC(a, c, f, d) { + var e = a.createLinearGradient(0, 0, c, 0), + b; + for (b in d) e.addColorStop(1 - b, d[b]); + (a.fillStyle = e), a.fillRect(0, f, c, 1); + } + function L(a, m, j) { + var l = 1024, + d = 1, + e = a.weightGradient, + i, + f, + b, + c; + if (a.gCanvas) (f = a.gCanvas.getContext("2d")), (d = a.gCanvas.height); + else { + if ((B(e[0]) ? (d = e.length) : (e = [e]), (a.gCanvas = i = k(l, d)), !i)) + return null; + f = i.getContext("2d"); + for (b = 0; b < d; ++b) aC(f, l, b, e[b]); + } + return ( + (j = g(h(j || 0, d - 1), 0)), + (c = f.getImageData(~~((l - 1) * m), j, 1, 1).data), + "rgba(" + c[0] + "," + c[1] + "," + c[2] + "," + c[3] / 255 + ")" + ); + } + function Y(b, i, q, k, o, n, h, d, a, g, f, l) { + var m = o + (d || 0) + (a.length && a[0] < 0 ? p(a[0]) : 0), + j = n + (d || 0) + (a.length && a[1] < 0 ? p(a[1]) : 0), + c, + e; + (b.font = i), + (b.textBaseline = "top"), + (b.fillStyle = q), + h && (b.shadowColor = h), + d && (b.shadowBlur = d), + a.length && ((b.shadowOffsetX = a[0]), (b.shadowOffsetY = a[1])); + for (c = 0; c < k.length; ++c) + (e = 0), + f && + ("right" == l + ? (e = g - f[c]) + : "centre" == l && (e = (g - f[c]) / 2)), + b.fillText(k[c], m + e, j), + (j += parseInt(i)); + } + function y(d, a, b, f, e, c, g) { + c + ? (d.beginPath(), + d.moveTo(a, b + e - c), + d.arcTo(a, b, a + c, b, c), + d.arcTo(a + f, b, a + f, b + c, c), + d.arcTo(a + f, b + e, a + f - c, b + e, c), + d.arcTo(a, b + e, a, b + e - c, c), + d.closePath(), + d[g ? "stroke" : "fill"]()) + : d[g ? "strokeRect" : "fillRect"](a, b, f, e); + } + function O(a, b, c, d, e, f, g, h, i) { + (this.strings = a), + (this.font = b), + (this.width = c), + (this.height = d), + (this.maxWidth = e), + (this.stringWidths = f), + (this.align = g), + (this.valign = h), + (this.scale = i); + } + (M = O.prototype), + (M.SetImage = function (a, b, c, d, e, f, g, h) { + (this.image = a), + (this.iwidth = b * this.scale), + (this.iheight = c * this.scale), + (this.ipos = d), + (this.ipad = e * this.scale), + (this.iscale = h), + (this.ialign = f), + (this.ivalign = g); + }), + (M.Align = function (c, d, a) { + var b = 0; + return ( + a == "right" || a == "bottom" + ? (b = d - c) + : a != "left" && a != "top" && (b = (d - c) / 2), + b + ); + }), + (M.Create = function (G, D, F, b, A, m, q, j, E) { + var o, + e, + f, + a, + l, + s, + i, + u, + v, + r, + w, + n, + c, + d, + x, + B = p(q[0]), + C = p(q[1]), + t, + z; + return ( + (j = g(j, B + m, C + m)), + (l = 2 * (j + b)), + (i = 2 * (j + b)), + (e = this.width + l), + (f = this.height + i), + (v = r = j + b), + this.image && + ((w = n = j + b), + (c = this.iwidth), + (d = this.iheight), + this.ipos == "top" || this.ipos == "bottom" + ? (c < this.width + ? (w += this.Align(c, this.width, this.ialign)) + : (v += this.Align(this.width, c, this.align)), + this.ipos == "top" + ? (r += d + this.ipad) + : (n += this.height + this.ipad), + (e = g(e, c + l)), + (f += d + this.ipad)) + : (d < this.height + ? (n += this.Align(d, this.height, this.ivalign)) + : (r += this.Align(this.height, d, this.valign)), + this.ipos == "right" + ? (w += this.width + this.ipad) + : (v += c + this.ipad), + (e += c + this.ipad), + (f = g(f, d + i)))), + (o = k(e, f)), + !o + ? null + : ((l = i = b / 2), + (s = e - b), + (u = f - b), + (x = h(E, s / 2, u / 2)), + (a = o.getContext("2d")), + D && ((a.fillStyle = D), y(a, l, i, s, u, x)), + b && + ((a.strokeStyle = F), (a.lineWidth = b), y(a, l, i, s, u, x, !0)), + (m || B || C) && + ((t = k(e, f)), t && ((z = a), (a = t.getContext("2d")))), + Y( + a, + this.font, + G, + this.strings, + v, + r, + 0, + 0, + [], + this.maxWidth, + this.stringWidths, + this.align, + ), + this.image && a.drawImage(this.image, w, n, c, d), + z && + ((a = z), + A && (a.shadowColor = A), + m && (a.shadowBlur = m), + (a.shadowOffsetX = q[0]), + (a.shadowOffsetY = q[1]), + a.drawImage(t, 0, 0)), + o) + ); + }); + function H(a, c, d) { + var b = k(c, d), + e; + return b + ? ((e = b.getContext("2d")), + e.drawImage(a, (c - a.width) / 2, (d - a.height) / 2), + b) + : null; + } + function S(e, b, c) { + var a = k(b, c), + d; + return a ? ((d = a.getContext("2d")), d.drawImage(e, 0, 0, b, c), a) : null; + } + function W(n, u, t, e, s, c, v, d, r, w) { + var g = u + (2 * d + c) * e, + f = t + (2 * d + c) * e, + l = k(g, f), + b, + i, + q, + m, + j, + o, + a, + p; + return l + ? ((c *= e), + (r *= e), + (i = q = c / 2), + (m = g - c), + (j = f - c), + (d = d * e + i), + (b = l.getContext("2d")), + (p = h(r, m / 2, j / 2)), + s && ((b.fillStyle = s), y(b, i, q, m, j, p)), + c && ((b.strokeStyle = v), (b.lineWidth = c), y(b, i, q, m, j, p, !0)), + w + ? ((o = k(g, f)), + (a = o.getContext("2d")), + a.drawImage(n, d, d, u, t), + (a.globalCompositeOperation = "source-in"), + (a.fillStyle = v), + a.fillRect(0, 0, g, f), + (a.globalCompositeOperation = "destination-over"), + a.drawImage(l, 0, 0), + (a.globalCompositeOperation = "source-over"), + b.drawImage(o, 0, 0)) + : b.drawImage(n, d, d, n.width, n.height), + { image: l, width: g / e, height: f / e }) + : null; + } + function at(l, f, c, d, j) { + var e, + a, + b = parseFloat(f), + i = g(c, d); + return ( + (e = k(c, d)), + !e + ? null + : (f.indexOf("%") > 0 ? (b = (i * b) / 100) : (b = b * j), + (a = e.getContext("2d")), + (a.globalCompositeOperation = "source-over"), + (a.fillStyle = "#fff"), + b >= i / 2 + ? ((b = h(c, d) / 2), + a.beginPath(), + a.moveTo(c / 2, d / 2), + a.arc(c / 2, d / 2, b, 0, 2 * Math.PI, !1), + a.fill(), + a.closePath()) + : ((b = h(c / 2, d / 2, b)), y(a, 0, 0, c, d, b, !0), a.fill()), + (a.globalCompositeOperation = "source-in"), + a.drawImage(l, 0, 0, c, d), + e) + ); + } + function ao(q, m, i, b, h, a, c) { + var g = p(c[0]), + f = p(c[1]), + j = m + (g > a ? g + a : a * 2) * b, + l = i + (f > a ? f + a : a * 2) * b, + n = b * ((a || 0) + (c[0] < 0 ? g : 0)), + o = b * ((a || 0) + (c[1] < 0 ? f : 0)), + e, + d; + return ( + (e = k(j, l)), + !e + ? null + : ((d = e.getContext("2d")), + h && (d.shadowColor = h), + a && (d.shadowBlur = a * b), + c && ((d.shadowOffsetX = c[0] * b), (d.shadowOffsetY = c[1] * b)), + d.drawImage(q, n, o, m, i), + { image: e, width: j / b, height: l / b }) + ); + } + function ae(m, o, l) { + var c = parseInt(m.toString().length * l), + h = parseInt(l * 2 * m.length), + j = k(c, h), + g, + i, + e, + f, + b, + d, + n, + a; + if (!j) return null; + (g = j.getContext("2d")), + (g.fillStyle = "#000"), + g.fillRect(0, 0, c, h), + Y(g, l + "px " + o, "#fff", m, 0, 0, 0, 0, [], "centre"), + (i = g.getImageData(0, 0, c, h)), + (e = i.width), + (f = i.height), + (a = { min: { x: e, y: f }, max: { x: -1, y: -1 } }); + for (d = 0; d < f; ++d) + for (b = 0; b < e; ++b) + (n = (d * e + b) * 4), + i.data[n + 1] > 0 && + (b < a.min.x && (a.min.x = b), + b > a.max.x && (a.max.x = b), + d < a.min.y && (a.min.y = d), + d > a.max.y && (a.max.y = d)); + return ( + e != c && ((a.min.x *= c / e), (a.max.x *= c / e)), + f != h && ((a.min.y *= c / f), (a.max.y *= c / f)), + (j = null), + a + ); + } + function Q(a) { + return "'" + a.replace(/(\'|\")/g, "").replace(/\s*,\s*/g, "', '") + "'"; + } + function t(b, d, a) { + (a = a || c), + a.addEventListener + ? a.addEventListener(b, d, !1) + : a.attachEvent("on" + b, d); + } + function am(b, d, a) { + (a = a || c), + a.removeEventListener + ? a.removeEventListener(b, d) + : a.detachEvent("on" + b, d); + } + function A(g, e, j, a, b) { + var l = b.imageScale, + h, + c, + k, + m, + f, + d; + if (!e.complete) + return t( + "load", + function () { + A(g, e, j, a, b); + }, + e, + ); + if (!g.complete) + return t( + "load", + function () { + A(g, e, j, a, b); + }, + g, + ); + if (j && !j.complete) + return t( + "load", + function () { + A(g, e, j, a, b); + }, + j, + ); + (e.width = e.width), + (e.height = e.height), + l && ((g.width = e.width * l), (g.height = e.height * l)), + (a.iw = g.width), + (a.ih = g.height), + b.txtOpt && + ((c = g), + (h = b.zoomMax * b.txtScale), + (f = a.iw * h), + (d = a.ih * h), + f < e.naturalWidth || d < e.naturalHeight + ? ((c = S(g, f, d)), c && (a.fimage = c)) + : ((f = a.iw), (d = a.ih), (h = 1)), + parseFloat(b.imageRadius) && + (a.image = a.fimage = g = at(a.image, b.imageRadius, f, d, h)), + a.HasText() || + (b.shadow && + ((c = ao(a.image, f, d, h, b.shadow, b.shadowBlur, b.shadowOffset)), + c && ((a.fimage = c.image), (a.w = c.width), (a.h = c.height))), + (b.bgColour || b.bgOutlineThickness) && + ((k = + b.bgColour == "tag" ? i(a.a, "background-color") : b.bgColour), + (m = + b.bgOutline == "tag" + ? i(a.a, "color") + : b.bgOutline || b.textColour), + (f = a.fimage.width), + (d = a.fimage.height), + b.outlineMethod == "colour" && + ((c = W( + a.fimage, + f, + d, + h, + k, + b.bgOutlineThickness, + a.outline.colour, + b.padding, + b.bgRadius, + 1, + )), + c && (a.oimage = c.image)), + (c = W( + a.fimage, + f, + d, + h, + k, + b.bgOutlineThickness, + m, + b.padding, + b.bgRadius, + )), + c && ((a.fimage = c.image), (a.w = c.width), (a.h = c.height))), + b.outlineMethod == "size" && + (b.outlineIncrease > 0 + ? ((a.iw += 2 * b.outlineIncrease), + (a.ih += 2 * b.outlineIncrease), + (f = h * a.iw), + (d = h * a.ih), + (c = S(a.fimage, f, d)), + (a.oimage = c), + (a.fimage = H(a.fimage, a.oimage.width, a.oimage.height))) + : ((f = h * (a.iw + 2 * b.outlineIncrease)), + (d = h * (a.ih + 2 * b.outlineIncrease)), + (c = S(a.fimage, f, d)), + (a.oimage = H(c, a.fimage.width, a.fimage.height)))))), + (a.alt = j), + a.Init(); + } + function i(a, d) { + var b = c.defaultView, + e = d.replace(/\-([a-z])/g, function (a) { + return a.charAt(1).toUpperCase(); + }); + return ( + (b && + b.getComputedStyle && + b.getComputedStyle(a, null).getPropertyValue(d)) || + (a.currentStyle && a.currentStyle[e]) + ); + } + function aj(c, d, e) { + var b = 1, + a; + return ( + d + ? (b = 1 * (c.getAttribute(d) || e)) + : (a = i(c, "font-size")) && + (b = + (a.indexOf("px") > -1 && a.replace("px", "") * 1) || + (a.indexOf("pt") > -1 && a.replace("pt", "") * 1.25) || + a * 3.3), + b + ); + } + function u(a) { + return a.target && n(a.target.id) + ? a.target.id + : a.srcElement.parentNode.id; + } + function K(a, c) { + var b, + d, + e = parseInt(i(c, "width")) / c.width, + f = parseInt(i(c, "height")) / c.height; + return ( + n(a.offsetX) + ? (b = { x: a.offsetX, y: a.offsetY }) + : ((d = X(c.id)), + n(a.changedTouches) && (a = a.changedTouches[0]), + a.pageX && (b = { x: a.pageX - d.x, y: a.pageY - d.y })), + b && e && f && ((b.x /= e), (b.y /= f)), + b + ); + } + function an(c) { + var d = c.target || c.fromElement.parentNode, + b = a.tc[d.id]; + b && ((b.mx = b.my = -1), b.UnFreeze(), b.EndDrag()); + } + function ad(e) { + var g, + c = a, + b, + d, + f = u(e); + for (g in c.tc) + (b = c.tc[g]), b.tttimer && (clearTimeout(b.tttimer), (b.tttimer = null)); + f && + c.tc[f] && + ((b = c.tc[f]), + (d = K(e, b.canvas)) && ((b.mx = d.x), (b.my = d.y), b.Drag(e, d)), + (b.drawn = 0)); + } + function ap(b) { + var e = a, + f = c.addEventListener ? 0 : 1, + d = u(b); + d && b.button == f && e.tc[d] && e.tc[d].BeginDrag(b); + } + function aq(b) { + var f = a, + g = c.addEventListener ? 0 : 1, + e = u(b), + d; + e && + b.button == g && + f.tc[e] && + ((d = f.tc[e]), ad(b), !d.EndDrag() && !d.touchState && d.Clicked(b)); + } + function ar(c) { + var e = u(c), + b = e && a.tc[e], + d; + b && + c.changedTouches && + (c.touches.length == 1 && b.touchState == 0 + ? ((b.touchState = 1), + b.BeginDrag(c), + (d = K(c, b.canvas)) && ((b.mx = d.x), (b.my = d.y), (b.drawn = 0))) + : c.targetTouches.length == 2 && b.pinchZoom + ? ((b.touchState = 3), b.EndDrag(), b.BeginPinch(c)) + : (b.EndDrag(), b.EndPinch(), (b.touchState = 0))); + } + function ac(c) { + var d = u(c), + b = d && a.tc[d]; + if (b && c.changedTouches) { + switch (b.touchState) { + case 1: + b.Draw(), b.Clicked(); + break; + break; + case 2: + b.EndDrag(); + break; + case 3: + b.EndPinch(); + } + b.touchState = 0; + } + } + function au(c) { + var f, + e = a, + b, + d, + g = u(c); + for (f in e.tc) + (b = e.tc[f]), b.tttimer && (clearTimeout(b.tttimer), (b.tttimer = null)); + if (((b = g && e.tc[g]), b && c.changedTouches && b.touchState)) { + switch (b.touchState) { + case 1: + case 2: + (d = K(c, b.canvas)) && + ((b.mx = d.x), (b.my = d.y), b.Drag(c, d) && (b.touchState = 2)); + break; + case 3: + b.Pinch(c); + } + b.drawn = 0; + } + } + function ab(b) { + var d = a, + c = u(b); + c && + d.tc[c] && + ((b.cancelBubble = !0), + (b.returnValue = !1), + b.preventDefault && b.preventDefault(), + d.tc[c].Wheel((b.wheelDelta || b.detail) > 0)); + } + function aw(d) { + var c, + b = a; + clearTimeout(b.scrollTimer); + for (c in b.tc) b.tc[c].Pause(); + b.scrollTimer = setTimeout(function () { + var b, + c = a; + for (b in c.tc) c.tc[b].Resume(); + }, b.scrollPause); + } + function al() { + Z(q()); + } + function Z(b) { + var c = a.tc, + d; + a.NextFrame(a.interval), (b = b || q()); + for (d in c) c[d].Draw(b); + } + function az() { + requestAnimationFrame(Z); + } + function aA(a) { + setTimeout(al, a); + } + function X(f) { + var g = c.getElementById(f), + b = g.getBoundingClientRect(), + a = c.documentElement, + d = c.body, + e = window, + h = e.pageXOffset || a.scrollLeft, + i = e.pageYOffset || a.scrollTop, + j = a.clientLeft || d.clientLeft, + k = a.clientTop || d.clientTop; + return { x: b.left + h - j, y: b.top + i - k }; + } + function aI(a, b, d, e) { + var c = (a.radius * a.z1) / (a.z1 + a.z2 + b.z); + return { x: b.x * c * d, y: b.y * c * e, z: b.z, w: (a.z1 - b.z) / a.z2 }; + } + function V(a) { + (this.e = a), + (this.br = 0), + (this.line = []), + (this.text = []), + (this.original = a.innerText || a.textContent); + } + (F = V.prototype), + (F.Empty = function () { + for (var a = 0; a < this.text.length; ++a) + if (this.text[a].length) return !1; + return !0; + }), + (F.Lines = function (c) { + var e = c ? 1 : 0, + b, + d, + a; + (c = c || this.e), (b = c.childNodes), (d = b.length); + for (a = 0; a < d; ++a) + b[a].nodeName == "BR" + ? (this.text.push(this.line.join(" ")), (this.br = 1)) + : b[a].nodeType == 3 + ? this.br + ? ((this.line = [b[a].nodeValue]), (this.br = 0)) + : this.line.push(b[a].nodeValue) + : this.Lines(b[a]); + return e || this.br || this.text.push(this.line.join(" ")), this.text; + }), + (F.SplitWidth = function (h, e, f, g) { + var c, + b, + a, + d = []; + e.font = g + "px " + f; + for (c = 0; c < this.text.length; ++c) { + (a = this.text[c].split(/\s+/)), (this.line = [a[0]]); + for (b = 1; b < a.length; ++b) + e.measureText(this.line.join(" ") + " " + a[b]).width > h + ? (d.push(this.line.join(" ")), (this.line = [a[b]])) + : this.line.push(a[b]); + d.push(this.line.join(" ")); + } + return (this.text = d); + }); + function _(a, b) { + (this.ts = null), + (this.tc = a), + (this.tag = b), + (this.x = this.y = this.w = this.h = this.sc = 1), + (this.z = 0), + (this.pulse = 1), + (this.pulsate = a.pulsateTo < 1), + (this.colour = a.outlineColour), + (this.adash = ~~a.outlineDash), + (this.agap = ~~a.outlineDashSpace || this.adash), + (this.aspeed = a.outlineDashSpeed * 1), + this.colour == "tag" + ? (this.colour = i(b.a, "color")) + : this.colour == "tagbg" && (this.colour = i(b.a, "background-color")), + (this.Draw = this.pulsate ? this.DrawPulsate : this.DrawSimple), + (this.radius = a.outlineRadius | 0), + this.SetMethod(a.outlineMethod, a.altImage); + } + (f = _.prototype), + (f.SetMethod = function (a, d) { + var b = { + block: ["PreDraw", "DrawBlock"], + colour: ["PreDraw", "DrawColour"], + outline: ["PostDraw", "DrawOutline"], + classic: ["LastDraw", "DrawOutline"], + size: ["PreDraw", "DrawSize"], + none: ["LastDraw"], + }, + c = b[a] || b.outline; + a == "none" + ? (this.Draw = function () { + return 1; + }) + : (this.drawFunc = this[c[1]]), + (this[c[0]] = this.Draw), + d && ((this.RealPreDraw = this.PreDraw), (this.PreDraw = this.DrawAlt)); + }), + (f.Update = function (d, e, i, j, a, f, g, h) { + var b = this.tc.outlineOffset, + c = 2 * b; + (this.x = a * d + g - b), + (this.y = a * e + h - b), + (this.w = a * i + c), + (this.h = a * j + c), + (this.sc = a), + (this.z = f); + }), + (f.Ants = function (k) { + if (!this.adash) return; + var b = this.adash, + c = this.agap, + a = this.aspeed, + j = b + c, + h = 0, + g = b, + f = c, + i = 0, + d = 0, + e; + a && + ((d = (p(a) * (q() - this.ts)) / 50), + a < 0 && (d = 864e4 - d), + (a = ~~d % j)), + a + ? (b >= a ? ((h = b - a), (g = a)) : ((f = j - a), (i = c - f)), + (e = [h, f, g, i])) + : (e = [b, c]), + k.setLineDash(e); + }), + (f.DrawOutline = function (a, d, e, b, c, f) { + var g = h(this.radius, c / 2, b / 2); + (a.strokeStyle = f), this.Ants(a), y(a, d, e, b, c, g, !0); + }), + (f.DrawSize = function (i, n, m, l, k, j, a, h, g) { + var f = a.w, + e = a.h, + c, + b, + d; + return ( + this.pulsate + ? (a.image + ? (d = + (a.image.height + this.tc.outlineIncrease) / a.image.height) + : (d = a.oscale), + (b = a.fimage || a.image), + (c = 1 + (d - 1) * (1 - this.pulse)), + (a.h *= c), + (a.w *= c)) + : (b = a.oimage), + (a.alpha = 1), + a.Draw(i, h, g, b), + (a.h = e), + (a.w = f), + 1 + ); + }), + (f.DrawColour = function (d, h, i, e, f, g, a, b, c) { + return a.oimage + ? (this.pulse < 1 + ? ((a.alpha = 1 - w(this.pulse, 2)), + a.Draw(d, b, c, a.fimage), + (a.alpha = this.pulse)) + : (a.alpha = 1), + a.Draw(d, b, c, a.oimage), + 1) + : this[a.image ? "DrawColourImage" : "DrawColourText"]( + d, + h, + i, + e, + f, + g, + a, + b, + c, + ); + }), + (f.DrawColourText = function (f, h, i, j, g, e, a, b, c) { + var d = a.colour; + return (a.colour = e), (a.alpha = 1), a.Draw(f, b, c), (a.colour = d), 1; + }), + (f.DrawColourImage = function (a, q, p, o, n, m, i, r, l) { + var f = a.canvas, + e = ~~g(q, 0), + d = ~~g(p, 0), + c = (h(f.width - e, o) + 0.5) | 0, + b = (h(f.height - d, n) + 0.5) | 0, + j; + return ( + v ? ((v.width = c), (v.height = b)) : (v = k(c, b)), + !v + ? this.SetMethod("outline") + : ((j = v.getContext("2d")), + j.drawImage(f, e, d, c, b, 0, 0, c, b), + a.clearRect(e, d, c, b), + this.pulsate ? (i.alpha = 1 - w(this.pulse, 2)) : (i.alpha = 1), + i.Draw(a, r, l), + a.setTransform(1, 0, 0, 1, 0, 0), + a.save(), + a.beginPath(), + a.rect(e, d, c, b), + a.clip(), + (a.globalCompositeOperation = "source-in"), + (a.fillStyle = m), + a.fillRect(e, d, c, b), + a.restore(), + (a.globalAlpha = 1), + (a.globalCompositeOperation = "destination-over"), + a.drawImage(v, 0, 0, c, b, e, d, c, b), + (a.globalCompositeOperation = "source-over"), + 1) + ); + }), + (f.DrawAlt = function (b, a, c, d, f, g) { + var e = this.RealPreDraw(b, a, c, d, f, g); + return a.alt && (a.DrawImage(b, c, d, a.alt), (e = 1)), e; + }), + (f.DrawBlock = function (a, d, e, b, c, f) { + var g = h(this.radius, c / 2, b / 2); + (a.fillStyle = f), y(a, d, e, b, c, g); + }), + (f.DrawSimple = function (a, b, c, d, e, f) { + var g = this.tc; + return ( + a.setTransform(1, 0, 0, 1, 0, 0), + (a.strokeStyle = this.colour), + (a.lineWidth = g.outlineThickness), + (a.shadowBlur = a.shadowOffsetX = a.shadowOffsetY = 0), + (a.globalAlpha = f ? e : 1), + this.drawFunc(a, this.x, this.y, this.w, this.h, this.colour, b, c, d) + ); + }), + (f.DrawPulsate = function (h, d, e, f) { + var g = q() - this.ts, + c = this.tc, + b = + c.pulsateTo + + (1 - c.pulsateTo) * + (0.5 + l((2 * Math.PI * g) / (1e3 * c.pulsateTime)) / 2); + return ( + (this.pulse = b = a.Smooth(1, b)), this.DrawSimple(h, d, e, f, b, 1) + ); + }), + (f.Active = function (d, a, b) { + var c = + a >= this.x && + b >= this.y && + a <= this.x + this.w && + b <= this.y + this.h; + return c ? (this.ts = this.ts || q()) : (this.ts = null), c; + }), + (f.PreDraw = f.PostDraw = f.LastDraw = x); + function J(a, h, c, b, e, f, g, d, i, j, k, l, m, n) { + (this.tc = a), + (this.image = null), + (this.text = h), + (this.text_original = n), + (this.line_widths = []), + (this.title = c.title || null), + (this.a = c), + (this.position = new s(b[0], b[1], b[2])), + (this.x = this.y = this.z = 0), + (this.w = e), + (this.h = f), + (this.colour = g || a.textColour), + (this.bgColour = d || a.bgColour), + (this.bgRadius = i | 0), + (this.bgOutline = j || this.colour), + (this.bgOutlineThickness = k | 0), + (this.textFont = l || a.textFont), + (this.padding = m | 0), + (this.sc = this.alpha = 1), + (this.weighted = !a.weight), + (this.outline = new _(a, this)), + (this.audio = null); + } + (d = J.prototype), + (d.Init = function (b) { + var a = this.tc; + (this.textHeight = a.textHeight), + this.HasText() + ? this.Measure(a.ctxt, a) + : ((this.w = this.iw), (this.h = this.ih)), + (this.SetShadowColour = a.shadowAlpha + ? this.SetShadowColourAlpha + : this.SetShadowColourFixed), + this.SetDraw(a); + }), + (d.Draw = x), + (d.HasText = function () { + return this.text && this.text[0].length > 0; + }), + (d.EqualTo = function (a) { + var b = a.getElementsByTagName("img"); + return this.a.href != a.href + ? 0 + : b.length + ? this.image.src == b[0].src + : (a.innerText || a.textContent) == this.text_original; + }), + (d.SetImage = function (a) { + this.image = this.fimage = a; + }), + (d.SetAudio = function (a) { + (this.audio = a), this.audio.load(); + }), + (d.SetDraw = function (a) { + (this.Draw = this.fimage + ? a.ie > 7 + ? this.DrawImageIE + : this.DrawImage + : this.DrawText), + a.noSelect && (this.CheckActive = x); + }), + (d.MeasureText = function (d) { + var a, + e = this.text.length, + b = 0, + c; + for (a = 0; a < e; ++a) + (this.line_widths[a] = c = d.measureText(this.text[a]).width), + (b = g(b, c)); + return b; + }), + (d.Measure = function (e, a) { + var f = ae(this.text, this.textFont, this.textHeight), + b, + k, + h, + i, + g, + l, + j, + c, + d; + (j = f ? f.max.y + f.min.y : this.textHeight), + (e.font = this.font = this.textHeight + "px " + this.textFont), + (l = this.MeasureText(e)), + a.txtOpt && + ((b = a.txtScale), + (k = b * this.textHeight), + (h = k + "px " + this.textFont), + (i = [b * a.shadowOffset[0], b * a.shadowOffset[1]]), + (e.font = h), + (g = this.MeasureText(e)), + (d = new O( + this.text, + h, + g + b, + b * j + b, + g, + this.line_widths, + a.textAlign, + a.textVAlign, + b, + )), + this.image && + d.SetImage( + this.image, + this.iw, + this.ih, + a.imagePosition, + a.imagePadding, + a.imageAlign, + a.imageVAlign, + a.imageScale, + ), + (c = d.Create( + this.colour, + this.bgColour, + this.bgOutline, + b * this.bgOutlineThickness, + a.shadow, + b * a.shadowBlur, + i, + b * this.padding, + b * this.bgRadius, + )), + a.outlineMethod == "colour" + ? (this.oimage = d.Create( + this.outline.colour, + this.bgColour, + this.outline.colour, + b * this.bgOutlineThickness, + a.shadow, + b * a.shadowBlur, + i, + b * this.padding, + b * this.bgRadius, + )) + : a.outlineMethod == "size" && + ((f = ae( + this.text, + this.textFont, + this.textHeight + a.outlineIncrease, + )), + (k = f.max.y + f.min.y), + (h = + b * (this.textHeight + a.outlineIncrease) + + "px " + + this.textFont), + (e.font = h), + (g = this.MeasureText(e)), + (d = new O( + this.text, + h, + g + b, + b * k + b, + g, + this.line_widths, + a.textAlign, + a.textVAlign, + b, + )), + this.image && + d.SetImage( + this.image, + this.iw + a.outlineIncrease, + this.ih + a.outlineIncrease, + a.imagePosition, + a.imagePadding, + a.imageAlign, + a.imageVAlign, + a.imageScale, + ), + (this.oimage = d.Create( + this.colour, + this.bgColour, + this.bgOutline, + b * this.bgOutlineThickness, + a.shadow, + b * a.shadowBlur, + i, + b * this.padding, + b * this.bgRadius, + )), + (this.oscale = this.oimage.width / c.width), + a.outlineIncrease > 0 + ? (c = H(c, this.oimage.width, this.oimage.height)) + : (this.oimage = H(this.oimage, c.width, c.height))), + c && + ((this.fimage = c), + (l = this.fimage.width / b), + (j = this.fimage.height / b)), + this.SetDraw(a), + (a.txtOpt = !!this.fimage)), + (this.h = j), + (this.w = l); + }), + (d.SetFont = function (a, b, c, d) { + (this.textFont = a), + (this.colour = b), + (this.bgColour = c), + (this.bgOutline = d), + this.Measure(this.tc.ctxt, this.tc); + }), + (d.SetWeight = function (c) { + var b = this.tc, + e = b.weightMode.split(/[, ]/), + d, + a, + f = c.length; + if (!this.HasText()) return; + this.weighted = !0; + for (a = 0; a < f; ++a) + (d = e[a] || "size"), + "both" == d + ? (this.Weight( + c[a], + b.ctxt, + b, + "size", + b.min_weight[a], + b.max_weight[a], + a, + ), + this.Weight( + c[a], + b.ctxt, + b, + "colour", + b.min_weight[a], + b.max_weight[a], + a, + )) + : this.Weight( + c[a], + b.ctxt, + b, + d, + b.min_weight[a], + b.max_weight[a], + a, + ); + this.Measure(b.ctxt, b); + }), + (d.Weight = function (b, i, a, d, f, h, e) { + b = isNaN(b) ? 1 : b; + var c = (b - f) / (h - f); + "colour" == d + ? (this.colour = L(a, c, e)) + : "bgcolour" == d + ? (this.bgColour = L(a, c, e)) + : "bgoutline" == d + ? (this.bgOutline = L(a, c, e)) + : "outline" == d + ? (this.outline.colour = L(a, c, e)) + : "size" == d && + (a.weightSizeMin > 0 && a.weightSizeMax > a.weightSizeMin + ? (this.textHeight = + a.weightSize * + (a.weightSizeMin + (a.weightSizeMax - a.weightSizeMin) * c)) + : (this.textHeight = g(1, b * a.weightSize))); + }), + (d.SetShadowColourFixed = function (a, b, c) { + a.shadowColor = b; + }), + (d.SetShadowColourAlpha = function (a, b, c) { + a.shadowColor = aE(b, c); + }), + (d.DrawText = function (a, h, i) { + var e = this.tc, + g = this.x, + f = this.y, + c = this.sc, + b, + d; + (a.globalAlpha = this.alpha), + (a.fillStyle = this.colour), + e.shadow && this.SetShadowColour(a, e.shadow, this.alpha), + (a.font = this.font), + (g += h / c), + (f += i / c - this.h / 2); + for (b = 0; b < this.text.length; ++b) + (d = g), + "right" == e.textAlign + ? (d += this.w / 2 - this.line_widths[b]) + : "centre" == e.textAlign + ? (d -= this.line_widths[b] / 2) + : (d -= this.w / 2), + a.setTransform(c, 0, 0, c, c * d, c * f), + a.fillText(this.text[b], 0, 0), + (f += this.textHeight); + }), + (d.DrawImage = function (b, i, k, l) { + var e = this.x, + f = this.y, + a = this.sc, + j = l || this.fimage, + c = this.w, + d = this.h, + g = this.alpha, + h = this.shadow; + (b.globalAlpha = g), + h && this.SetShadowColour(b, h, g), + (e += i / a - c / 2), + (f += k / a - d / 2), + b.setTransform(a, 0, 0, a, a * e, a * f), + b.drawImage(j, 0, 0, c, d); + }), + (d.DrawImageIE = function (b, d, e) { + var c = this.fimage, + a = this.sc, + f = (c.width = this.w * a), + g = (c.height = this.h * a), + h = this.x * a + d - f / 2, + i = this.y * a + e - g / 2; + b.setTransform(1, 0, 0, 1, 0, 0), + (b.globalAlpha = this.alpha), + b.drawImage(c, h, i); + }), + (d.Calc = function (g, e) { + var a, + b = this.tc, + d = b.minBrightness, + f = b.maxBrightness, + c = b.max_radius; + return ( + (a = g.xform(this.position)), + (this.xformed = a), + (a = aI(b, a, b.stretchX, b.stretchY)), + (this.x = a.x), + (this.y = a.y), + (this.z = a.z), + (this.sc = a.w), + (this.alpha = e * G(d + ((f - d) * (c - this.z)) / (2 * c), 0, 1)), + this.xformed + ); + }), + (d.UpdateActive = function (h, e, f) { + var a = this.outline, + b = this.w, + c = this.h, + d = this.x - b / 2, + g = this.y - c / 2; + return a.Update(d, g, b, c, this.sc, this.z, e, f), a; + }), + (d.CheckActive = function (a, d, e) { + var b = this.tc, + c = this.UpdateActive(a, d, e); + return c.Active(a, b.mx, b.my) ? c : null; + }), + (d.Clicked = function (f) { + var b = this.a, + a = b.target, + d = b.href, + e; + if (a != "" && a != "_self") { + if (self.frames[a]) self.frames[a].document.location = d; + else { + try { + if (top.frames[a]) { + top.frames[a].document.location = d; + return; + } + } catch (a) {} + window.open(d, a); + } + return; + } + if (c.createEvent) { + if ( + ((e = c.createEvent("MouseEvents")), + e.initMouseEvent( + "click", + 1, + 1, + window, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + null, + ), + !b.dispatchEvent(e)) + ) + return; + } else if (b.fireEvent) if (!b.fireEvent("onclick")) return; + c.location = d; + }), + (d.StopAudio = function () { + this.audio && this.playing && this.audio.pause(), + (this.stopped = 1), + (this.playing = 0); + }), + (d.PlayAudio = function () { + if (e === "off" || this.tc.audioOff) return; + if (!e && !ag()) return; + var a = this.tc.audio, + c = this.tc.gain, + d = "suspended", + b; + if (this.audio) + if ( + (this.track || + ((this.track = e.createMediaElementSource(this.audio)), + (this.gain = e.createGain()), + this.track.connect(this.gain), + this.gain.connect(e.destination)), + (a = this.audio), + (c = this.gain), + !a.paused) + ) + return 1; + if (a) { + if ((e.state == d && e.resume(), e.state == d)) return; + return ( + (c.gain.value = h(2, g(0, this.tc.audioVolume * 1))), + (a.currentTime = 0), + (this.stopped = 0), + (b = a.play()), + b !== void 0 && + b.then((a) => { + this.stopped ? this.audio.pause() : (this.playing = 1); + }), + 1 + ); + } + }); + function a(f, o, k) { + var d, + i, + b = c.getElementById(f), + l = ["id", "class", "innerHTML"]; + if (!b) throw 0; + if ( + (n(window.G_vmlCanvasManager) && + ((b = window.G_vmlCanvasManager.initElement(b)), + (this.ie = parseFloat(navigator.appVersion.split("MSIE")[1]))), + b && (!b.getContext || !b.getContext("2d").fillText)) + ) { + i = c.createElement("DIV"); + for (d = 0; d < l.length; ++d) i[l[d]] = b[l[d]]; + throw (b.parentNode.insertBefore(i, b), b.parentNode.removeChild(b), 0); + } + for (d in a.options) + this[d] = k && n(k[d]) ? k[d] : n(a[d]) ? a[d] : a.options[d]; + if ( + ((this.canvas = b), + (this.ctxt = b.getContext("2d")), + (this.z1 = 250 / g(this.depth, 0.001)), + (this.z2 = this.z1 / this.zoom), + (this.radius = h(b.height, b.width) * 0.0075), + (this.max_radius = 100), + (this.max_weight = []), + (this.min_weight = []), + (this.textFont = this.textFont && Q(this.textFont)), + (this.textHeight *= 1), + (this.imageRadius = this.imageRadius.toString()), + (this.pulsateTo = G(this.pulsateTo, 0, 1)), + (this.minBrightness = G(this.minBrightness, 0, 1)), + (this.maxBrightness = G(this.maxBrightness, this.minBrightness, 1)), + (this.ctxt.textBaseline = "top"), + (this.lx = (this.lock + "").indexOf("x") + 1), + (this.ly = (this.lock + "").indexOf("y") + 1), + (this.frozen = this.dx = this.dy = this.fixedAnim = this.touchState = 0), + (this.fixedAlpha = 1), + (this.source = o || f), + (this.repeatTags = h(64, ~~this.repeatTags)), + (this.minTags = h(200, ~~this.minTags)), + ~~this.scrollPause > 0 + ? (a.scrollPause = ~~this.scrollPause) + : (this.scrollPause = 0), + this.minTags > 0 && + this.repeatTags < 1 && + (d = this.GetTags().length) && + (this.repeatTags = af(this.minTags / d) - 1), + (this.transform = m.Identity()), + (this.startTime = this.time = q()), + (this.mx = this.my = -1), + this.centreImage && av(this), + (this.Animate = this.dragControl + ? this.AnimateDrag + : this.AnimatePosition), + (this.animTiming = + typeof a[this.animTiming] == "function" + ? a[this.animTiming] + : a.Smooth), + this.shadowBlur || this.shadowOffset[0] || this.shadowOffset[1] + ? ((this.ctxt.shadowColor = this.shadow), + (this.shadow = this.ctxt.shadowColor), + (this.shadowAlpha = aD())) + : delete this.shadow, + this.activeAudio === !1 + ? (e = "off") + : this.activeAudio && this.LoadAudio(), + this.Load(), + o && + this.hideTags && + (function (b) { + a.loaded + ? b.HideTags() + : t( + "load", + function () { + b.HideTags(); + }, + window, + ); + })(this), + (this.yaw = this.initial ? this.initial[0] * this.maxSpeed : 0), + (this.pitch = this.initial ? this.initial[1] * this.maxSpeed : 0), + this.tooltip + ? ((this.ctitle = b.title), + (b.title = ""), + this.tooltip == "native" + ? (this.Tooltip = this.TooltipNative) + : ((this.Tooltip = this.TooltipDiv), + this.ttdiv || + ((this.ttdiv = c.createElement("div")), + (this.ttdiv.className = this.tooltipClass), + (this.ttdiv.style.position = "absolute"), + (this.ttdiv.style.zIndex = b.style.zIndex + 1), + t( + "mouseover", + function (a) { + a.target.style.display = "none"; + }, + this.ttdiv, + ), + c.body.appendChild(this.ttdiv)))) + : (this.Tooltip = this.TooltipNone), + !this.noMouse && !j[f]) + ) { + (j[f] = [ + ["mousemove", ad], + ["mouseout", an], + ["mouseup", aq], + ["touchstart", ar], + ["touchend", ac], + ["touchcancel", ac], + ["touchmove", au], + ]), + this.dragControl && + (j[f].push(["mousedown", ap]), j[f].push(["selectstart", x])), + this.wheelZoom && + (j[f].push(["mousewheel", ab]), j[f].push(["DOMMouseScroll", ab])), + this.scrollPause && j[f].push(["scroll", aw, window]); + for (d = 0; d < j[f].length; ++d) + (i = j[f][d]), t(i[0], i[1], i[2] ? i[2] : b); + } + a.started || + ((a.NextFrame = window.requestAnimationFrame ? az : aA), + (a.interval = this.interval), + a.NextFrame(this.interval), + (a.started = 1)); + } + (b = a.prototype), + (b.SourceElements = function () { + return c.querySelectorAll + ? c.querySelectorAll("#" + this.source) + : [c.getElementById(this.source)]; + }), + (b.HideTags = function () { + var b = this.SourceElements(), + a; + for (a = 0; a < b.length; ++a) b[a].style.display = "none"; + }), + (b.GetTags = function () { + var e = this.SourceElements(), + c, + f = [], + a, + b, + d; + for (d = 0; d <= this.repeatTags; ++d) + for (a = 0; a < e.length; ++a) { + c = e[a].getElementsByTagName("a"); + for (b = 0; b < c.length; ++b) f.push(c[b]); + } + return f; + }), + (b.Message = function (j) { + var g = [], + a, + f, + b = j.split(""), + d, + e, + h, + i; + for (a = 0; a < b.length; ++a) + b[a] != " " && + ((f = a - b.length / 2), + (d = c.createElement("A")), + (d.href = "#"), + (d.innerText = b[a]), + (h = 100 * o(f / 9)), + (i = -100 * l(f / 9)), + (e = new J( + this, + b[a], + d, + [h, 0, i], + 2, + 18, + "#000", + "#fff", + 0, + 0, + 0, + "monospace", + 2, + b[a], + )), + e.Init(), + g.push(e)); + return g; + }), + (b.AddAudio = function (b, c) { + if (e === "off") return; + var a = b.getElementsByTagName("audio"); + a.length && (c.SetAudio(a[0]), (this.hasAudio = 1)); + }), + (b.CreateTag = function (b) { + var e, + c, + a, + f, + d, + g, + h, + j, + k = [0, 0, 0], + l; + if ("text" != this.imageMode) + if (((e = b.getElementsByTagName("img")), e.length)) + if (((c = new Image()), (c.src = e[0].src), !this.imageMode)) + return ( + (a = new J(this, "", b, k, 0, 0)), + a.SetImage(c), + A(c, e[0], e[1], a, this), + this.AddAudio(b, a), + a + ); + if ( + ("image" != this.imageMode && + ((d = new V(b)), + (f = d.Lines()), + d.Empty() + ? (d = null) + : ((g = this.textFont || Q(i(b, "font-family"))), + this.splitWidth && + (f = d.SplitWidth( + this.splitWidth, + this.ctxt, + g, + this.textHeight, + )), + (h = + this.bgColour == "tag" + ? i(b, "background-color") + : this.bgColour), + (j = this.bgOutline == "tag" ? i(b, "color") : this.bgOutline))), + d || c) + ) + return ( + (a = new J( + this, + f, + b, + k, + 2, + this.textHeight + 2, + this.textColour || i(b, "color"), + h, + this.bgRadius, + j, + this.bgOutlineThickness, + g, + this.padding, + d && d.original, + )), + c ? (a.SetImage(c), A(c, e[0], e[1], a, this)) : a.Init(), + this.AddAudio(b, a), + a + ); + }), + (b.UpdateTag = function (a, b) { + var c = this.textColour || i(b, "color"), + d = this.textFont || Q(i(b, "font-family")), + e = this.bgColour == "tag" ? i(b, "background-color") : this.bgColour, + f = this.bgOutline == "tag" ? i(b, "color") : this.bgOutline; + (a.a = b), + (a.title = b.title), + (a.colour != c || + a.textFont != d || + a.bgColour != e || + a.bgOutline != f) && + a.SetFont(d, c, e, f); + }), + (b.Weight = function (d) { + var f = d.length, + c, + b, + a, + e = [], + g, + h = this.weightFrom ? this.weightFrom.split(/[, ]/) : [null], + i = h.length; + for (b = 0; b < f; ++b) { + e[b] = []; + for (a = 0; a < i; ++a) + (c = aj(d[b].a, h[a], this.textHeight)), + (!this.max_weight[a] || c > this.max_weight[a]) && + (this.max_weight[a] = c), + (!this.min_weight[a] || c < this.min_weight[a]) && + (this.min_weight[a] = c), + (e[b][a] = c); + } + for (a = 0; a < i; ++a) + this.max_weight[a] > this.min_weight[a] && (g = 1); + if (g) for (b = 0; b < f; ++b) d[b].SetWeight(e[b]); + }), + (b.Load = function () { + var c = this.GetTags(), + b = [], + d, + k, + l, + h, + i, + j, + f, + a, + e = [], + m = { sphere: aB, vcylinder: ax, hcylinder: aH, vring: aG, hring: aF }; + if (c.length) { + e.length = c.length; + for (a = 0; a < c.length; ++a) e[a] = a; + this.shuffleTags && ai(e), + (h = 100 * this.radiusX), + (i = 100 * this.radiusY), + (j = 100 * this.radiusZ), + (this.max_radius = g(h, g(i, j))); + for (a = 0; a < c.length; ++a) + (k = this.CreateTag(c[e[a]])), k && b.push(k); + this.weight && this.Weight(b, !0), + this.shapeArgs + ? (this.shapeArgs[0] = b.length) + : ((l = this.shape.toString().split(/[(),]/)), + (d = l.shift()), + typeof window[d] == "function" + ? (this.shape = window[d]) + : (this.shape = m[d] || m.sphere), + (this.shapeArgs = [b.length, h, i, j].concat(l))), + (f = this.shape.apply(this, this.shapeArgs)), + (this.listLength = b.length); + for (a = 0; a < b.length; ++a) + b[a].position = new s(f[a][0], f[a][1], f[a][2]); + } + this.noTagsMessage && + !b.length && + ((a = + this.imageMode && this.imageMode != "both" + ? this.imageMode + " " + : ""), + (b = this.Message("No " + a + "tags"))), + (this.taglist = b); + }), + (b.Update = function () { + var e = this.GetTags(), + d = [], + j = this.taglist, + k, + f = [], + c = [], + h, + i, + g, + a, + b; + if (!this.shapeArgs) return this.Load(); + if (e.length) { + (g = this.listLength = e.length), (i = j.length); + for (a = 0; a < i; ++a) d.push(j[a]), c.push(a); + for (a = 0; a < g; ++a) { + for (b = 0, k = 0; b < i; ++b) + j[b].EqualTo(e[a]) && (this.UpdateTag(d[b], e[a]), (k = c[b] = -1)); + k || f.push(a); + } + for (a = 0, b = 0; a < i; ++a) c[b] == -1 ? c.splice(b, 1) : ++b; + if (c.length) { + for (ai(c); c.length && f.length; ) + (a = c.shift()), (b = f.shift()), (d[a] = this.CreateTag(e[b])); + for ( + c.sort(function (a, b) { + return a - b; + }); + c.length; + ) + d.splice(c.pop(), 1); + } + for (b = d.length / (f.length + 1), a = 0; f.length; ) + d.splice(af(++a * b), 0, this.CreateTag(e[f.shift()])); + (this.shapeArgs[0] = g = d.length), + (h = this.shape.apply(this, this.shapeArgs)); + for (a = 0; a < g; ++a) + d[a].position = new s(h[a][0], h[a][1], h[a][2]); + this.weight && this.Weight(d); + } + this.taglist = d; + }), + (b.SetShadow = function (a) { + (a.shadowBlur = this.shadowBlur), + (a.shadowOffsetX = this.shadowOffset[0]), + (a.shadowOffsetY = this.shadowOffset[1]); + }), + (b.LoadAudio = function () { + if (!e && !ag()) return; + (this.audio = c.createElement("audio")), + (this.audio.src = this.activeAudio), + (this.track = e.createMediaElementSource(this.audio)), + (this.gain = e.createGain()), + this.track.connect(this.gain), + this.gain.connect(e.destination), + (this.hasAudio = 1), + (P = function (a) { + e.resume(), c.removeEventListener("click", P); + }), + c.addEventListener("click", P); + }), + (b.ShowAudioIcon = function () { + var a = this.audioIconSize, + c = this.canvas, + d = this.ctxt, + k = c.width - a - 3, + f = c.height - a - 3, + g = this.audioIconThickness, + h = "#000", + i = "#fff", + j = this.audioIconDark, + b = this.audioOff, + l = "suspended"; + if (!e) return; + b || (b = e.state === l), + this.audioIcon && + this.hasAudio && + ($(b, d, a, k, f, g + 1, j ? i : h), $(b, d, a, k, f, g, j ? h : i)); + }), + (b.CheckAudioIcon = function () { + var a = this.audioIconSize, + b = this.canvas, + c = this.audioIconThickness / 2, + d = b.width - a - 3 - c, + e = b.height - a - 3 - c; + if (this.audioIcon && this.mx >= d && this.my >= e) return !0; + }), + (b.ToggleAudio = function () { + var a = this.audioOff || (e && e.state === "suspended"); + a || (this.currentAudio && this.currentAudio.StopAudio()), + (this.audioOff = !a); + }), + (b.Draw = function (s) { + if (this.paused) return; + var l = this.canvas, + i = l.width, + j = l.height, + q = 0, + p = ((s - this.time) * a.interval) / 1e3, + h = i / 2 + this.offsetX, + g = j / 2 + this.offsetY, + d = this.ctxt, + b, + f, + c, + o = -1, + e = this.taglist, + k = e.length, + t = this.active && this.active.tag, + m = "", + u = this.frontSelect, + r = this.centreFunc == x, + n; + if (((this.time = s), this.frozen && this.drawn)) + return this.Animate(i, j, p); + (n = this.AnimateFixed()), d.setTransform(1, 0, 0, 1, 0, 0); + for (c = 0; c < k; ++c) e[c].Calc(this.transform, this.fixedAlpha); + if ( + ((e = ak(e, function (a, b) { + return b.z - a.z; + })), + n && this.fixedAnim.active) + ) + b = this.fixedAnim.tag.UpdateActive(d, h, g); + else if (((this.active = null), this.CheckAudioIcon())) m = "pointer"; + else { + for (c = 0; c < k; ++c) + (f = + this.mx >= 0 && + this.my >= 0 && + this.taglist[c].CheckActive(d, h, g)), + f && + f.sc > q && + (!u || f.z <= 0) && + ((b = f), (o = c), (b.tag = this.taglist[c]), (q = f.sc)); + this.active = b; + } + this.txtOpt || (this.shadow && this.SetShadow(d)), + d.clearRect(0, 0, i, j); + for (c = 0; c < k; ++c) { + if (!r && e[c].z <= 0) { + try { + this.centreFunc(d, i, j, h, g); + } catch (a) { + alert(a), (this.centreFunc = x); + } + r = !0; + } + (b && b.tag == e[c] && b.PreDraw(d, e[c], h, g)) || e[c].Draw(d, h, g), + b && b.tag == e[c] && b.PostDraw(d); + } + this.freezeActive && b + ? this.Freeze() + : (this.UnFreeze(), (this.drawn = k == this.listLength)), + this.fixedCallback && + (this.fixedCallback(this, this.fixedCallbackTag), + (this.fixedCallback = null)), + n || this.Animate(i, j, p), + b && + (b.LastDraw(d), + b.tag != t && + (this.currentAudio && + this.currentAudio != b.tag && + this.currentAudio.StopAudio(), + b.tag.PlayAudio() && (this.currentAudio = b.tag)), + (m = this.activeCursor)), + (l.style.cursor = m), + this.Tooltip(b, this.taglist[o]), + this.audioIcon && this.ShowAudioIcon(); + }), + (b.TooltipNone = function () {}), + (b.TooltipNative = function (b, a) { + b + ? (this.canvas.title = a && a.title ? a.title : "") + : (this.canvas.title = this.ctitle); + }), + (b.SetTTDiv = function (c, d) { + var a = this, + b = a.ttdiv.style; + c != a.ttdiv.innerHTML && (b.display = "none"), + (a.ttdiv.innerHTML = c), + d && (d.title = a.ttdiv.innerHTML), + b.display == "none" && + !a.tttimer && + (a.tttimer = setTimeout(function () { + var c = X(a.canvas.id); + (b.display = "block"), + (b.left = c.x + a.mx + "px"), + (b.top = c.y + a.my + 24 + "px"), + (a.tttimer = null); + }, a.tooltipDelay)); + }), + (b.TooltipDiv = function (b, a) { + b && a && a.title + ? this.SetTTDiv(a.title, a) + : !b && this.mx != -1 && this.my != -1 && this.ctitle.length + ? this.SetTTDiv(this.ctitle) + : (this.ttdiv.style.display = "none"); + }), + (b.Transform = function (c, a, b) { + if (a || b) { + var d = o(a), + e = l(a), + f = o(b), + g = l(b), + h = new m([g, 0, f, 0, 1, 0, -f, 0, g]), + i = new m([1, 0, 0, 0, e, -d, 0, d, e]); + c.transform = c.transform.mul(h.mul(i)); + } + }), + (b.AnimateFixed = function () { + var a, b, c, d, e; + return ( + !!(this.fadeIn && + ((b = q() - this.startTime), + b >= this.fadeIn + ? ((this.fadeIn = 0), (this.fixedAlpha = 1)) + : (this.fixedAlpha = b / this.fadeIn)), + this.fixedAnim) && + (this.fixedAnim.transform || + (this.fixedAnim.transform = this.transform), + (a = this.fixedAnim), + (b = q() - a.t0), + (c = a.angle), + d, + (e = this.animTiming(a.t, b)), + (this.transform = a.transform), + b >= a.t + ? ((this.fixedCallbackTag = a.tag), + (this.fixedCallback = a.cb), + (this.fixedAnim = this.yaw = this.pitch = 0)) + : (c *= e), + (d = m.Rotation(c, a.axis)), + (this.transform = this.transform.mul(d)), + this.fixedAnim != 0) + ); + }), + (b.AnimatePosition = function (g, h, f) { + var a = this, + d = a.mx, + e = a.my, + b, + c; + !a.frozen && d >= 0 && e >= 0 && d < g && e < h + ? ((b = a.maxSpeed), + (c = a.reverse ? -1 : 1), + a.lx || (a.yaw = ((d * 2 * b) / g - b) * c * f), + a.ly || (a.pitch = ((e * 2 * b) / h - b) * -c * f), + (a.initial = null)) + : a.initial || + (a.frozen && !a.freezeDecel ? (a.yaw = a.pitch = 0) : a.Decel(a)), + this.Transform(a, a.pitch, a.yaw); + }), + (b.AnimateDrag = function (d, e, c) { + var a = this, + b = (100 * c * a.maxSpeed) / a.max_radius / a.zoom; + a.dx || a.dy + ? (a.lx || (a.yaw = (a.dx * b) / a.stretchX), + a.ly || (a.pitch = (a.dy * -b) / a.stretchY), + (a.dx = a.dy = 0), + (a.initial = null)) + : a.initial || a.Decel(a), + this.Transform(a, a.pitch, a.yaw); + }), + (b.Freeze = function () { + this.frozen || + ((this.preFreeze = [this.yaw, this.pitch]), + (this.frozen = 1), + (this.drawn = 0)); + }), + (b.UnFreeze = function () { + this.frozen && + ((this.yaw = this.preFreeze[0]), + (this.pitch = this.preFreeze[1]), + (this.frozen = 0)); + }), + (b.Decel = function (a) { + var b = a.minSpeed, + c = p(a.yaw), + d = p(a.pitch); + !a.lx && c > b && (a.yaw = c > a.z0 ? a.yaw * a.decel : 0), + !a.ly && d > b && (a.pitch = d > a.z0 ? a.pitch * a.decel : 0); + }), + (b.Zoom = function (a) { + (this.z2 = this.z1 * (1 / a)), (this.drawn = 0); + }), + (b.Clicked = function (b) { + if (this.CheckAudioIcon()) { + this.ToggleAudio(); + return; + } + var a = this.active; + try { + a && + a.tag && + (this.clickToFront === !1 || this.clickToFront === null + ? a.tag.Clicked(b) + : this.TagToFront( + a.tag, + this.clickToFront, + function () { + a.tag.Clicked(b); + }, + !0, + )); + } catch (a) {} + }), + (b.Wheel = function (a) { + var b = this.zoom + this.zoomStep * (a ? 1 : -1); + (this.zoom = h(this.zoomMax, g(this.zoomMin, b))), this.Zoom(this.zoom); + }), + (b.BeginDrag = function (a) { + (this.down = K(a, this.canvas)), + (a.cancelBubble = !0), + (a.returnValue = !1), + a.preventDefault && a.preventDefault(); + }), + (b.Drag = function (e, a) { + if (this.dragControl && this.down) { + var d = this.dragThreshold * this.dragThreshold, + b = a.x - this.down.x, + c = a.y - this.down.y; + (this.dragging || b * b + c * c > d) && + ((this.dx = b), (this.dy = c), (this.dragging = 1), (this.down = a)); + } + return this.dragging; + }), + (b.EndDrag = function () { + var a = this.dragging; + return (this.dragging = this.down = null), a; + }); + function ah(a) { + var b = a.targetTouches[0], + c = a.targetTouches[1]; + return E(w(c.pageX - b.pageX, 2) + w(c.pageY - b.pageY, 2)); + } + (b.BeginPinch = function (a) { + (this.pinched = [ah(a), this.zoom]), a.preventDefault && a.preventDefault(); + }), + (b.Pinch = function (d) { + var b, + c, + a = this.pinched; + if (!a) return; + (c = ah(d)), + (b = (a[1] * c) / a[0]), + (this.zoom = h(this.zoomMax, g(this.zoomMin, b))), + this.Zoom(this.zoom); + }), + (b.EndPinch = function (a) { + this.pinched = null; + }), + (b.Pause = function () { + this.paused = !0; + }), + (b.Resume = function () { + this.paused = !1; + }), + (b.SetSpeed = function (a) { + (this.initial = a), + (this.yaw = a[0] * this.maxSpeed), + (this.pitch = a[1] * this.maxSpeed); + }), + (b.FindTag = function (a) { + if (!n(a)) return null; + if ((n(a.index) && (a = a.index), !B(a))) return this.taglist[a]; + var c, d, b; + n(a.id) + ? ((c = "id"), (d = a.id)) + : n(a.text) && ((c = "innerText"), (d = a.text)); + for (b = 0; b < this.taglist.length; ++b) + if (this.taglist[b].a[c] == d) return this.taglist[b]; + }), + (b.RotateTag = function (a, h, i, j, f, g) { + var b = a.Calc(this.transform, 1), + c = new s(b.x, b.y, b.z), + d = ay(i, h), + e = c.angle(d), + k = c.cross(d).unit(); + e == 0 + ? ((this.fixedCallbackTag = a), (this.fixedCallback = f)) + : (this.fixedAnim = { + angle: -e, + axis: k, + t: j, + t0: q(), + cb: f, + tag: a, + active: g, + }); + }), + (b.TagToFront = function (a, b, c, d) { + this.RotateTag(a, 0, 0, b, c, d); + }), + (b.Volume = function (a) { + this.audioVolume = a * 1; + }), + (a.Start = function (b, c, d) { + a.Delete(b), (a.tc[b] = new a(b, c, d)); + }); + function N(c, b) { + a.tc[b] && a.tc[b][c](); + } + (a.Linear = function (a, b) { + return b / a; + }), + (a.Smooth = function (a, b) { + return 0.5 - l((b * Math.PI) / a) / 2; + }), + (a.Pause = function (a) { + N("Pause", a); + }), + (a.Resume = function (a) { + N("Resume", a); + }), + (a.Reload = function (a) { + N("Load", a); + }), + (a.Update = function (a) { + N("Update", a); + }), + (a.SetSpeed = function (c, b) { + return ( + !!(B(b) && a.tc[c] && !isNaN(b[0]) && !isNaN(b[1])) && + (a.tc[c].SetSpeed(b), !0) + ); + }), + (a.TagToFront = function (c, b) { + return !!B(b) && ((b.lat = b.lng = 0), a.RotateTag(c, b)); + }), + (a.RotateTag = function (c, b) { + if (B(b) && a.tc[c]) { + isNaN(b.time) && (b.time = 500); + var d = a.tc[c].FindTag(b); + if (d) + return ( + a.tc[c].RotateTag(d, b.lat, b.lng, b.time, b.callback, b.active), !0 + ); + } + return !1; + }), + (a.Delete = function (b) { + var d, e; + if (j[b]) + if (((e = c.getElementById(b)), e)) + for (d = 0; d < j[b].length; ++d) am(j[b][d][0], j[b][d][1], e); + delete j[b], delete a.tc[b]; + }), + (a.tc = {}), + (a.options = { + z1: 2e4, + z2: 2e4, + z0: 2e-4, + freezeActive: !1, + freezeDecel: !1, + activeCursor: "pointer", + pulsateTo: 1, + pulsateTime: 3, + reverse: !1, + depth: 0.5, + maxSpeed: 0.05, + minSpeed: 0, + decel: 0.95, + interval: 20, + minBrightness: 0.1, + maxBrightness: 1, + outlineColour: "#ffff99", + outlineThickness: 2, + outlineOffset: 5, + outlineMethod: "outline", + outlineRadius: 0, + textColour: "#ff99ff", + textHeight: 15, + textFont: "Helvetica, Arial, sans-serif", + shadow: "#000", + shadowBlur: 0, + shadowOffset: [0, 0], + initial: null, + hideTags: !0, + zoom: 1, + weight: !1, + weightMode: "size", + weightFrom: null, + weightSize: 1, + weightSizeMin: null, + weightSizeMax: null, + weightGradient: { 0: "#f00", 0.33: "#ff0", 0.66: "#0f0", 1: "#00f" }, + txtOpt: !0, + txtScale: 2, + frontSelect: !1, + wheelZoom: !0, + zoomMin: 0.3, + zoomMax: 3, + zoomStep: 0.05, + shape: "sphere", + lock: null, + tooltip: null, + tooltipDelay: 300, + tooltipClass: "tctooltip", + radiusX: 1, + radiusY: 1, + radiusZ: 1, + stretchX: 1, + stretchY: 1, + offsetX: 0, + offsetY: 0, + shuffleTags: !1, + noSelect: !1, + noMouse: !1, + imageScale: 1, + paused: !1, + dragControl: !1, + dragThreshold: 4, + centreFunc: x, + splitWidth: 0, + animTiming: "Smooth", + clickToFront: !1, + fadeIn: 0, + padding: 0, + bgColour: null, + bgRadius: 0, + bgOutline: null, + bgOutlineThickness: 0, + outlineIncrease: 4, + textAlign: "centre", + textVAlign: "middle", + imageMode: null, + imagePosition: null, + imagePadding: 2, + imageAlign: "centre", + imageVAlign: "middle", + noTagsMessage: !0, + centreImage: null, + pinchZoom: !1, + repeatTags: 0, + minTags: 0, + imageRadius: 0, + scrollPause: !1, + outlineDash: 0, + outlineDashSpace: 0, + outlineDashSpeed: 1, + activeAudio: "", + audioVolume: 1, + audioIcon: 1, + audioIconSize: 20, + audioIconThickness: 2, + audioIconDark: 0, + altImage: 0, + }); + for (r in a.options) a[r] = a.options[r]; + (window.TagCanvas = a), + t( + "load", + function () { + a.loaded = 1; + }, + window, + ); +})(); diff --git a/packages/client/vite.config.ts b/packages/client/vite.config.ts index f4d04e5ec..f2d3209d6 100644 --- a/packages/client/vite.config.ts +++ b/packages/client/vite.config.ts @@ -1,20 +1,37 @@ -import * as fs from 'fs'; -import pluginVue from '@vitejs/plugin-vue'; -import { defineConfig } from 'vite'; +import * as fs from "fs"; +import pluginVue from "@vitejs/plugin-vue"; +import { defineConfig } from "vite"; -import locales from '../../locales'; -import meta from '../../package.json'; -import pluginJson5 from './vite.json5'; -import viteCompression from 'vite-plugin-compression'; +import locales from "../../locales"; +import meta from "../../package.json"; +import pluginJson5 from "./vite.json5"; +import viteCompression from "vite-plugin-compression"; -const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.json', '.json5', '.svg', '.sass', '.scss', '.css', '.vue']; +const extensions = [ + ".ts", + ".tsx", + ".js", + ".jsx", + ".mjs", + ".json", + ".json5", + ".svg", + ".sass", + ".scss", + ".css", + ".vue", +]; export default defineConfig(({ command, mode }) => { - fs.mkdirSync(__dirname + '/../../built', { recursive: true }); - fs.writeFileSync(__dirname + '/../../built/meta.json', JSON.stringify({ version: meta.version }), 'utf-8'); + fs.mkdirSync(__dirname + "/../../built", { recursive: true }); + fs.writeFileSync( + __dirname + "/../../built/meta.json", + JSON.stringify({ version: meta.version }), + "utf-8", + ); return { - base: '/assets/', + base: "/assets/", plugins: [ pluginVue({ @@ -22,56 +39,53 @@ export default defineConfig(({ command, mode }) => { }), pluginJson5(), viteCompression({ - algorithm: 'brotliCompress' + algorithm: "brotliCompress", }), ], resolve: { extensions, alias: { - '@/': __dirname + '/src/', - '/client-assets/': __dirname + '/assets/', - '/static-assets/': __dirname + '/../backend/assets/', + "@/": __dirname + "/src/", + "/client-assets/": __dirname + "/assets/", + "/static-assets/": __dirname + "/../backend/assets/", }, }, define: { _VERSION_: JSON.stringify(meta.version), - _LANGS_: JSON.stringify(Object.entries(locales).map(([k, v]) => [k, v._lang_])), + _LANGS_: JSON.stringify( + Object.entries(locales).map(([k, v]) => [k, v._lang_]), + ), _ENV_: JSON.stringify(process.env.NODE_ENV), - _DEV_: process.env.NODE_ENV !== 'production', - _PERF_PREFIX_: JSON.stringify('Misskey:'), - _DATA_TRANSFER_DRIVE_FILE_: JSON.stringify('mk_drive_file'), - _DATA_TRANSFER_DRIVE_FOLDER_: JSON.stringify('mk_drive_folder'), - _DATA_TRANSFER_DECK_COLUMN_: JSON.stringify('mk_deck_column'), + _DEV_: process.env.NODE_ENV !== "production", + _PERF_PREFIX_: JSON.stringify("Misskey:"), + _DATA_TRANSFER_DRIVE_FILE_: JSON.stringify("mk_drive_file"), + _DATA_TRANSFER_DRIVE_FOLDER_: JSON.stringify("mk_drive_folder"), + _DATA_TRANSFER_DECK_COLUMN_: JSON.stringify("mk_deck_column"), __VUE_OPTIONS_API__: true, __VUE_PROD_DEVTOOLS__: false, }, build: { - target: [ - 'chrome87', - 'firefox78', - 'safari14', - 'es2017', - ], - manifest: 'manifest.json', + target: ["chrome87", "firefox78", "safari14", "es2017"], + manifest: "manifest.json", rollupOptions: { input: { - app: './src/init.ts', + app: "./src/init.ts", }, output: { manualChunks: { - vue: ['vue'], + vue: ["vue"], }, }, }, cssCodeSplit: true, assetsInlineLimit: 0, - outDir: __dirname + '/../../built/_client_dist_', - assetsDir: '.', + outDir: __dirname + "/../../built/_client_dist_", + assetsDir: ".", emptyOutDir: false, - sourcemap: process.env.NODE_ENV === 'development', + sourcemap: process.env.NODE_ENV === "development", reportCompressedSize: false, }, optimizeDeps: { diff --git a/packages/client/vite.json5.ts b/packages/client/vite.json5.ts index e4f1c7123..8653c66d8 100644 --- a/packages/client/vite.json5.ts +++ b/packages/client/vite.json5.ts @@ -1,9 +1,9 @@ // Original: https://github.com/rollup/plugins/tree/8835dd2aed92f408d7dc72d7cc25a9728e16face/packages/json -import JSON5 from 'json5'; -import { Plugin } from 'rollup'; -import { createFilter, dataToEsm } from '@rollup/pluginutils'; -import { RollupJsonOptions } from '@rollup/plugin-json'; +import JSON5 from "json5"; +import { Plugin } from "rollup"; +import { createFilter, dataToEsm } from "@rollup/pluginutils"; +import { RollupJsonOptions } from "@rollup/plugin-json"; interface Json5SyntaxError extends SyntaxError { lineNumber: number; @@ -12,13 +12,13 @@ interface Json5SyntaxError extends SyntaxError { export default function json5(options: RollupJsonOptions = {}): Plugin { const filter = createFilter(options.include, options.exclude); - const indent = 'indent' in options ? options.indent : '\t'; + const indent = "indent" in options ? options.indent : "\t"; return { - name: 'json5', + name: "json5", transform(json, id) { - if (id.slice(-6) !== '.json5' || !filter(id)) return null; + if (id.slice(-6) !== ".json5" || !filter(id)) return null; try { const parsed = JSON5.parse(json); @@ -29,15 +29,19 @@ export default function json5(options: RollupJsonOptions = {}): Plugin { namedExports: options.namedExports, indent, }), - map: { mappings: '' }, + map: { mappings: "" }, }; } catch (err) { if (!(err instanceof SyntaxError)) { throw err; } - const message = 'Could not parse JSON5 file'; + const message = "Could not parse JSON5 file"; const { lineNumber, columnNumber } = err as Json5SyntaxError; - this.warn({ message, id, loc: { line: lineNumber, column: columnNumber } }); + this.warn({ + message, + id, + loc: { line: lineNumber, column: columnNumber }, + }); return null; } }, diff --git a/packages/sw/webpack.config.js b/packages/sw/webpack.config.js index 8c9cc6e06..3443585d9 100644 --- a/packages/sw/webpack.config.js +++ b/packages/sw/webpack.config.js @@ -1,48 +1,50 @@ const webpack = require("webpack"); -const path = require('path'); -const locales = require('../../locales'); -const meta = require('../../package.json'); +const path = require("path"); +const locales = require("../../locales"); +const meta = require("../../package.json"); const isProduction = process.env.NODE_ENV === "production"; module.exports = { - mode: isProduction ? "production" : "development", - stats: "errors-only", - entry: "./src/sw.ts", - output: { - path: path.resolve(__dirname, "../../built/_sw_dist_"), - filename: "sw.js" - }, - resolve: { - extensions: [".js", ".ts"], - }, - module: { - rules: [ - { - test: /\.ts$/, - exclude: /(node_modules|bower_components)/, - use: { - loader: "swc-loader", - options: { - // This makes swc-loader invoke swc synchronously. - sync: true, - jsc: { - parser: { - syntax: "typescript" - } - } - } - } - } - ] - }, - plugins: [ - new webpack.DefinePlugin({ - _VERSION_: JSON.stringify(meta.version), - _LANGS_: JSON.stringify(Object.entries(locales).map(([k, v]) => [k, v._lang_])), - _ENV_: JSON.stringify(process.env.NODE_ENV), - _DEV_: !isProduction, - _PERF_PREFIX_: JSON.stringify('Calckey:'), - }) - ] -} + mode: isProduction ? "production" : "development", + stats: "errors-only", + entry: "./src/sw.ts", + output: { + path: path.resolve(__dirname, "../../built/_sw_dist_"), + filename: "sw.js", + }, + resolve: { + extensions: [".js", ".ts"], + }, + module: { + rules: [ + { + test: /\.ts$/, + exclude: /(node_modules|bower_components)/, + use: { + loader: "swc-loader", + options: { + // This makes swc-loader invoke swc synchronously. + sync: true, + jsc: { + parser: { + syntax: "typescript", + }, + }, + }, + }, + }, + ], + }, + plugins: [ + new webpack.DefinePlugin({ + _VERSION_: JSON.stringify(meta.version), + _LANGS_: JSON.stringify( + Object.entries(locales).map(([k, v]) => [k, v._lang_]), + ), + _ENV_: JSON.stringify(process.env.NODE_ENV), + _DEV_: !isProduction, + _PERF_PREFIX_: JSON.stringify("Calckey:"), + }), + ], +};