fix (backend): set name and description for existing Mastodon API tokens
This commit is contained in:
parent
0fcb17d9b6
commit
20eadcf2f8
2 changed files with 17 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
BEGIN;
|
BEGIN;
|
||||||
|
|
||||||
DELETE FROM "migrations" WHERE name IN (
|
DELETE FROM "migrations" WHERE name IN (
|
||||||
|
'SetAccessTokenName1722134626110',
|
||||||
'CreateSystemActors1720618854585',
|
'CreateSystemActors1720618854585',
|
||||||
'AddMastodonSubscriptionType1715181461692',
|
'AddMastodonSubscriptionType1715181461692',
|
||||||
'SwSubscriptionAccessToken1709395223611',
|
'SwSubscriptionAccessToken1709395223611',
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
import type { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class SetAccessTokenName1722134626110 implements MigrationInterface {
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(
|
||||||
|
`UPDATE "access_token" SET "name" = "app"."name" FROM "app" WHERE "access_token"."name" IS NULL AND "access_token"."appId" = "app"."id"`,
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`UPDATE "access_token" SET "description" = "app"."description" FROM "app" WHERE "access_token"."description" IS NULL AND "access_token"."appId" = "app"."id"`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(_: QueryRunner): Promise<void> {
|
||||||
|
/* You don't need to revert this migration. */
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue