1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 07:36:14 -05:00

[PM-14818] Update migrate.ps1 to support test database used by integration tests (#4912)

* Check for correct database in an old MySql migration

* Update `migrate.ps1` to support integration test databases
This commit is contained in:
Addison Beck
2025-01-22 11:41:18 -05:00
committed by GitHub
parent cb76cdb5d3
commit 0e0dd8203a
2 changed files with 54 additions and 26 deletions

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;