fix: change character limits to allow for long instance domains

This commit is contained in:
AAGaming 2023-08-18 22:05:42 -04:00
parent 58d5b76edb
commit 09d96c1a36
No known key found for this signature in database
GPG Key ID: 00CFCD925A3E0C50
11 changed files with 135 additions and 16 deletions

View File

@ -0,0 +1,119 @@
export class IncreaseHostCharLimit1692374635734 {
name = "IncreaseHostCharLimit1692374635734";
async up(queryRunner) {
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)`,
);
}
async down(queryRunner) {
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)`,
);
}
}

View File

@ -71,7 +71,7 @@ export class AbuseUserReport {
//#region Denormalized fields //#region Denormalized fields
@Index() @Index()
@Column("varchar", { @Column("varchar", {
length: 128, length: 512,
nullable: true, nullable: true,
comment: "[Denormalized]", comment: "[Denormalized]",
}) })
@ -79,7 +79,7 @@ export class AbuseUserReport {
@Index() @Index()
@Column("varchar", { @Column("varchar", {
length: 128, length: 512,
nullable: true, nullable: true,
comment: "[Denormalized]", comment: "[Denormalized]",
}) })

View File

@ -39,7 +39,7 @@ export class DriveFile {
@Index() @Index()
@Column("varchar", { @Column("varchar", {
length: 128, length: 512,
nullable: true, nullable: true,
comment: "The host of owner. It will be null if the user in local.", comment: "The host of owner. It will be null if the user in local.",
}) })

View File

@ -20,7 +20,7 @@ export class Emoji {
@Index() @Index()
@Column("varchar", { @Column("varchar", {
length: 128, length: 512,
nullable: true, nullable: true,
}) })
public host: string | null; public host: string | null;

View File

@ -50,7 +50,7 @@ export class Following {
//#region Denormalized fields //#region Denormalized fields
@Index() @Index()
@Column("varchar", { @Column("varchar", {
length: 128, length: 512,
nullable: true, nullable: true,
comment: "[Denormalized]", comment: "[Denormalized]",
}) })
@ -72,7 +72,7 @@ export class Following {
@Index() @Index()
@Column("varchar", { @Column("varchar", {
length: 128, length: 512,
nullable: true, nullable: true,
comment: "[Denormalized]", comment: "[Denormalized]",
}) })

View File

@ -20,7 +20,7 @@ export class Instance {
*/ */
@Index({ unique: true }) @Index({ unique: true })
@Column("varchar", { @Column("varchar", {
length: 128, length: 512,
comment: "The host of the Instance.", comment: "The host of the Instance.",
}) })
public host: string; public host: string;
@ -149,13 +149,13 @@ export class Instance {
public maintainerEmail: string | null; public maintainerEmail: string | null;
@Column("varchar", { @Column("varchar", {
length: 256, length: 4096,
nullable: true, nullable: true,
}) })
public iconUrl: string | null; public iconUrl: string | null;
@Column("varchar", { @Column("varchar", {
length: 256, length: 4096,
nullable: true, nullable: true,
}) })
public faviconUrl: string | null; public faviconUrl: string | null;

View File

@ -217,7 +217,7 @@ export class Note {
//#region Denormalized fields //#region Denormalized fields
@Index() @Index()
@Column("varchar", { @Column("varchar", {
length: 128, length: 512,
nullable: true, nullable: true,
comment: "[Denormalized]", comment: "[Denormalized]",
}) })
@ -231,7 +231,7 @@ export class Note {
public replyUserId: User["id"] | null; public replyUserId: User["id"] | null;
@Column("varchar", { @Column("varchar", {
length: 128, length: 512,
nullable: true, nullable: true,
comment: "[Denormalized]", comment: "[Denormalized]",
}) })
@ -245,7 +245,7 @@ export class Note {
public renoteUserId: User["id"] | null; public renoteUserId: User["id"] | null;
@Column("varchar", { @Column("varchar", {
length: 128, length: 512,
nullable: true, nullable: true,
comment: "[Denormalized]", comment: "[Denormalized]",
}) })

View File

@ -58,7 +58,7 @@ export class Poll {
@Index() @Index()
@Column("varchar", { @Column("varchar", {
length: 128, length: 512,
nullable: true, nullable: true,
comment: "[Denormalized]", comment: "[Denormalized]",
}) })

View File

@ -242,7 +242,7 @@ export class UserProfile {
//#region Denormalized fields //#region Denormalized fields
@Index() @Index()
@Column("varchar", { @Column("varchar", {
length: 128, length: 512,
nullable: true, nullable: true,
comment: "[Denormalized]", comment: "[Denormalized]",
}) })

View File

@ -22,7 +22,7 @@ export class UserPublickey {
@Index({ unique: true }) @Index({ unique: true })
@Column("varchar", { @Column("varchar", {
length: 256, length: 512,
}) })
public keyId: string; public keyId: string;

View File

@ -201,7 +201,7 @@ export class User {
@Index() @Index()
@Column("varchar", { @Column("varchar", {
length: 128, length: 512,
nullable: true, nullable: true,
comment: comment:
"The host of the User. It will be null if the origin of the user is local.", "The host of the User. It will be null if the origin of the user is local.",