2023-10-13 18:17:29 +02:00
|
|
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
|
|
export class nsfwDetection1655368940105 implements MigrationInterface {
|
2023-04-07 03:56:46 +02:00
|
|
|
name = "nsfwDetection1655368940105";
|
2022-07-07 14:06:37 +02:00
|
|
|
|
2023-10-13 18:17:29 +02:00
|
|
|
async up(queryRunner: QueryRunner): Promise<void> {
|
2023-04-07 03:56:46 +02:00
|
|
|
await queryRunner.query(
|
|
|
|
`ALTER TABLE "drive_file" ADD "forceIsSensitive" boolean NOT NULL DEFAULT false`,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`ALTER TABLE "drive_file" ADD "predictedIsSensitive" boolean NOT NULL DEFAULT false`,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`COMMENT ON COLUMN "drive_file"."predictedIsSensitive" IS 'Whether the DriveFile is NSFW. (predict)'`,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`CREATE TYPE "public"."meta_sensitiveimagedetection_enum" AS ENUM('none', 'all', 'local', 'remote')`,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`ALTER TABLE "meta" ADD "sensitiveImageDetection" "public"."meta_sensitiveimagedetection_enum" NOT NULL DEFAULT 'none'`,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`ALTER TABLE "meta" ADD "forceIsSensitiveWhenPredicted" boolean NOT NULL DEFAULT true`,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`CREATE INDEX "IDX_fc2d74a6d7d8b11292a851d8f8" ON "drive_file" ("predictedIsSensitive") `,
|
|
|
|
);
|
|
|
|
}
|
2022-07-07 14:06:37 +02:00
|
|
|
|
2023-10-13 18:17:29 +02:00
|
|
|
async down(queryRunner: QueryRunner): Promise<void> {
|
2023-04-07 03:56:46 +02:00
|
|
|
await queryRunner.query(
|
|
|
|
`DROP INDEX "public"."IDX_fc2d74a6d7d8b11292a851d8f8"`,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`ALTER TABLE "meta" DROP COLUMN "forceIsSensitiveWhenPredicted"`,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`ALTER TABLE "meta" DROP COLUMN "sensitiveImageDetection"`,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`DROP TYPE "public"."meta_sensitiveimagedetection_enum"`,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`COMMENT ON COLUMN "drive_file"."predictedIsSensitive" IS 'Whether the DriveFile is NSFW. (predict)'`,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`ALTER TABLE "drive_file" DROP COLUMN "predictedIsSensitive"`,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`ALTER TABLE "drive_file" DROP COLUMN "forceIsSensitive"`,
|
|
|
|
);
|
|
|
|
}
|
2022-07-07 14:06:37 +02:00
|
|
|
}
|