From 5c37f56118fd42332760f15dd4e219e69b9c852a Mon Sep 17 00:00:00 2001 From: Graham Walker Date: Tue, 10 Jun 2025 13:00:08 -0500 Subject: [PATCH] PM-20574 updating sql migration to fix database test --- .../OrganizationApplication_Create.sql | 0 .../OrganizationApplication_DeleteById.sql | 0 ...anizationApplication_ReadByOrganizationId.sql | 0 .../OrganizationApplication_ReadyById.sql | 0 .../OrganizationApplication_Update.sql | 0 .../OrganizationReport_Create.sql | 0 .../OrganizationReport_DeleteById.sql | 0 .../OrganizationReport_ReadById.Sql | 0 .../OrganizationReport_ReadByOrganizationId.sql | 0 .../OrganizationReport_Update.sql | 0 .../Dirt}/Tables/OrganizationApplication.sql | 0 .../Dirt}/Tables/OrganizationReport.sql | 0 .../Dirt}/Views/OrganizationApplicationView.sql | 0 .../Dirt}/Views/OrganizationReportView.sql | 0 .../2025-06-10_02_UpdateOrgDeleteByIdProc.sql | 6 ++++++ ...0_02_UpdateOrgDeleteByIdProc.sql.Designer.cs} | 16 +++++++++++++--- ...2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs} | 0 ...0_02_UpdateOrgDeleteByIdProc.sql.Designer.cs} | 16 +++++++++++++--- ...2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs} | 0 ...0_02_UpdateOrgDeleteByIdProc.sql.Designer.cs} | 14 ++++++++++++-- ...2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs} | 0 21 files changed, 44 insertions(+), 8 deletions(-) rename src/Sql/{Dirt/dbo => dbo/Dirt}/Stored Procedures/OrganizationApplication_Create.sql (100%) rename src/Sql/{Dirt/dbo => dbo/Dirt}/Stored Procedures/OrganizationApplication_DeleteById.sql (100%) rename src/Sql/{Dirt/dbo => dbo/Dirt}/Stored Procedures/OrganizationApplication_ReadByOrganizationId.sql (100%) rename src/Sql/{Dirt/dbo => dbo/Dirt}/Stored Procedures/OrganizationApplication_ReadyById.sql (100%) rename src/Sql/{Dirt/dbo => dbo/Dirt}/Stored Procedures/OrganizationApplication_Update.sql (100%) rename src/Sql/{Dirt/dbo => dbo/Dirt}/Stored Procedures/OrganizationReport_Create.sql (100%) rename src/Sql/{Dirt/dbo => dbo/Dirt}/Stored Procedures/OrganizationReport_DeleteById.sql (100%) rename src/Sql/{Dirt/dbo => dbo/Dirt}/Stored Procedures/OrganizationReport_ReadById.Sql (100%) rename src/Sql/{Dirt/dbo => dbo/Dirt}/Stored Procedures/OrganizationReport_ReadByOrganizationId.sql (100%) rename src/Sql/{Dirt/dbo => dbo/Dirt}/Stored Procedures/OrganizationReport_Update.sql (100%) rename src/Sql/{Dirt/dbo => dbo/Dirt}/Tables/OrganizationApplication.sql (100%) rename src/Sql/{Dirt/dbo => dbo/Dirt}/Tables/OrganizationReport.sql (100%) rename src/Sql/{Dirt/dbo => dbo/Dirt}/Views/OrganizationApplicationView.sql (100%) rename src/Sql/{Dirt/dbo => dbo/Dirt}/Views/OrganizationReportView.sql (100%) rename util/MySqlMigrations/Migrations/{20250610173958_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs => 20250610175040_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs} (99%) rename util/MySqlMigrations/Migrations/{20250610173958_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs => 20250610175040_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs} (100%) rename util/PostgresMigrations/Migrations/{20250610172708_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs => 20250610175037_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs} (99%) rename util/PostgresMigrations/Migrations/{20250610172708_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs => 20250610175037_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs} (100%) rename util/SqliteMigrations/Migrations/{20250610172702_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs => 20250610175044_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs} (99%) rename util/SqliteMigrations/Migrations/{20250610172702_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs => 20250610175044_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs} (100%) diff --git a/src/Sql/Dirt/dbo/Stored Procedures/OrganizationApplication_Create.sql b/src/Sql/dbo/Dirt/Stored Procedures/OrganizationApplication_Create.sql similarity index 100% rename from src/Sql/Dirt/dbo/Stored Procedures/OrganizationApplication_Create.sql rename to src/Sql/dbo/Dirt/Stored Procedures/OrganizationApplication_Create.sql diff --git a/src/Sql/Dirt/dbo/Stored Procedures/OrganizationApplication_DeleteById.sql b/src/Sql/dbo/Dirt/Stored Procedures/OrganizationApplication_DeleteById.sql similarity index 100% rename from src/Sql/Dirt/dbo/Stored Procedures/OrganizationApplication_DeleteById.sql rename to src/Sql/dbo/Dirt/Stored Procedures/OrganizationApplication_DeleteById.sql diff --git a/src/Sql/Dirt/dbo/Stored Procedures/OrganizationApplication_ReadByOrganizationId.sql b/src/Sql/dbo/Dirt/Stored Procedures/OrganizationApplication_ReadByOrganizationId.sql similarity index 100% rename from src/Sql/Dirt/dbo/Stored Procedures/OrganizationApplication_ReadByOrganizationId.sql rename to src/Sql/dbo/Dirt/Stored Procedures/OrganizationApplication_ReadByOrganizationId.sql diff --git a/src/Sql/Dirt/dbo/Stored Procedures/OrganizationApplication_ReadyById.sql b/src/Sql/dbo/Dirt/Stored Procedures/OrganizationApplication_ReadyById.sql similarity index 100% rename from src/Sql/Dirt/dbo/Stored Procedures/OrganizationApplication_ReadyById.sql rename to src/Sql/dbo/Dirt/Stored Procedures/OrganizationApplication_ReadyById.sql diff --git a/src/Sql/Dirt/dbo/Stored Procedures/OrganizationApplication_Update.sql b/src/Sql/dbo/Dirt/Stored Procedures/OrganizationApplication_Update.sql similarity index 100% rename from src/Sql/Dirt/dbo/Stored Procedures/OrganizationApplication_Update.sql rename to src/Sql/dbo/Dirt/Stored Procedures/OrganizationApplication_Update.sql diff --git a/src/Sql/Dirt/dbo/Stored Procedures/OrganizationReport_Create.sql b/src/Sql/dbo/Dirt/Stored Procedures/OrganizationReport_Create.sql similarity index 100% rename from src/Sql/Dirt/dbo/Stored Procedures/OrganizationReport_Create.sql rename to src/Sql/dbo/Dirt/Stored Procedures/OrganizationReport_Create.sql diff --git a/src/Sql/Dirt/dbo/Stored Procedures/OrganizationReport_DeleteById.sql b/src/Sql/dbo/Dirt/Stored Procedures/OrganizationReport_DeleteById.sql similarity index 100% rename from src/Sql/Dirt/dbo/Stored Procedures/OrganizationReport_DeleteById.sql rename to src/Sql/dbo/Dirt/Stored Procedures/OrganizationReport_DeleteById.sql diff --git a/src/Sql/Dirt/dbo/Stored Procedures/OrganizationReport_ReadById.Sql b/src/Sql/dbo/Dirt/Stored Procedures/OrganizationReport_ReadById.Sql similarity index 100% rename from src/Sql/Dirt/dbo/Stored Procedures/OrganizationReport_ReadById.Sql rename to src/Sql/dbo/Dirt/Stored Procedures/OrganizationReport_ReadById.Sql diff --git a/src/Sql/Dirt/dbo/Stored Procedures/OrganizationReport_ReadByOrganizationId.sql b/src/Sql/dbo/Dirt/Stored Procedures/OrganizationReport_ReadByOrganizationId.sql similarity index 100% rename from src/Sql/Dirt/dbo/Stored Procedures/OrganizationReport_ReadByOrganizationId.sql rename to src/Sql/dbo/Dirt/Stored Procedures/OrganizationReport_ReadByOrganizationId.sql diff --git a/src/Sql/Dirt/dbo/Stored Procedures/OrganizationReport_Update.sql b/src/Sql/dbo/Dirt/Stored Procedures/OrganizationReport_Update.sql similarity index 100% rename from src/Sql/Dirt/dbo/Stored Procedures/OrganizationReport_Update.sql rename to src/Sql/dbo/Dirt/Stored Procedures/OrganizationReport_Update.sql diff --git a/src/Sql/Dirt/dbo/Tables/OrganizationApplication.sql b/src/Sql/dbo/Dirt/Tables/OrganizationApplication.sql similarity index 100% rename from src/Sql/Dirt/dbo/Tables/OrganizationApplication.sql rename to src/Sql/dbo/Dirt/Tables/OrganizationApplication.sql diff --git a/src/Sql/Dirt/dbo/Tables/OrganizationReport.sql b/src/Sql/dbo/Dirt/Tables/OrganizationReport.sql similarity index 100% rename from src/Sql/Dirt/dbo/Tables/OrganizationReport.sql rename to src/Sql/dbo/Dirt/Tables/OrganizationReport.sql diff --git a/src/Sql/Dirt/dbo/Views/OrganizationApplicationView.sql b/src/Sql/dbo/Dirt/Views/OrganizationApplicationView.sql similarity index 100% rename from src/Sql/Dirt/dbo/Views/OrganizationApplicationView.sql rename to src/Sql/dbo/Dirt/Views/OrganizationApplicationView.sql diff --git a/src/Sql/Dirt/dbo/Views/OrganizationReportView.sql b/src/Sql/dbo/Dirt/Views/OrganizationReportView.sql similarity index 100% rename from src/Sql/Dirt/dbo/Views/OrganizationReportView.sql rename to src/Sql/dbo/Dirt/Views/OrganizationReportView.sql diff --git a/util/Migrator/DbScripts/2025-06-10_02_UpdateOrgDeleteByIdProc.sql b/util/Migrator/DbScripts/2025-06-10_02_UpdateOrgDeleteByIdProc.sql index 493cc1c0ac..763c730318 100644 --- a/util/Migrator/DbScripts/2025-06-10_02_UpdateOrgDeleteByIdProc.sql +++ b/util/Migrator/DbScripts/2025-06-10_02_UpdateOrgDeleteByIdProc.sql @@ -9,6 +9,8 @@ BEGIN DECLARE @BatchSize INT = 100 WHILE @BatchSize > 0 +GO + BEGIN BEGIN TRANSACTION Organization_DeleteById_Ciphers @@ -24,6 +26,8 @@ BEGIN TRANSACTION Organization_DeleteById_Ciphers COMMIT TRANSACTION Organization_DeleteById_Ciphers END +GO + BEGIN TRANSACTION Organization_DeleteById DELETE @@ -159,3 +163,5 @@ WHERE COMMIT TRANSACTION Organization_DeleteById END + +GO diff --git a/util/MySqlMigrations/Migrations/20250610173958_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs b/util/MySqlMigrations/Migrations/20250610175040_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs similarity index 99% rename from util/MySqlMigrations/Migrations/20250610173958_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs rename to util/MySqlMigrations/Migrations/20250610175040_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs index 2270c54930..9ee0b18167 100644 --- a/util/MySqlMigrations/Migrations/20250610173958_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs +++ b/util/MySqlMigrations/Migrations/20250610175040_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs @@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace Bit.MySqlMigrations.Migrations { [DbContext(typeof(DatabaseContext))] - [Migration("20250610173958_2025-06-10_02_UpdateOrgDeleteByIdProc.sql")] + [Migration("20250610175040_2025-06-10_02_UpdateOrgDeleteByIdProc.sql")] partial class _20250610_02_UpdateOrgDeleteByIdProcsql { /// @@ -682,8 +682,8 @@ namespace Bit.MySqlMigrations.Migrations .HasColumnType("datetime(6)"); b.Property("ExternalId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); + .HasMaxLength(300) + .HasColumnType("varchar(300)"); b.Property("OrganizationId") .HasColumnType("char(36)"); @@ -1048,6 +1048,9 @@ namespace Bit.MySqlMigrations.Migrations b.Property("CreationDate") .HasColumnType("datetime(6)"); + b.Property("DefaultUserCollectionEmail") + .HasColumnType("longtext"); + b.Property("ExternalId") .HasMaxLength(300) .HasColumnType("varchar(300)"); @@ -1062,6 +1065,9 @@ namespace Bit.MySqlMigrations.Migrations b.Property("RevisionDate") .HasColumnType("datetime(6)"); + b.Property("Type") + .HasColumnType("int"); + b.HasKey("Id"); b.HasIndex("OrganizationId"); @@ -1529,6 +1535,10 @@ namespace Bit.MySqlMigrations.Migrations b.Property("Disabled") .HasColumnType("tinyint(1)"); + b.Property("Emails") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + b.Property("ExpirationDate") .HasColumnType("datetime(6)"); diff --git a/util/MySqlMigrations/Migrations/20250610173958_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs b/util/MySqlMigrations/Migrations/20250610175040_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs similarity index 100% rename from util/MySqlMigrations/Migrations/20250610173958_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs rename to util/MySqlMigrations/Migrations/20250610175040_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs diff --git a/util/PostgresMigrations/Migrations/20250610172708_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs b/util/PostgresMigrations/Migrations/20250610175037_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs similarity index 99% rename from util/PostgresMigrations/Migrations/20250610172708_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs rename to util/PostgresMigrations/Migrations/20250610175037_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs index ce686936e1..542b12ca3d 100644 --- a/util/PostgresMigrations/Migrations/20250610172708_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs +++ b/util/PostgresMigrations/Migrations/20250610175037_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs @@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace Bit.PostgresMigrations.Migrations { [DbContext(typeof(DatabaseContext))] - [Migration("20250610172708_2025-06-10_02_UpdateOrgDeleteByIdProc.sql")] + [Migration("20250610175037_2025-06-10_02_UpdateOrgDeleteByIdProc.sql")] partial class _20250610_02_UpdateOrgDeleteByIdProcsql { /// @@ -685,8 +685,8 @@ namespace Bit.PostgresMigrations.Migrations .HasColumnType("timestamp with time zone"); b.Property("ExternalId") - .HasMaxLength(50) - .HasColumnType("character varying(50)") + .HasMaxLength(300) + .HasColumnType("character varying(300)") .UseCollation("postgresIndetermanisticCollation"); b.Property("OrganizationId") @@ -1053,6 +1053,9 @@ namespace Bit.PostgresMigrations.Migrations b.Property("CreationDate") .HasColumnType("timestamp with time zone"); + b.Property("DefaultUserCollectionEmail") + .HasColumnType("text"); + b.Property("ExternalId") .HasMaxLength(300) .HasColumnType("character varying(300)"); @@ -1067,6 +1070,9 @@ namespace Bit.PostgresMigrations.Migrations b.Property("RevisionDate") .HasColumnType("timestamp with time zone"); + b.Property("Type") + .HasColumnType("integer"); + b.HasKey("Id"); b.HasIndex("OrganizationId"); @@ -1534,6 +1540,10 @@ namespace Bit.PostgresMigrations.Migrations b.Property("Disabled") .HasColumnType("boolean"); + b.Property("Emails") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + b.Property("ExpirationDate") .HasColumnType("timestamp with time zone"); diff --git a/util/PostgresMigrations/Migrations/20250610172708_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs b/util/PostgresMigrations/Migrations/20250610175037_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs similarity index 100% rename from util/PostgresMigrations/Migrations/20250610172708_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs rename to util/PostgresMigrations/Migrations/20250610175037_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs diff --git a/util/SqliteMigrations/Migrations/20250610172702_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs b/util/SqliteMigrations/Migrations/20250610175044_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs similarity index 99% rename from util/SqliteMigrations/Migrations/20250610172702_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs rename to util/SqliteMigrations/Migrations/20250610175044_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs index 9b056c515d..ee2eb0a661 100644 --- a/util/SqliteMigrations/Migrations/20250610172702_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs +++ b/util/SqliteMigrations/Migrations/20250610175044_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.Designer.cs @@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace Bit.SqliteMigrations.Migrations { [DbContext(typeof(DatabaseContext))] - [Migration("20250610172702_2025-06-10_02_UpdateOrgDeleteByIdProc.sql")] + [Migration("20250610175044_2025-06-10_02_UpdateOrgDeleteByIdProc.sql")] partial class _20250610_02_UpdateOrgDeleteByIdProcsql { /// @@ -671,7 +671,7 @@ namespace Bit.SqliteMigrations.Migrations .HasColumnType("TEXT"); b.Property("ExternalId") - .HasMaxLength(50) + .HasMaxLength(300) .HasColumnType("TEXT"); b.Property("OrganizationId") @@ -1037,6 +1037,9 @@ namespace Bit.SqliteMigrations.Migrations b.Property("CreationDate") .HasColumnType("TEXT"); + b.Property("DefaultUserCollectionEmail") + .HasColumnType("TEXT"); + b.Property("ExternalId") .HasMaxLength(300) .HasColumnType("TEXT"); @@ -1051,6 +1054,9 @@ namespace Bit.SqliteMigrations.Migrations b.Property("RevisionDate") .HasColumnType("TEXT"); + b.Property("Type") + .HasColumnType("INTEGER"); + b.HasKey("Id"); b.HasIndex("OrganizationId"); @@ -1518,6 +1524,10 @@ namespace Bit.SqliteMigrations.Migrations b.Property("Disabled") .HasColumnType("INTEGER"); + b.Property("Emails") + .HasMaxLength(1024) + .HasColumnType("TEXT"); + b.Property("ExpirationDate") .HasColumnType("TEXT"); diff --git a/util/SqliteMigrations/Migrations/20250610172702_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs b/util/SqliteMigrations/Migrations/20250610175044_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs similarity index 100% rename from util/SqliteMigrations/Migrations/20250610172702_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs rename to util/SqliteMigrations/Migrations/20250610175044_2025-06-10_02_UpdateOrgDeleteByIdProc.sql.cs