[baackend] Move migrations to typescript

This commit is contained in:
Laura Hausmann 2023-10-13 18:17:29 +02:00
parent b335fda4b0
commit 1927151aed
Signed by: zotan
GPG Key ID: D044E84C5BE01605
217 changed files with 941 additions and 745 deletions

View File

@ -253,7 +253,7 @@ MongoDBは`null`で返してきてたので、その感覚で`if (x === null)`
### Migration作成方法
packages/backendで:
```sh
pnpm dlx typeorm migration:generate -d ormconfig.js -o <migration name>
yarn workspace backend run generatemigration src/migration/<migration name>
```
- 生成後、ファイルをmigration下に移してください

View File

@ -1,10 +0,0 @@
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"`);
}
}

View File

@ -1,10 +0,0 @@
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"`);
}
}

View File

@ -1,12 +0,0 @@
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"`,
);
}
}

View File

@ -1,12 +0,0 @@
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"`,
);
}
}

View File

@ -1,10 +0,0 @@
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"`);
}
}

View File

@ -1,14 +0,0 @@
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,
);
}
}

View File

@ -1,13 +0,0 @@
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"`);
}
}

View File

@ -1,9 +0,0 @@
export class deleteLog1634902659689 {
constructor() {
this.name = "deleteLog1634902659689";
}
async up(queryRunner) {
await queryRunner.query(`DROP TABLE "log"`);
}
async down(queryRunner) {}
}

View File

@ -1,13 +0,0 @@
export class removeViaMobile1636697408073 {
name = "removeViaMobile1636697408073";
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`,
);
}
}

View File

@ -1,13 +0,0 @@
export class instanceThemeColor1644395759931 {
name = "instanceThemeColor1644395759931";
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"`);
}
}

View File

@ -1,10 +0,0 @@
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"`);
}
}

View File

@ -1,12 +0,0 @@
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"`,
);
}
}

View File

@ -1,10 +0,0 @@
export class Page1668828368510 {
async up(queryRunner) {
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"`);
}
}

View File

@ -1,15 +0,0 @@
export class FixFirefishAgain1668831378728 {
name = "FixFirefishAgain1668831378728";
async up(queryRunner) {
await queryRunner.query(
`UPDATE "meta" SET "useStarForReactionFallback" = TRUE`,
);
}
async down(queryRunner) {
await queryRunner.query(
`UPDATE "meta" SET "useStarForReactionFallback" = FALSE`,
);
}
}

View File

@ -1,13 +0,0 @@
export class addPropsForCustomEmoji1678945242650 {
name = "addPropsForCustomEmoji1678945242650";
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"`);
}
}

View File

@ -1,10 +0,0 @@
export class IndexNoteUrl1695748502971 {
name = "IndexNoteUrl1695748502971";
async up(queryRunner) {
await queryRunner.query(`CREATE INDEX IF NOT EXISTS "IDX_note_url" ON "note" ("url") `);
}
async down(queryRunner) {
await queryRunner.query(`DROP INDEX IF EXISTS "IDX_note_url"`);
}
}

View File

@ -1,10 +0,0 @@
export class IndexNoteUserId1695861526125 {
name = "IndexNoteUserId1695861526125";
async up(queryRunner) {
await queryRunner.query(`CREATE INDEX "IDX_note_userId_id" ON "note" ("userId", "id")`);
}
async down(queryRunner) {
await queryRunner.query(`DROP INDEX "IDX_note_userId_id"`);
}
}

View File

