mirror of
https://github.com/seerr-team/seerr.git
synced 2026-05-19 14:18:39 -04:00
fix: add indexes and constraints for linked accounts
This commit is contained in:
@@ -10,9 +10,21 @@ export class AddLinkedAccount1742858617989 implements MigrationInterface {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "linked_accounts" ADD CONSTRAINT "FK_2c77d2a0c06eeab6e62dc35af64" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_2c77d2a0c06eeab6e62dc35af6" ON "linked_accounts" ("userId") `
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE UNIQUE INDEX "IDX_linked_accounts_provider_sub" ON "linked_accounts" ("provider", "sub") `
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "public"."IDX_linked_accounts_provider_sub"`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "public"."IDX_2c77d2a0c06eeab6e62dc35af6"`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "linked_accounts" DROP CONSTRAINT "FK_2c77d2a0c06eeab6e62dc35af64"`
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user