fix(auth): migrations to not include unique index for credentials id

This commit is contained in:
Karol Sójko
2022-12-28 16:16:10 +01:00
parent 841784ae8c
commit 384dfc8da4
2 changed files with 2 additions and 16 deletions
@@ -5,12 +5,11 @@ export class addAuthenticators1672223738686 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
'CREATE TABLE `authenticators` (`uuid` varchar(36) NOT NULL, `user_uuid` varchar(36) NOT NULL, `credential_id` varbinary(1024) NOT NULL, `credential_public_key` blob NOT NULL, `counter` bigint NOT NULL, `credential_device_type` varchar(32) NOT NULL, `credential_backed_up` tinyint NOT NULL, `transports` varchar(255) NULL, `created_at` bigint NOT NULL, `updated_at` bigint NOT NULL, UNIQUE INDEX `credential_id` (`credential_id`), PRIMARY KEY (`uuid`)) ENGINE=InnoDB',
'CREATE TABLE `authenticators` (`uuid` varchar(36) NOT NULL, `user_uuid` varchar(36) NOT NULL, `credential_id` varbinary(1024) NOT NULL, `credential_public_key` blob NOT NULL, `counter` bigint NOT NULL, `credential_device_type` varchar(32) NOT NULL, `credential_backed_up` tinyint NOT NULL, `transports` varchar(255) NULL, `created_at` bigint NOT NULL, `updated_at` bigint NOT NULL, PRIMARY KEY (`uuid`)) ENGINE=InnoDB',
)
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query('DROP INDEX `credential_id` ON `authenticators`')
await queryRunner.query('DROP TABLE `authenticators`')
await queryRunner.query('DROP TABLE `authentticators`')
}
}
@@ -1,13 +0,0 @@
import { MigrationInterface, QueryRunner } from 'typeorm'
export class fixAuthenticatorIndexing1672232948685 implements MigrationInterface {
name = 'fixAuthenticatorIndexing1672232948685'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query('DROP INDEX `credential_id` ON `authenticators`')
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query('CREATE UNIQUE INDEX `credential_id` ON `authenticators` (`credential_id`)')
}
}