1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-21 12:05:42 +01:00

Check for correct database in an old MySql migration

This commit is contained in:
Addison Beck 2024-10-17 19:04:19 -04:00
parent 1fb366d42b
commit 9322350ef5
No known key found for this signature in database

View File

@ -74,13 +74,13 @@ public partial class GrantIdWithIndexes : Migration
migrationBuilder.Sql(@"
DROP PROCEDURE IF EXISTS GrantSchemaChange;
CREATE PROCEDURE GrantSchemaChange()
BEGIN
IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Grant' AND COLUMN_NAME = 'Id') THEN
IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Grant' AND COLUMN_NAME = 'Id' AND TABLE_SCHEMA=database()) THEN
ALTER TABLE `Grant` DROP COLUMN `Id`;
END IF;
ALTER TABLE `Grant` ADD COLUMN `Id` INT AUTO_INCREMENT UNIQUE;
END;