1
0
Fork 1
mirror of https://example.com synced 2024-11-22 23:16:38 +09:00
firefish/packages/backend/migration-neko/1705848938166-remove-nsfw-detection.js

64 lines
2.3 KiB
JavaScript

export class RemoveNsfwDetection1705848938166 {
name = "RemoveNsfwDetection1705848938166";
async up(queryRunner) {
await queryRunner.query(
`ALTER TABLE "drive_file" DROP COLUMN "maybeSensitive"`,
);
await queryRunner.query(`ALTER TABLE "drive_file" DROP COLUMN "maybePorn"`);
await queryRunner.query(
`ALTER TABLE "meta" DROP COLUMN "sensitiveMediaDetection"`,
);
await queryRunner.query(
`DROP TYPE "public"."meta_sensitivemediadetection_enum"`,
);
await queryRunner.query(
`ALTER TABLE "meta" DROP COLUMN "sensitiveMediaDetectionSensitivity"`,
);
await queryRunner.query(
`DROP TYPE "public"."meta_sensitivemediadetectionsensitivity_enum"`,
);
await queryRunner.query(
`ALTER TABLE "meta" DROP COLUMN "setSensitiveFlagAutomatically"`,
);
await queryRunner.query(
`ALTER TABLE "meta" DROP COLUMN "enableSensitiveMediaDetectionForVideos"`,
);
await queryRunner.query(
`ALTER TABLE "user_profile" DROP COLUMN "autoSensitive"`,
);
}
async down(queryRunner) {
await queryRunner.query(
`ALTER TABLE "user_profile" ADD "autoSensitive" boolean NOT NULL DEFAULT false`,
);
await queryRunner.query(
`ALTER TABLE "meta" ADD "enableSensitiveMediaDetectionForVideos" boolean NOT NULL DEFAULT false`,
);
await queryRunner.query(
`ALTER TABLE "meta" ADD "setSensitiveFlagAutomatically" boolean NOT NULL DEFAULT false`,
);
await queryRunner.query(
`CREATE TYPE "public"."meta_sensitivemediadetectionsensitivity_enum" AS ENUM('medium', 'low', 'high', 'veryLow', 'veryHigh')`,
);
await queryRunner.query(
`ALTER TABLE "meta" ADD "sensitiveMediaDetectionSensitivity" "public"."meta_sensitivemediadetectionsensitivity_enum" NOT NULL DEFAULT 'medium'`,
);
await queryRunner.query(
`CREATE TYPE "public"."meta_sensitivemediadetection_enum" AS ENUM('none', 'all', 'local', 'remote')`,
);
await queryRunner.query(
`ALTER TABLE "meta" ADD "sensitiveMediaDetection" "public"."meta_sensitivemediadetection_enum" NOT NULL DEFAULT 'none'`,
);
await queryRunner.query(
`ALTER TABLE "drive_file" ADD "maybePorn" boolean NOT NULL DEFAULT false`,
);
await queryRunner.query(
`ALTER TABLE "drive_file" ADD "maybeSensitive" boolean NOT NULL DEFAULT false`,
);
await queryRunner.query(
`COMMENT ON COLUMN "drive_file"."maybeSensitive" IS 'Whether the DriveFile is NSFW. (predict)'`,
);
}
}