diff --git a/packages/backend/src/migration/1701118152149-increase-host-char-limit.ts b/packages/backend/src/migration/1701118152149-increase-host-char-limit.ts new file mode 100644 index 000000000..5703a4c13 --- /dev/null +++ b/packages/backend/src/migration/1701118152149-increase-host-char-limit.ts @@ -0,0 +1,47 @@ +import { MigrationInterface, QueryRunner } from "typeorm" + +export class IncreaseHostCharLimit1701118152149 implements MigrationInterface { + name = 'IncreaseHostCharLimit1701118152149'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN "userHost" TYPE character varying(512)`); + await queryRunner.query(`ALTER TABLE "user" ALTER COLUMN "host" TYPE character varying(512)`); + await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "userHost" TYPE character varying(512)`); + await queryRunner.query(`ALTER TABLE "user_publickey" ALTER COLUMN "keyId" TYPE character varying(512)`); + await queryRunner.query(`ALTER TABLE "emoji" ALTER COLUMN "host" TYPE character varying(512)`); + await queryRunner.query(`ALTER TABLE "note" ALTER COLUMN "userHost" TYPE character varying(512)`); + await queryRunner.query(`ALTER TABLE "note" ALTER COLUMN "replyUserHost" TYPE character varying(512)`); + await queryRunner.query(`ALTER TABLE "note" ALTER COLUMN "renoteUserHost" TYPE character varying(512)`); + await queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "host" TYPE character varying(512)`); + await queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "iconUrl" TYPE character varying(4096)`); + await queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "faviconUrl" TYPE character varying(4096)`); + await queryRunner.query(`ALTER TABLE "poll" ALTER COLUMN "userHost" TYPE character varying(512)`); + await queryRunner.query(`ALTER TABLE "abuse_user_report" ALTER COLUMN "targetUserHost" TYPE character varying(512)`); + await queryRunner.query(`ALTER TABLE "abuse_user_report" ALTER COLUMN "reporterHost" TYPE character varying(512)`); + await queryRunner.query(`ALTER TABLE "following" ALTER COLUMN "followeeHost" TYPE character varying(512)`); + await queryRunner.query(`ALTER TABLE "following" ALTER COLUMN "followerHost" TYPE character varying(512)`); + await queryRunner.query(`ALTER TABLE "follow_request" ALTER COLUMN "followeeHost" TYPE character varying(512)`); + await queryRunner.query(`ALTER TABLE "follow_request" ALTER COLUMN "followerHost" TYPE character varying(512)`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN "userHost" TYPE character varying(128)`); + await queryRunner.query(`ALTER TABLE "user" ALTER COLUMN "host" TYPE character varying(128)`); + await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "userHost" TYPE character varying(128)`); + await queryRunner.query(`ALTER TABLE "user_publickey" ALTER COLUMN "keyId" TYPE character varying(256)`); + await queryRunner.query(`ALTER TABLE "emoji" ALTER COLUMN "host" TYPE character varying(128)`); + await queryRunner.query(`ALTER TABLE "note" ALTER COLUMN "userHost" TYPE character varying(128)`); + await queryRunner.query(`ALTER TABLE "note" ALTER COLUMN "replyUserHost" TYPE character varying(128)`); + await queryRunner.query(`ALTER TABLE "note" ALTER COLUMN "renoteUserHost" TYPE character varying(128)`); + await queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "host" TYPE character varying(128)`); + await queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "iconUrl" TYPE character varying(256)`); + await queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "faviconUrl" TYPE character varying(256)`); + await queryRunner.query(`ALTER TABLE "poll" ALTER COLUMN "userHost" TYPE character varying(128)`); + await queryRunner.query(`ALTER TABLE "abuse_user_report" ALTER COLUMN "targetUserHost" TYPE character varying(128)`); + await queryRunner.query(`ALTER TABLE "abuse_user_report" ALTER COLUMN "reporterHost" TYPE character varying(128)`); + await queryRunner.query(`ALTER TABLE "following" ALTER COLUMN "followeeHost" TYPE character varying(128)`); + await queryRunner.query(`ALTER TABLE "following" ALTER COLUMN "followerHost" TYPE character varying(128)`); + await queryRunner.query(`ALTER TABLE "follow_request" ALTER COLUMN "followeeHost" TYPE character varying(128)`); + await queryRunner.query(`ALTER TABLE "follow_request" ALTER COLUMN "followerHost" TYPE character varying(128)`); + } +} diff --git a/packages/backend/src/models/entities/abuse-user-report.ts b/packages/backend/src/models/entities/abuse-user-report.ts index be183548d..cb4d55851 100644 --- a/packages/backend/src/models/entities/abuse-user-report.ts +++ b/packages/backend/src/models/entities/abuse-user-report.ts @@ -71,7 +71,7 @@ export class AbuseUserReport { //#region Denormalized fields @Index() @Column("varchar", { - length: 128, + length: 512, nullable: true, comment: "[Denormalized]", }) @@ -79,7 +79,7 @@ export class AbuseUserReport { @Index() @Column("varchar", { - length: 128, + length: 512, nullable: true, comment: "[Denormalized]", }) diff --git a/packages/backend/src/models/entities/drive-file.ts b/packages/backend/src/models/entities/drive-file.ts index f65dad110..54f5a8ca2 100644 --- a/packages/backend/src/models/entities/drive-file.ts +++ b/packages/backend/src/models/entities/drive-file.ts @@ -39,7 +39,7 @@ export class DriveFile { @Index() @Column("varchar", { - length: 128, + length: 512, nullable: true, comment: "The host of owner. It will be null if the user in local.", }) diff --git a/packages/backend/src/models/entities/emoji.ts b/packages/backend/src/models/entities/emoji.ts index 727ba2f10..87b525dc5 100644 --- a/packages/backend/src/models/entities/emoji.ts +++ b/packages/backend/src/models/entities/emoji.ts @@ -20,7 +20,7 @@ export class Emoji { @Index() @Column("varchar", { - length: 128, + length: 512, nullable: true, }) public host: string | null; diff --git a/packages/backend/src/models/entities/follow-request.ts b/packages/backend/src/models/entities/follow-request.ts index 281eab917..a1c747d91 100644 --- a/packages/backend/src/models/entities/follow-request.ts +++ b/packages/backend/src/models/entities/follow-request.ts @@ -55,7 +55,7 @@ export class FollowRequest { //#region Denormalized fields @Column("varchar", { - length: 128, + length: 512, nullable: true, comment: "[Denormalized]", }) @@ -76,7 +76,7 @@ export class FollowRequest { public followerSharedInbox: string | null; @Column("varchar", { - length: 128, + length: 512, nullable: true, comment: "[Denormalized]", }) diff --git a/packages/backend/src/models/entities/following.ts b/packages/backend/src/models/entities/following.ts index fafcf8885..ea8f32565 100644 --- a/packages/backend/src/models/entities/following.ts +++ b/packages/backend/src/models/entities/following.ts @@ -50,7 +50,7 @@ export class Following { //#region Denormalized fields @Index() @Column("varchar", { - length: 128, + length: 512, nullable: true, comment: "[Denormalized]", }) @@ -72,7 +72,7 @@ export class Following { @Index() @Column("varchar", { - length: 128, + length: 512, nullable: true, comment: "[Denormalized]", }) diff --git a/packages/backend/src/models/entities/instance.ts b/packages/backend/src/models/entities/instance.ts index 7e0b08583..7b7701d07 100644 --- a/packages/backend/src/models/entities/instance.ts +++ b/packages/backend/src/models/entities/instance.ts @@ -20,7 +20,7 @@ export class Instance { */ @Index({ unique: true }) @Column("varchar", { - length: 128, + length: 512, comment: "The host of the Instance.", }) public host: string; @@ -149,13 +149,13 @@ export class Instance { public maintainerEmail: string | null; @Column("varchar", { - length: 256, + length: 4096, nullable: true, }) public iconUrl: string | null; @Column("varchar", { - length: 256, + length: 4096, nullable: true, }) public faviconUrl: string | null; diff --git a/packages/backend/src/models/entities/note.ts b/packages/backend/src/models/entities/note.ts index a99cb8033..886e6538f 100644 --- a/packages/backend/src/models/entities/note.ts +++ b/packages/backend/src/models/entities/note.ts @@ -221,7 +221,7 @@ export class Note { //#region Denormalized fields @Index() @Column("varchar", { - length: 128, + length: 512, nullable: true, comment: "[Denormalized]", }) @@ -235,7 +235,7 @@ export class Note { public replyUserId: User["id"] | null; @Column("varchar", { - length: 128, + length: 512, nullable: true, comment: "[Denormalized]", }) @@ -249,7 +249,7 @@ export class Note { public renoteUserId: User["id"] | null; @Column("varchar", { - length: 128, + length: 512, nullable: true, comment: "[Denormalized]", }) diff --git a/packages/backend/src/models/entities/poll.ts b/packages/backend/src/models/entities/poll.ts index 405cca222..c117d4e73 100644 --- a/packages/backend/src/models/entities/poll.ts +++ b/packages/backend/src/models/entities/poll.ts @@ -58,7 +58,7 @@ export class Poll { @Index() @Column("varchar", { - length: 128, + length: 512, nullable: true, comment: "[Denormalized]", }) diff --git a/packages/backend/src/models/entities/user-profile.ts b/packages/backend/src/models/entities/user-profile.ts index e800c9a6c..f53360862 100644 --- a/packages/backend/src/models/entities/user-profile.ts +++ b/packages/backend/src/models/entities/user-profile.ts @@ -242,7 +242,7 @@ export class UserProfile { //#region Denormalized fields @Index() @Column("varchar", { - length: 128, + length: 512, nullable: true, comment: "[Denormalized]", }) diff --git a/packages/backend/src/models/entities/user-publickey.ts b/packages/backend/src/models/entities/user-publickey.ts index 83a86b8a3..e39b084d3 100644 --- a/packages/backend/src/models/entities/user-publickey.ts +++ b/packages/backend/src/models/entities/user-publickey.ts @@ -22,7 +22,7 @@ export class UserPublickey { @Index({ unique: true }) @Column("varchar", { - length: 256, + length: 512, }) public keyId: string; diff --git a/packages/backend/src/models/entities/user.ts b/packages/backend/src/models/entities/user.ts index 4b3bf553f..d7412500e 100644 --- a/packages/backend/src/models/entities/user.ts +++ b/packages/backend/src/models/entities/user.ts @@ -229,7 +229,7 @@ export class User { @Index() @Column("varchar", { - length: 128, + length: 512, nullable: true, comment: "The host of the User. It will be null if the origin of the user is local.",