Rename refreshToken to appToken and add fields (#4691)
This commit is contained in:
@ -0,0 +1,39 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class UpdateRefreshTokenTable1711624086253
|
||||
implements MigrationInterface
|
||||
{
|
||||
name = 'UpdateRefreshTokenTable1711624086253';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."refreshToken" RENAME TO "appToken"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."appToken" ADD "workspaceId" uuid`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."appToken" ADD "type" text NOT NULL DEFAULT 'REFRESH_TOKEN'`,
|
||||
);
|
||||
await queryRunner.query(`ALTER TABLE "core"."appToken" ADD "value" text`);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."appToken" ADD CONSTRAINT "FK_d6ae19a7aa2bbd4919053257772" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."appToken" DROP CONSTRAINT "FK_d6ae19a7aa2bbd4919053257772"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."appToken" DROP COLUMN "value"`,
|
||||
);
|
||||
await queryRunner.query(`ALTER TABLE "core"."appToken" DROP COLUMN "type"`);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."appToken" DROP COLUMN "workspaceId"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."appToken" RENAME TO "refreshToken"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -6,7 +6,7 @@ import { EnvironmentService } from 'src/engine/integrations/environment/environm
|
||||
import { DataSourceEntity } from 'src/engine/metadata-modules/data-source/data-source.entity';
|
||||
import { User } from 'src/engine/core-modules/user/user.entity';
|
||||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
import { RefreshToken } from 'src/engine/core-modules/refresh-token/refresh-token.entity';
|
||||
import { AppToken } from 'src/engine/core-modules/app-token/app-token.entity';
|
||||
import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { BillingSubscription } from 'src/engine/core-modules/billing/entities/billing-subscription.entity';
|
||||
import { BillingSubscriptionItem } from 'src/engine/core-modules/billing/entities/billing-subscription-item.entity';
|
||||
@ -28,7 +28,7 @@ export class TypeORMService implements OnModuleInit, OnModuleDestroy {
|
||||
User,
|
||||
Workspace,
|
||||
UserWorkspace,
|
||||
RefreshToken,
|
||||
AppToken,
|
||||
FeatureFlagEntity,
|
||||
BillingSubscription,
|
||||
BillingSubscriptionItem,
|
||||
|
||||
Reference in New Issue
Block a user