@ -6,10 +6,9 @@
"scripts": {
"start": "node ./built/index.js",
"start:test": "NODE_ENV=test node ./built/index.js",
"migrate": "yarn migrate:typeorm",
"migrate:typeorm": "typeorm migration:run -d ormconfig.js",
"revertmigration": "yarn revertmigration:typeorm",
"revertmigration:typeorm": "typeorm migration:revert -d ormconfig.js",
"migrate": "typeorm migration:run -d built/ormconfig.js",
"revertmigration": "typeorm migration:revert -d built/ormconfig.js",
"generatemigration": "yarn build && typeorm migration:generate -d built/ormconfig.js",
"check:connect": "node ./check_connect.js",
"build": "swc src -d built -D",
"build:debug": "swc src -d built -s -D",

View File

@ -1,5 +1,6 @@
export class Init1000000000000 {
async up(queryRunner) {
import { MigrationInterface, QueryRunner } from "typeorm";
export class Init1000000000000 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TYPE "log_level_enum" AS ENUM('error', 'warning', 'info', 'success', 'debug')`,
);
@ -712,7 +713,7 @@ export class Init1000000000000 {
`ALTER TABLE "user_profile" ADD CONSTRAINT "FK_51cb79b5555effaf7d69ba1cff9" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "user_profile" DROP CONSTRAINT "FK_51cb79b5555effaf7d69ba1cff9"`,
);

View File

@ -1,5 +1,6 @@
export class Pages1556348509290 {
async up(queryRunner) {
import { MigrationInterface, QueryRunner } from "typeorm";
export class Pages1556348509290 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TYPE "page_visibility_enum" AS ENUM('public', 'followers', 'specified')`,
);
@ -31,7 +32,7 @@ export class Pages1556348509290 {
`ALTER TABLE "page" ADD CONSTRAINT "FK_3126dd7c502c9e4d7597ef7ef10" FOREIGN KEY ("eyeCatchingImageId") REFERENCES "drive_file"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "page" DROP CONSTRAINT "FK_3126dd7c502c9e4d7597ef7ef10"`,
);

View File

@ -1,5 +1,6 @@
export class UserProfile1556746559567 {
async up(queryRunner) {
import { MigrationInterface, QueryRunner } from "typeorm";
export class UserProfile1556746559567 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "user_profile" ALTER COLUMN "githubId" TYPE VARCHAR(64) USING "githubId"::VARCHAR(64)`,
);
@ -7,7 +8,7 @@ export class UserProfile1556746559567 {
`ALTER TABLE "user_profile" ALTER COLUMN "discordExpiresDate" TYPE VARCHAR(64) USING "discordExpiresDate"::VARCHAR(64)`,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`UPDATE "user_profile" SET github = FALSE, discord = FALSE`,
);

View File

@ -0,0 +1,11 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class PinnedUsers1557476068003 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "meta" ADD "pinnedUsers" character varying(256) array NOT NULL DEFAULT '{}'::varchar[]`,
);
}
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "pinnedUsers"`);
}
}

View File

@ -1,5 +1,6 @@
export class AddSomeUrls1557761316509 {
async up(queryRunner) {
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddSomeUrls1557761316509 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "meta" ADD "ToSUrl" character varying(512)`,
);
@ -10,7 +11,7 @@ export class AddSomeUrls1557761316509 {
`ALTER TABLE "meta" ADD "feedbackUrl" character varying(512) DEFAULT 'https://codeberg.org/firefish/firefish/issues'`,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
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"`);

View File

@ -1,5 +1,6 @@
export class ObjectStorageSetting1557932705754 {
async up(queryRunner) {
import { MigrationInterface, QueryRunner } from "typeorm";
export class ObjectStorageSetting1557932705754 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "meta" ADD "useObjectStorage" boolean NOT NULL DEFAULT false`,
);
@ -31,7 +32,7 @@ export class ObjectStorageSetting1557932705754 {
`ALTER TABLE "meta" ADD "objectStorageUseSSL" boolean NOT NULL DEFAULT true`,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "meta" DROP COLUMN "objectStorageUseSSL"`,
);

View File

@ -1,5 +1,6 @@
export class PageLike1558072954435 {
async up(queryRunner) {
import { MigrationInterface, QueryRunner } from "typeorm";
export class PageLike1558072954435 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
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"))`,
);
@ -19,7 +20,7 @@ export class PageLike1558072954435 {
`ALTER TABLE "page_like" ADD CONSTRAINT "FK_cf8782626dced3176038176a847" FOREIGN KEY ("pageId") REFERENCES "page"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "page_like" DROP CONSTRAINT "FK_cf8782626dced3176038176a847"`,
);

View File

@ -1,5 +1,6 @@
export class UserGroup1558103093633 {
async up(queryRunner) {
import { MigrationInterface, QueryRunner } from "typeorm";
export class UserGroup1558103093633 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
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"))`,
);
@ -46,7 +47,7 @@ export class UserGroup1558103093633 {
`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) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "user_group_joining" DROP CONSTRAINT "FK_67dc758bc0566985d1b3d399865"`,
);

View File

@ -1,5 +1,6 @@
export class UserGroupInvite1558257926829 {
async up(queryRunner) {
import { MigrationInterface, QueryRunner } from "typeorm";
export class UserGroupInvite1558257926829 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
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"))`,
);
@ -22,7 +23,7 @@ export class UserGroupInvite1558257926829 {
`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) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "user_group_invite" DROP CONSTRAINT "FK_e10924607d058004304611a436a"`,
);

View File

@ -0,0 +1,11 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UserListJoining1558266512381 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE UNIQUE INDEX "IDX_90f7da835e4c10aca6853621e1" ON "user_list_joining" ("userId", "userListId") `,
);
}
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP INDEX "IDX_90f7da835e4c10aca6853621e1"`);
}
}

View File

@ -1,5 +1,6 @@
export class webauthn1561706992953 {
async up(queryRunner) {
import { MigrationInterface, QueryRunner } from "typeorm";
export class webauthn1561706992953 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
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"))`,
);
@ -28,7 +29,7 @@ export class webauthn1561706992953 {
`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) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "user_security_key" DROP CONSTRAINT "FK_ff9ca3b5f3ee3d0681367a9b447"`,
);

View File

@ -1,5 +1,6 @@
export class ChartIndexes1561873850023 {
async up(queryRunner) {
import { MigrationInterface, QueryRunner } from "typeorm";
export class ChartIndexes1561873850023 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE INDEX "IDX_0ad37b7ef50f4ddc84363d7ccc" ON "__chart__active_users" ("date") `,
);
@ -271,7 +272,7 @@ export class ChartIndexes1561873850023 {
`CREATE INDEX "IDX_a770a57c70e668cc61590c9161" ON "__chart__users" ("span", "date", "group") `,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP INDEX "IDX_a770a57c70e668cc61590c9161"`);
await queryRunner.query(`DROP INDEX "IDX_337e9599f278bd7537fe30876f"`);
await queryRunner.query(`DROP INDEX "IDX_f091abb24193d50c653c6b77fc"`);

View File

@ -0,0 +1,13 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class PasswordLessLogin1562422242907 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "user_profile" ADD COLUMN "usePasswordLessLogin" boolean DEFAULT false NOT NULL`,
);
}
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "user_profile" DROP COLUMN "usePasswordLessLogin"`,
);
}
}

View File

@ -1,5 +1,6 @@
export class PinnedPage1562444565093 {
async up(queryRunner) {
import { MigrationInterface, QueryRunner } from "typeorm";
export class PinnedPage1562444565093 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "user_profile" ADD "pinnedPageId" character varying(32)`,
);
@ -10,7 +11,7 @@ export class PinnedPage1562444565093 {
`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) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "user_profile" DROP CONSTRAINT "FK_6dc44f1ceb65b1e72bacef2ca27"`,
);

View File

@ -0,0 +1,13 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class PageTitleHideOption1562448332510 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "page" ADD "hideTitleWhenPinned" boolean NOT NULL DEFAULT false`,
);
}
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "page" DROP COLUMN "hideTitleWhenPinned"`,
);
}
}

View File

@ -1,5 +1,6 @@
export class ModerationLog1562869971568 {
async up(queryRunner) {
import { MigrationInterface, QueryRunner } from "typeorm";
export class ModerationLog1562869971568 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
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"))`,
);
@ -10,7 +11,7 @@ export class ModerationLog1562869971568 {
`ALTER TABLE "moderation_log" ADD CONSTRAINT "FK_a08ad074601d204e0f69da9a954" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "moderation_log" DROP CONSTRAINT "FK_a08ad074601d204e0f69da9a954"`,
);

