Convert only simple-array into a real text[]

https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/1161#note_16259
This commit is contained in:
наб 2025-07-13 01:53:30 +02:00
parent f954b1e276
commit 3a1797d45e
No known key found for this signature in database
GPG Key ID: BCFD0B018D2658F1
2 changed files with 24 additions and 1 deletions

View File

@ -0,0 +1,22 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class alsoKnownAsSimpleArray1752363231063 {
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "user" ADD "alsoKnownAs2" text[];`);
await queryRunner.query(`UPDATE "user" SET "alsoKnownAs2"=string_to_array("alsoKnownAs", ',');`);
await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "alsoKnownAs";`);
await queryRunner.query(`ALTER TABLE "user" RENAME COLUMN "alsoKnownAs2" TO "alsoKnownAs";`);
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" ADD "alsoKnownAs2" text;`);
await queryRunner.query(`UPDATE "user" SET "alsoKnownAs2"=array_to_string("alsoKnownAs", ',', '');`);
await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "alsoKnownAs";`);
await queryRunner.query(`ALTER TABLE "user" RENAME COLUMN "alsoKnownAs2" TO "alsoKnownAs";`);
await queryRunner.query(`COMMENT ON COLUMN "user"."alsoKnownAs" IS 'URIs the user is known as too';`);
}
}

View File

@ -80,7 +80,8 @@ export class MiUser {
}) })
public movedAt: Date | null; public movedAt: Date | null;
@Column('simple-array', { @Column('text', {
array: true,
nullable: true, nullable: true,
comment: 'URIs the user is known as too', comment: 'URIs the user is known as too',
}) })