diff --git a/src/Sql/dbo/Stored Procedures/Collection_ReadByIdUserId.sql b/src/Sql/dbo/Stored Procedures/Collection_ReadByIdUserId.sql deleted file mode 100644 index b38709507..000000000 --- a/src/Sql/dbo/Stored Procedures/Collection_ReadByIdUserId.sql +++ /dev/null @@ -1,28 +0,0 @@ -CREATE PROCEDURE [dbo].[Collection_ReadByIdUserId] - @Id UNIQUEIDENTIFIER, - @UserId UNIQUEIDENTIFIER -AS -BEGIN - SET NOCOUNT ON - SELECT - Id, - OrganizationId, - [Name], - CreationDate, - RevisionDate, - ExternalId, - MIN([ReadOnly]) AS [ReadOnly], - MIN([HidePasswords]) AS [HidePasswords], - MAX([Manage]) AS [Manage] - FROM - [dbo].[UserCollectionDetails](@UserId) - WHERE - [Id] = @Id - GROUP BY - Id, - OrganizationId, - [Name], - CreationDate, - RevisionDate, - ExternalId -END diff --git a/src/Sql/dbo/Stored Procedures/Collection_ReadByIdUserId_V2.sql b/src/Sql/dbo/Stored Procedures/Collection_ReadByIdUserId_V2.sql deleted file mode 100644 index e753fc89a..000000000 --- a/src/Sql/dbo/Stored Procedures/Collection_ReadByIdUserId_V2.sql +++ /dev/null @@ -1,28 +0,0 @@ -CREATE PROCEDURE [dbo].[Collection_ReadByIdUserId_V2] - @Id UNIQUEIDENTIFIER, - @UserId UNIQUEIDENTIFIER -AS -BEGIN - SET NOCOUNT ON - SELECT - Id, - OrganizationId, - [Name], - CreationDate, - RevisionDate, - ExternalId, - MIN([ReadOnly]) AS [ReadOnly], - MIN([HidePasswords]) AS [HidePasswords], - MAX([Manage]) AS [Manage] - FROM - [dbo].[UserCollectionDetails_V2](@UserId) - WHERE - [Id] = @Id - GROUP BY - Id, - OrganizationId, - [Name], - CreationDate, - RevisionDate, - ExternalId -END diff --git a/src/Sql/dbo/Stored Procedures/Collection_ReadWithGroupsAndUsersByIdUserId.sql b/src/Sql/dbo/Stored Procedures/Collection_ReadWithGroupsAndUsersByIdUserId.sql deleted file mode 100644 index a29077e41..000000000 --- a/src/Sql/dbo/Stored Procedures/Collection_ReadWithGroupsAndUsersByIdUserId.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE PROCEDURE [dbo].[Collection_ReadWithGroupsAndUsersByIdUserId] - @Id UNIQUEIDENTIFIER, - @UserId UNIQUEIDENTIFIER -AS -BEGIN - SET NOCOUNT ON - - EXEC [dbo].[Collection_ReadByIdUserId] @Id, @UserId - - EXEC [dbo].[CollectionGroup_ReadByCollectionId] @Id - - EXEC [dbo].[CollectionUser_ReadByCollectionId] @Id -END \ No newline at end of file diff --git a/src/Sql/dbo/Stored Procedures/Collection_ReadWithGroupsAndUsersByIdUserId_V2.sql b/src/Sql/dbo/Stored Procedures/Collection_ReadWithGroupsAndUsersByIdUserId_V2.sql deleted file mode 100644 index 2ddc269ee..000000000 --- a/src/Sql/dbo/Stored Procedures/Collection_ReadWithGroupsAndUsersByIdUserId_V2.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE PROCEDURE [dbo].[Collection_ReadWithGroupsAndUsersByIdUserId_V2] - @Id UNIQUEIDENTIFIER, - @UserId UNIQUEIDENTIFIER -AS -BEGIN - SET NOCOUNT ON - - EXEC [dbo].[Collection_ReadByIdUserId_V2] @Id, @UserId - - EXEC [dbo].[CollectionGroup_ReadByCollectionId] @Id - - EXEC [dbo].[CollectionUser_ReadByCollectionId] @Id -END diff --git a/src/Sql/dbo/Stored Procedures/Collection_ReadWithGroupsAndUsersByUserId.sql b/src/Sql/dbo/Stored Procedures/Collection_ReadWithGroupsAndUsersByUserId.sql deleted file mode 100644 index 8550c7e2f..000000000 --- a/src/Sql/dbo/Stored Procedures/Collection_ReadWithGroupsAndUsersByUserId.sql +++ /dev/null @@ -1,39 +0,0 @@ -CREATE PROCEDURE [dbo].[Collection_ReadWithGroupsAndUsersByUserId] - @UserId UNIQUEIDENTIFIER -AS -BEGIN - SET NOCOUNT ON - - DECLARE @TempUserCollections TABLE( - Id UNIQUEIDENTIFIER, - OrganizationId UNIQUEIDENTIFIER, - Name VARCHAR(MAX), - CreationDate DATETIME2(7), - RevisionDate DATETIME2(7), - ExternalId NVARCHAR(300), - ReadOnly BIT, - HidePasswords BIT, - Manage BIT) - - INSERT INTO @TempUserCollections EXEC [dbo].[Collection_ReadByUserId] @UserId - - SELECT - * - FROM - @TempUserCollections C - - SELECT - CG.* - FROM - [dbo].[CollectionGroup] CG - INNER JOIN - @TempUserCollections C ON C.[Id] = CG.[CollectionId] - - SELECT - CU.* - FROM - [dbo].[CollectionUser] CU - INNER JOIN - @TempUserCollections C ON C.[Id] = CU.[CollectionId] - -END diff --git a/src/Sql/dbo/Stored Procedures/Collection_ReadWithGroupsAndUsersByUserId_V2.sql b/src/Sql/dbo/Stored Procedures/Collection_ReadWithGroupsAndUsersByUserId_V2.sql deleted file mode 100644 index 300088daf..000000000 --- a/src/Sql/dbo/Stored Procedures/Collection_ReadWithGroupsAndUsersByUserId_V2.sql +++ /dev/null @@ -1,39 +0,0 @@ -CREATE PROCEDURE [dbo].[Collection_ReadWithGroupsAndUsersByUserId_V2] - @UserId UNIQUEIDENTIFIER -AS -BEGIN - SET NOCOUNT ON - - DECLARE @TempUserCollections TABLE( - Id UNIQUEIDENTIFIER, - OrganizationId UNIQUEIDENTIFIER, - Name VARCHAR(MAX), - CreationDate DATETIME2(7), - RevisionDate DATETIME2(7), - ExternalId NVARCHAR(300), - ReadOnly BIT, - HidePasswords BIT, - Manage BIT) - - INSERT INTO @TempUserCollections EXEC [dbo].[Collection_ReadByUserId_V2] @UserId - - SELECT - * - FROM - @TempUserCollections C - - SELECT - CG.* - FROM - [dbo].[CollectionGroup] CG - INNER JOIN - @TempUserCollections C ON C.[Id] = CG.[CollectionId] - - SELECT - CU.* - FROM - [dbo].[CollectionUser] CU - INNER JOIN - @TempUserCollections C ON C.[Id] = CU.[CollectionId] - -END diff --git a/util/Migrator/DbScripts/2024-07-03_00_DropUnusedCollectionRepositorySprocs.sql b/util/Migrator/DbScripts/2024-07-03_00_DropUnusedCollectionRepositorySprocs.sql new file mode 100644 index 000000000..0833029ed --- /dev/null +++ b/util/Migrator/DbScripts/2024-07-03_00_DropUnusedCollectionRepositorySprocs.sql @@ -0,0 +1,37 @@ +-- Clean up chore: delete unused sprocs, including unused V2 versions + +IF OBJECT_ID('[dbo].[Collection_ReadWithGroupsAndUsersByIdUserId]') IS NOT NULL +BEGIN + DROP PROCEDURE [dbo].[Collection_ReadWithGroupsAndUsersByIdUserId] +END +GO + +IF OBJECT_ID('[dbo].[Collection_ReadWithGroupsAndUsersByIdUserId_V2]') IS NOT NULL +BEGIN + DROP PROCEDURE [dbo].[Collection_ReadWithGroupsAndUsersByIdUserId_V2] +END +GO + +IF OBJECT_ID('[dbo].[Collection_ReadWithGroupsAndUsersByUserId]') IS NOT NULL +BEGIN + DROP PROCEDURE [dbo].[Collection_ReadWithGroupsAndUsersByUserId] +END +GO + +IF OBJECT_ID('[dbo].[Collection_ReadWithGroupsAndUsersByUserId_V2]') IS NOT NULL +BEGIN + DROP PROCEDURE [dbo].[Collection_ReadWithGroupsAndUsersByUserId_V2] +END +GO + +IF OBJECT_ID('[dbo].[Collection_ReadByIdUserId]') IS NOT NULL +BEGIN + DROP PROCEDURE [dbo].[Collection_ReadByIdUserId] +END +GO + +IF OBJECT_ID('[dbo].[Collection_ReadByIdUserId_V2]') IS NOT NULL +BEGIN + DROP PROCEDURE [dbo].[Collection_ReadByIdUserId_V2] +END +GO