Skip to content

Commit

Permalink
enhance: ドライブurlの上限文字数を引き上げ
Browse files Browse the repository at this point in the history
  • Loading branch information
slofp committed Jul 22, 2024
1 parent 98a4252 commit 652eaff
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
25 changes: 25 additions & 0 deletions packages/backend/migration/1721666053703-fixDriveUrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export class FixDriveUrl1721666053703 {
name = 'FixDriveUrl1721666053703'

async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN "url" TYPE character varying(1024), ALTER COLUMN "url" SET NOT NULL`);
await queryRunner.query(`COMMENT ON COLUMN "drive_file"."url" IS 'The URL of the DriveFile.'`);
await queryRunner.query(`DROP INDEX "public"."IDX_e5848eac4940934e23dbc17581"`);
await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN "uri" TYPE character varying(1024)`);
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(`ALTER TABLE "drive_file" ALTER COLUMN "src" TYPE character varying(1024)`);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "preservedUsernames" SET DEFAULT '{ "admin", "administrator", "root", "system", "maintainer", "host", "mod", "moderator", "owner", "superuser", "staff", "auth", "i", "me", "everyone", "all", "mention", "mentions", "example", "user", "users", "account", "accounts", "official", "help", "helps", "support", "supports", "info", "information", "informations", "announce", "announces", "announcement", "announcements", "notice", "notification", "notifications", "dev", "developer", "developers", "tech", "misskey" }'`);
await queryRunner.query(`CREATE INDEX "IDX_e5848eac4940934e23dbc17581" ON "drive_file" ("uri") `);
}

async down(queryRunner) {
await queryRunner.query(`DROP INDEX "public"."IDX_e5848eac4940934e23dbc17581"`);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "preservedUsernames" SET DEFAULT '{admin,administrator,root,system,maintainer,host,mod,moderator,owner,superuser,staff,auth,i,me,everyone,all,mention,mentions,example,user,users,account,accounts,official,help,helps,support,supports,info,information,informations,announce,announces,announcement,announcements,notice,notification,notifications,dev,developer,developers,tech,misskey}'`);
await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN "src" TYPE character varying(512)`);
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(`ALTER TABLE "drive_file" ALTER COLUMN "uri" TYPE character varying(512)`);
await queryRunner.query(`CREATE INDEX "IDX_e5848eac4940934e23dbc17581" ON "drive_file" ("uri") `);
await queryRunner.query(`COMMENT ON COLUMN "drive_file"."url" IS 'The URL of the DriveFile.'`);
await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN "url" TYPE character varying(512), ALTER COLUMN "url" SET NOT NULL`);
}
}
6 changes: 3 additions & 3 deletions packages/backend/src/models/DriveFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class MiDriveFile {
public storedInternal: boolean;

@Column('varchar', {
length: 512,
length: 1024,
comment: 'The URL of the DriveFile.',
})
public url: string;
Expand Down Expand Up @@ -124,13 +124,13 @@ export class MiDriveFile {

@Index()
@Column('varchar', {
length: 512, nullable: true,
length: 1024, nullable: true,
comment: 'The URI of the DriveFile. it will be null when the DriveFile is local.',
})
public uri: string | null;

@Column('varchar', {
length: 512, nullable: true,
length: 1024, nullable: true,
})
public src: string | null;

Expand Down

0 comments on commit 652eaff

Please sign in to comment.