From 384dfc8da4b1b640964fa6da207a67fcd68dc7ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20S=C3=B3jko?= Date: Wed, 28 Dec 2022 16:16:10 +0100 Subject: [PATCH] fix(auth): migrations to not include unique index for credentials id --- .../migrations/1672223738686-add_authenticators.ts | 5 ++--- .../1672232948685-fix_authenticator_indexing.ts | 13 ------------- 2 files changed, 2 insertions(+), 16 deletions(-) delete mode 100644 packages/auth/migrations/1672232948685-fix_authenticator_indexing.ts diff --git a/packages/auth/migrations/1672223738686-add_authenticators.ts b/packages/auth/migrations/1672223738686-add_authenticators.ts index b8ff590c9..50d1091d3 100644 --- a/packages/auth/migrations/1672223738686-add_authenticators.ts +++ b/packages/auth/migrations/1672223738686-add_authenticators.ts @@ -5,12 +5,11 @@ export class addAuthenticators1672223738686 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { 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 { - await queryRunner.query('DROP INDEX `credential_id` ON `authenticators`') - await queryRunner.query('DROP TABLE `authenticators`') + await queryRunner.query('DROP TABLE `authentticators`') } } diff --git a/packages/auth/migrations/1672232948685-fix_authenticator_indexing.ts b/packages/auth/migrations/1672232948685-fix_authenticator_indexing.ts deleted file mode 100644 index 599ea6fb5..000000000 --- a/packages/auth/migrations/1672232948685-fix_authenticator_indexing.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm' - -export class fixAuthenticatorIndexing1672232948685 implements MigrationInterface { - name = 'fixAuthenticatorIndexing1672232948685' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query('DROP INDEX `credential_id` ON `authenticators`') - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query('CREATE UNIQUE INDEX `credential_id` ON `authenticators` (`credential_id`)') - } -}