View File

@ -1,10 +1,11 @@
export class UsedUsername1563757595828 {
async up(queryRunner) {
import { MigrationInterface, QueryRunner } from "typeorm";
export class UsedUsername1563757595828 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
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) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE "used_username"`);
}
}

View File

@ -0,0 +1,11 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class room1565634203341 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "user_profile" ADD "room" jsonb NOT NULL DEFAULT '{}'`,
);
}
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "room"`);
}
}

View File

@ -0,0 +1,15 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class CustomEmojiCategory1571220798684 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "emoji" ADD "category" character varying(128)`,
undefined,
);
}
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "emoji" DROP COLUMN "category"`,
undefined,
);
}
}

View File

@ -1,5 +1,6 @@
export class nodeinfo1572760203493 {
async up(queryRunner) {
import { MigrationInterface, QueryRunner } from "typeorm";
export class nodeinfo1572760203493 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "instance" DROP COLUMN "system"`,
undefined,
@ -37,7 +38,7 @@ export class nodeinfo1572760203493 {
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "instance" DROP COLUMN "infoUpdatedAt"`,
undefined,

View File

@ -1,14 +1,15 @@
export class TalkFederationId1576269851876 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class TalkFederationId1576269851876 implements MigrationInterface {
constructor() {
this.name = "TalkFederationId1576269851876";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "messaging_message" ADD "uri" character varying(512)`,
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "messaging_message" DROP COLUMN "uri"`,
undefined,

View File

@ -1,14 +1,15 @@
export class ProxyRemoteFiles1576869585998 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class ProxyRemoteFiles1576869585998 implements MigrationInterface {
constructor() {
this.name = "ProxyRemoteFiles1576869585998";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "meta" ADD "proxyRemoteFiles" boolean NOT NULL DEFAULT false`,
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "meta" DROP COLUMN "proxyRemoteFiles"`,
undefined,

View File

@ -1,8 +1,9 @@
export class v121579267006611 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class v121579267006611 implements MigrationInterface {
constructor() {
this.name = "v121579267006611";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
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,
@ -48,7 +49,7 @@ export class v121579267006611 {
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "announcement_read" DROP CONSTRAINT "FK_603a7b1e7aa0533c6c88e9bfafe"`,
undefined,

View File

@ -1,14 +1,15 @@
export class v1221579270193251 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class v1221579270193251 implements MigrationInterface {
constructor() {
this.name = "v1221579270193251";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "announcement_read" ADD "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL`,
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "announcement_read" DROP COLUMN "createdAt"`,
undefined,

View File

@ -1,14 +1,15 @@
export class v1231579282808087 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class v1231579282808087 implements MigrationInterface {
constructor() {
this.name = "v1231579282808087";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "announcement" ADD "updatedAt" TIMESTAMP WITH TIME ZONE`,
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "announcement" DROP COLUMN "updatedAt"`,
undefined,

View File

@ -1,8 +1,9 @@
export class v1241579544426412 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class v1241579544426412 implements MigrationInterface {
constructor() {
this.name = "v1241579544426412";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "notification" ADD "followRequestId" character varying(32)`,
undefined,
@ -12,7 +13,7 @@ export class v1241579544426412 {
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "notification" DROP CONSTRAINT "FK_bd7fab507621e635b32cd31892c"`,
undefined,

View File

@ -1,8 +1,9 @@
export class v1251579977526288 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class v1251579977526288 implements MigrationInterface {
constructor() {
this.name = "v1251579977526288";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
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,
@ -85,7 +86,7 @@ export class v1251579977526288 {
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "antenna_note" DROP CONSTRAINT "FK_0d775946662d2575dfd2068a5f5"`,
undefined,

View File

@ -1,8 +1,9 @@
export class v1261579993013959 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class v1261579993013959 implements MigrationInterface {
constructor() {
this.name = "v1261579993013959";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "antenna" DROP COLUMN "hasNewNote"`,
undefined,
@ -16,7 +17,7 @@ export class v1261579993013959 {
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`DROP INDEX "IDX_9937ea48d7ae97ffb4f3f063a4"`,
undefined,

View File

@ -1,8 +1,9 @@
export class v1271580069531114 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class v1271580069531114 implements MigrationInterface {
constructor() {
this.name = "v1271580069531114";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "antenna" ADD "users" character varying(1024) array NOT NULL DEFAULT '{}'::varchar[]`,
undefined,
@ -25,7 +26,7 @@ export class v1271580069531114 {
);
await queryRunner.query(`DROP TYPE "antenna_src_enum_old"`, undefined);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TYPE "antenna_src_enum_old" AS ENUM('home', 'all', 'list')`,
undefined,

View File

@ -1,8 +1,9 @@
export class v1281580148575182 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class v1281580148575182 implements MigrationInterface {
constructor() {
this.name = "v1281580148575182";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "note" DROP CONSTRAINT "FK_ec5c201576192ba8904c345c5cc"`,
undefined,
@ -12,7 +13,7 @@ export class v1281580148575182 {
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "note" ADD "appId" character varying(32)`,
undefined,

View File

@ -1,14 +1,15 @@
export class v1291580154400017 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class v1291580154400017 implements MigrationInterface {
constructor() {
this.name = "v1291580154400017";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "antenna" ADD "withReplies" boolean NOT NULL DEFAULT false`,
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "antenna" DROP COLUMN "withReplies"`,
undefined,

View File

@ -1,8 +1,9 @@
export class v12101580276619901 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class v12101580276619901 implements MigrationInterface {
constructor() {
this.name = "v12101580276619901";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`TRUNCATE TABLE "notification"`, undefined);
await queryRunner.query(
`ALTER TABLE "notification" DROP COLUMN "type"`,
@ -17,7 +18,7 @@ export class v12101580276619901 {
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "notification" DROP COLUMN "type"`,
undefined,

View File

@ -1,8 +1,9 @@
export class v12111580331224276 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class v12111580331224276 implements MigrationInterface {
constructor() {
this.name = "v12111580331224276";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "instance" DROP COLUMN "isMarkedAsClosed"`,
undefined,
@ -16,7 +17,7 @@ export class v12111580331224276 {
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`DROP INDEX "IDX_34500da2e38ac393f7bb6b299c"`,
undefined,

View File

@ -1,8 +1,9 @@
export class v12121580508795118 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class v12121580508795118 implements MigrationInterface {
constructor() {
this.name = "v12121580508795118";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "user_profile" DROP COLUMN "twitter"`,
undefined,
@ -72,7 +73,7 @@ export class v12121580508795118 {
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "user_profile" DROP COLUMN "integrations"`,
undefined,

View File

@ -1,14 +1,15 @@
export class v12131580543501339 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class v12131580543501339 implements MigrationInterface {
constructor() {
this.name = "v12131580543501339";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE INDEX "IDX_NOTE_TAGS" ON "note" USING gin ("tags")`,
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP INDEX "IDX_NOTE_TAGS"`, undefined);
}
}

View File

@ -1,8 +1,9 @@
export class v12141580864313253 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class v12141580864313253 implements MigrationInterface {
constructor() {
this.name = "v12141580864313253";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "meta" RENAME COLUMN "proxyAccount" TO "proxyAccountId"`,
undefined,
@ -20,7 +21,7 @@ export class v12141580864313253 {
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "meta" DROP CONSTRAINT "FK_ab1bc0c1e209daa77b8e8d212ad"`,
undefined,

View File

@ -1,8 +1,9 @@
export class userGroupInvitation1581526429287 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class userGroupInvitation1581526429287 implements MigrationInterface {
constructor() {
this.name = "userGroupInvitation1581526429287";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
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,
@ -56,7 +57,7 @@ export class userGroupInvitation1581526429287 {
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "notification" DROP CONSTRAINT "FK_8fe87814e978053a53b1beb7e98"`,
undefined,

View File

@ -1,8 +1,9 @@
export class userGroupAntenna1581695816408 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class userGroupAntenna1581695816408 implements MigrationInterface {
constructor() {
this.name = "userGroupAntenna1581695816408";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "antenna" ADD "userGroupJoiningId" character varying(32)`,
undefined,
@ -33,7 +34,7 @@ export class userGroupAntenna1581695816408 {
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "antenna" DROP CONSTRAINT "FK_ccbf5a8c0be4511133dcc50ddeb"`,
undefined,

View File

@ -1,14 +1,15 @@
export class driveUserFolderIdIndex1581708415836 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class driveUserFolderIdIndex1581708415836 implements MigrationInterface {
constructor() {
this.name = "driveUserFolderIdIndex1581708415836";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE INDEX "IDX_55720b33a61a7c806a8215b825" ON "drive_file" ("userId", "folderId", "id") `,
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`DROP INDEX "IDX_55720b33a61a7c806a8215b825"`,
undefined,

View File

@ -1,8 +1,9 @@
export class promo1581979837262 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class promo1581979837262 implements MigrationInterface {
constructor() {
this.name = "promo1581979837262";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
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,
@ -36,7 +37,7 @@ export class promo1581979837262 {
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "promo_read" DROP CONSTRAINT "FK_a46a1a603ecee695d7db26da5f4"`,
undefined,

View File

@ -1,14 +1,15 @@
export class featuredInjecttion1582019042083 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class featuredInjecttion1582019042083 implements MigrationInterface {
constructor() {
this.name = "featuredInjecttion1582019042083";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "user_profile" ADD "injectFeaturedNote" boolean NOT NULL DEFAULT true`,
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "user_profile" DROP COLUMN "injectFeaturedNote"`,
undefined,

View File

@ -1,14 +1,15 @@
export class antennaExclude1582210532752 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class antennaExclude1582210532752 implements MigrationInterface {
constructor() {
this.name = "antennaExclude1582210532752";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "antenna" ADD "excludeKeywords" jsonb NOT NULL DEFAULT '[]'`,
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "antenna" DROP COLUMN "excludeKeywords"`,
undefined,

View File

@ -1,14 +1,15 @@
export class noteReactionLength1582875306439 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class noteReactionLength1582875306439 implements MigrationInterface {
constructor() {
this.name = "noteReactionLength1582875306439";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "note_reaction" ALTER COLUMN "reaction" TYPE character varying(130)`,
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "note_reaction" ALTER COLUMN "reaction" TYPE character varying(128)`,
undefined,

View File

@ -1,8 +1,9 @@
export class miauth1585361548360 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class miauth1585361548360 implements MigrationInterface {
constructor() {
this.name = "miauth1585361548360";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "access_token" ADD "lastUsedAt" TIMESTAMP WITH TIME ZONE DEFAULT null`,
undefined,
@ -52,7 +53,7 @@ export class miauth1585361548360 {
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "access_token" DROP CONSTRAINT "FK_a3ff16c90cc87a82a0b5959e560"`,
undefined,

View File

@ -1,8 +1,9 @@
export class customNotification1585385921215 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class customNotification1585385921215 implements MigrationInterface {
constructor() {
this.name = "customNotification1585385921215";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "notification" ADD "customBody" character varying(2048)`,
undefined,
@ -76,7 +77,7 @@ export class customNotification1585385921215 {
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "notification" DROP CONSTRAINT "FK_e22bf6bda77b6adc1fd9e75c8c9"`,
undefined,

View File

@ -1,14 +1,15 @@
export class apUrl1585772678853 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class apUrl1585772678853 implements MigrationInterface {
constructor() {
this.name = "apUrl1585772678853";
}
async up(queryRunner) {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "note" ADD "url" character varying(512)`,
undefined,
);
}
async down(queryRunner) {
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "url"`, undefined);
}
}

View File

@ -1,14 +1,15 @@
export class AddObjectStorageUseProxy1586624197029 {
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddObjectStorageUseProxy1586624197029 implements MigrationInterface {
constructor() {
this.name = "AddObjectStorageUseProxy1586624197029";