FoundKey/packages/backend/migration/1669545702493-detectDeeplPro.js
Johann150 8130a2a9b1
server: remove deeplIsPro setting
This setting is unnecessary because DeepL free keys can be detected
easily according to <https://www.deepl.com/docs-api/api-access/authentication/>:
> DeepL API Free authentication keys can be identified easily by the suffix ":fx"

Changelog: Removed
2022-11-27 12:12:56 +01:00

13 lines
451 B
JavaScript

export class detectDeeplPro1669545702493 {
name = 'detectDeeplPro1669545702493';
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "deeplIsPro"`);
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "meta" ADD "deeplIsPro" boolean NOT NULL DEFAULT false`);
await queryRunner.query(`UPDATE "meta" SET "deeplIsPro" = true WHERE "deeplAuthKey" IS NOT NULL AND "deeplAuthKey" NOT LIKE '%:fx'`);
}
}