Skip to content

Commit f379d7b

Browse files
committed
Introduced Utilities schema
This formalizes the conceptual distinction between utilities that are meant to be used by administrators on an as-needed basis, and objects that are key to the day-to-day operation of the application, and are called directly by the OnTopic Library. Previously, the utilities were already organized into a _Utilities_ folder. Establishing the `Utilities` schema formalizes that and helps that organizational structure carry over to SQL Server itself.
1 parent 9482628 commit f379d7b

10 files changed

Lines changed: 11 additions & 9 deletions

OnTopic.Data.Sql.Database/OnTopic.Data.Sql.Database.sqlproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
<Folder Include="Utilities\Stored Procedures" />
7373
</ItemGroup>
7474
<ItemGroup>
75+
<Build Include="Utilities\Schema.sql" />
7576
<Build Include="Utilities\Stored Procedures\GenerateNestedSet.sql" />
7677
<Build Include="Utilities\Stored Procedures\CompressHierarchy.sql" />
7778
<Build Include="Utilities\Stored Procedures\DisableForeignKeys.sql" />
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CREATE SCHEMA [Utilities]

OnTopic.Data.Sql.Database/Utilities/Stored Procedures/CompressHierarchy.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
-- Remove gaps within nested set model created when non-leaf nodes are deleted
55
--------------------------------------------------------------------------------------------------------------------------------
66

7-
CREATE PROCEDURE [dbo].[CompressTopics]
7+
CREATE PROCEDURE [Utilities].[CompressTopics]
88
AS
99

1010
SET NOCOUNT ON;

OnTopic.Data.Sql.Database/Utilities/Stored Procedures/ConsolidateVersions.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-- collapsed prior to the start date.
88
--------------------------------------------------------------------------------------------------------------------------------
99

10-
CREATE PROCEDURE [dbo].[ConsolidateVersions]
10+
CREATE PROCEDURE [Utilities].[ConsolidateVersions]
1111
@StartDate datetime = 20000101,
1212
@EndDate datetime = null
1313
AS

OnTopic.Data.Sql.Database/Utilities/Stored Procedures/DeleteConsecutiveAttributes.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
-- <c>Title</c> gets changed, then gets reverted, all three versions will be retained in the database.
1010
--------------------------------------------------------------------------------------------------------------------------------
1111

12-
CREATE PROCEDURE [dbo].[DeleteConsecutiveAttributes]
12+
CREATE PROCEDURE [Utilities].[DeleteConsecutiveAttributes]
1313
AS
1414

1515
SET NOCOUNT ON;

OnTopic.Data.Sql.Database/Utilities/Stored Procedures/DeleteConsecutiveExtendedAttributes.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
-- be patient!
1313
--------------------------------------------------------------------------------------------------------------------------------
1414

15-
CREATE PROCEDURE [dbo].[DeleteConsecutiveExtendedAttributes]
15+
CREATE PROCEDURE [Utilities].[DeleteConsecutiveExtendedAttributes]
1616
AS
1717

1818
SET NOCOUNT ON;

OnTopic.Data.Sql.Database/Utilities/Stored Procedures/DeleteOrphanedLastModifiedAttributes.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
-- granularity.
1414
--------------------------------------------------------------------------------------------------------------------------------
1515

16-
CREATE PROCEDURE [dbo].[DeleteOrphanedLastModifiedAttributes]
16+
CREATE PROCEDURE [Utilities].[DeleteOrphanedLastModifiedAttributes]
1717
AS
1818

1919
SET NOCOUNT ON;

OnTopic.Data.Sql.Database/Utilities/Stored Procedures/DisableForeignKeys.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CREATE PROCEDURE DisableForeignKeys
1+
CREATE PROCEDURE [Utilities].[DisableForeignKeys]
22
@disable BIT = 1
33
AS
44

OnTopic.Data.Sql.Database/Utilities/Stored Procedures/GenerateNestedSet.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
-- and uses it to generate a nested set based table in Topics. Useful for recovering from a corrupted nested set model.
66
--------------------------------------------------------------------------------------------------------------------------------
77

8-
CREATE PROCEDURE [dbo].[GenerateNestedSet]
8+
CREATE PROCEDURE [Utilities].[GenerateNestedSet]
99
AS
1010

1111
SET IDENTITY_INSERT Topics ON

OnTopic.Data.Sql.Database/Utilities/Stored Procedures/ValidateHierarchy.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
--------------------------------------------------------------------------------------------------------------------------------
44
-- Helps identify potential sources of corruption in the nested set hierarchy
55
--------------------------------------------------------------------------------------------------------------------------------
6-
-- ### NOTE JJC20191211: The nested set model is incredibly useful to fast reads of a hierarchy. But it is also susceptible to
6+
-- ### NOTE JJC20191211: The nested set model is incredibly useful for fast reads of a hierarchy. But it is also susceptible to
77
-- corruption from e.g., errant queries or poorly handled transactions. Ideally, this script shouldn't be necessary. But, as a
88
-- safety precaution, it provides a means of identifying potential sources of corruption. It won't resolve the corruption, nor
99
-- fully identify where it is. But it'll help identify scenarios that should never occur.
1010
--------------------------------------------------------------------------------------------------------------------------------
11-
CREATE PROCEDURE [dbo].[ValidateHierarchy]
11+
CREATE PROCEDURE [Utilities].[ValidateHierarchy]
1212
AS
1313

1414
--------------------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)