2023-12-18 20:59:20 +09:00
/ *
2024-02-14 00:59:27 +09:00
* SPDX - FileCopyrightText : syuilo and misskey - project
2023-12-18 20:59:20 +09:00
* SPDX - License - Identifier : AGPL - 3.0 - only
* /
export class ffVisibility1702718871541 {
constructor ( ) {
this . name = 'ffVisibility1702718871541' ;
}
async up ( queryRunner ) {
await queryRunner . query ( ` CREATE TYPE "public"."user_profile_followingvisibility_enum" AS ENUM('public', 'followers', 'private') ` ) ;
await queryRunner . query ( ` CREATE CAST ("public"."user_profile_ffvisibility_enum" AS "public"."user_profile_followingvisibility_enum") WITH INOUT AS ASSIGNMENT ` ) ;
await queryRunner . query ( ` CREATE TYPE "public"."user_profile_followersVisibility_enum" AS ENUM('public', 'followers', 'private') ` ) ;
await queryRunner . query ( ` CREATE CAST ("public"."user_profile_ffvisibility_enum" AS "public"."user_profile_followersVisibility_enum") WITH INOUT AS ASSIGNMENT ` ) ;
2024-10-02 10:58:15 +09:00
await queryRunner . query ( ` ALTER TABLE "user_profile" ADD "followingVisibility" "public"."user_profile_followingvisibility_enum" NOT NULL DEFAULT 'private' ` ) ;
await queryRunner . query ( ` ALTER TABLE "user_profile" ADD "followersVisibility" "public"."user_profile_followersVisibility_enum" NOT NULL DEFAULT 'private' ` ) ;
2023-12-18 20:59:20 +09:00
await queryRunner . query ( ` UPDATE "user_profile" SET "followingVisibility" = "ffVisibility" ` ) ;
await queryRunner . query ( ` UPDATE "user_profile" SET "followersVisibility" = "ffVisibility" ` ) ;
await queryRunner . query ( ` DROP CAST ("public"."user_profile_ffvisibility_enum" AS "public"."user_profile_followersVisibility_enum") ` ) ;
await queryRunner . query ( ` DROP CAST ("public"."user_profile_ffvisibility_enum" AS "public"."user_profile_followingvisibility_enum") ` ) ;
await queryRunner . query ( ` ALTER TABLE "user_profile" DROP COLUMN "ffVisibility" ` ) ;
await queryRunner . query ( ` DROP TYPE "public"."user_profile_ffvisibility_enum" ` ) ;
}
async down ( queryRunner ) {
await queryRunner . query ( ` CREATE TYPE "public"."user_profile_ffvisibility_enum" AS ENUM('public', 'followers', 'private') ` ) ;
await queryRunner . query ( ` ALTER TABLE "user_profile" ADD "ffVisibility" "public"."user_profile_ffvisibility_enum" NOT NULL DEFAULT 'public' ` ) ;
2023-12-24 15:24:26 +09:00
2023-12-18 20:59:20 +09:00
await queryRunner . query ( ` CREATE CAST ("public"."user_profile_followingvisibility_enum" AS "public"."user_profile_ffvisibility_enum") WITH INOUT AS ASSIGNMENT ` ) ;
2023-12-24 15:24:26 +09:00
await queryRunner . query ( ` UPDATE "user_profile" SET "ffVisibility" = "followingVisibility" ` ) ;
2023-12-18 20:59:20 +09:00
await queryRunner . query ( ` DROP CAST ("public"."user_profile_followingvisibility_enum" AS "public"."user_profile_ffvisibility_enum") ` ) ;
2023-12-24 15:24:26 +09:00
2023-12-18 20:59:20 +09:00
await queryRunner . query ( ` ALTER TABLE "user_profile" DROP COLUMN "followersVisibility" ` ) ;
await queryRunner . query ( ` ALTER TABLE "user_profile" DROP COLUMN "followingVisibility" ` ) ;
await queryRunner . query ( ` DROP TYPE "public"."user_profile_followersVisibility_enum" ` ) ;
await queryRunner . query ( ` DROP TYPE "public"."user_profile_followingvisibility_enum" ` ) ;
}
}