Skip to content

Commit d976bff

Browse files
lowlydbaAppveyor
andauthored
Development (#226)
* update codecov binary source (#222) * update codecov binary source * Update appveyor.yml * Update appveyor.yml * CI produced files Co-authored-by: Appveyor <[email protected]> * Sp doc exclude ssdt sys tables (#225) * exclude SSDT sys tables Fixes #224 * bump version * fix url * use alias'd col references * fix ssdt table logic * Update sp_doc.Tests.sql * CI produced files Co-authored-by: Appveyor <[email protected]> * Update super-linter.yml * Update .gitignore * test removing opencoverxml files locally pretty sure they aren't needed - just the sp file copies Co-authored-by: Appveyor <[email protected]>
1 parent 13697eb commit d976bff

File tree

9 files changed

+85
-1105
lines changed

9 files changed

+85
-1105
lines changed

.github/workflows/super-linter.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ jobs:
4545
- name: Lint Code Base
4646
uses: docker://github/super-linter:v3.13.5
4747
env:
48-
LINTER_RULES_PATH: .github/linter-conf
48+
LINTER_RULES_PATH: .github/linter-conf
4949
VALIDATE_MARKDOWN: true
5050
VALIDATE_POWERSHELL: true
51+
FILTER_REGEX_EXCLUDE: /github/workspace/*
5152
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules/*
33
package-lock.json
44
debug.log
55
test.md
6+
appveyor/sqlcover/*.opencoverxml

.vscode/settings.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,25 @@
22
"markdownlint.config": {
33
"MD024": false,
44
"MD010": {
5-
"code_blocks": false
5+
"code_blocks": false
66
},
77
"MD033": {
8-
"allowed_elements": ["details", "summary", "img", "sub", "br"]
8+
"allowed_elements": ["details", "summary", "img", "sub", "br"]
99
},
1010
"MD013": {
1111
"code_blocks": false,
1212
"tables": false
1313
}
1414
},
1515
"powershell.codeFormatting.trimWhitespaceAroundPipe": true,
16-
"powershell.codeFormatting.useCorrectCasing": true
16+
"powershell.codeFormatting.useCorrectCasing": true,
17+
18+
// The number of spaces a tab is equal to.
19+
"editor.tabSize": 4,
20+
21+
// Insert spaces when pressing Tab.
22+
"editor.insertSpaces": true,
23+
24+
// When opening a file, `editor.tabSize` and `editor.insertSpaces` will be detected based on the file contents.
25+
"editor.detectIndentation": true
1726
}

appveyor/sqlcover/Coverage.opencoverxml

Lines changed: 0 additions & 667 deletions
This file was deleted.

appveyor/sqlcover/Coverage_azuresql.opencoverxml

Lines changed: 0 additions & 396 deletions
This file was deleted.

appveyor/sqlcover/[dbo].[sp_doc]

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ AS
1515
/*
1616
sp_doc - Always have current documentation by generating it on the fly in markdown.
1717

18-
Part of the DBA MultiTool http://dba-multitool.org
18+
Part of the DBA MultiTool https://dba-multitool.org
1919

20-
Version: 20210801
20+
Version: 20211223
2121

2222
MIT License
2323

@@ -289,21 +289,31 @@ BEGIN
289289
,(CONCAT(CHAR(13), CHAR(10), ''<details><summary>Click to expand</summary>'', CHAR(13), CHAR(10)));' +
290290

291291
+ N'INSERT INTO #markdown (value)
292-
SELECT CONCAT(''* ['', OBJECT_SCHEMA_NAME(object_id), ''.'', OBJECT_NAME(object_id), ''](#'', REPLACE(LOWER(OBJECT_SCHEMA_NAME(object_id)), '' '', ''-''), REPLACE(LOWER(OBJECT_NAME(object_id)), '' '', ''-''), '')'')
293-
FROM [sys].[tables]
294-
WHERE [type] = ''U''
295-
AND [is_ms_shipped] = 0
296-
ORDER BY OBJECT_SCHEMA_NAME([object_id]), [name] ASC;' +
292+
SELECT CONCAT(''* ['', OBJECT_SCHEMA_NAME([t].[object_id]), ''.'', OBJECT_NAME([t].[object_id]), ''](#'', REPLACE(LOWER(OBJECT_SCHEMA_NAME([t].[object_id])), '' '', ''-''), REPLACE(LOWER(OBJECT_NAME([t].[object_id])), '' '', ''-''), '')'')
293+
FROM [sys].[tables] [t]
294+
LEFT JOIN [sys].[extended_properties] [ep] ON [t].[object_id] = [ep].[major_id]
295+
AND [ep].[minor_id] = 0 --On the table
296+
AND [ep].[class] = 1 --Object or col
297+
AND [ep].[name] = ''microsoft_database_tools_support''
298+
WHERE [t].[type] = ''U''
299+
AND [t].[is_ms_shipped] = 0
300+
AND [ep].[name] IS NULL --Exclude SSDT tables
301+
ORDER BY OBJECT_SCHEMA_NAME([t].[object_id]), [t].[name] ASC;' +
297302

298303
--Object details
299304
+ N'DECLARE obj_cursor CURSOR
300305
LOCAL STATIC READ_ONLY FORWARD_ONLY
301306
FOR
302-
SELECT [object_id]
303-
FROM [sys].[tables]
304-
WHERE [type] = ''U''
305-
AND [is_ms_shipped] = 0
306-
ORDER BY OBJECT_SCHEMA_NAME([object_id]), [name] ASC;
307+
SELECT [t].[object_id]
308+
FROM [sys].[tables] [t]
309+
LEFT JOIN [sys].[extended_properties] [ep] ON [t].[object_id] = [ep].[major_id]
310+
AND [ep].[minor_id] = 0 --On the table
311+
AND [ep].[class] = 1 --Object or col
312+
AND [ep].[name] = ''microsoft_database_tools_support''
313+
WHERE [t].[type] = ''U''
314+
AND [t].[is_ms_shipped] = 0
315+
AND [ep].[name] IS NULL --Exclude SSDT tables
316+
ORDER BY OBJECT_SCHEMA_NAME([t].[object_id]), [t].[name] ASC;
307317

308318
OPEN obj_cursor
309319
FETCH NEXT FROM obj_cursor INTO @ObjectId

install_dba-multitool.sql

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ AS
8484
/*
8585
sp_doc - Always have current documentation by generating it on the fly in markdown.
8686
87-
Part of the DBA MultiTool http://dba-multitool.org
87+
Part of the DBA MultiTool https://dba-multitool.org
8888
89-
Version: 20210801
89+
Version: 20211223
9090
9191
MIT License
9292
@@ -358,21 +358,31 @@ BEGIN
358358
,(CONCAT(CHAR(13), CHAR(10), ''<details><summary>Click to expand</summary>'', CHAR(13), CHAR(10)));' +
359359

360360
+ N'INSERT INTO #markdown (value)
361-
SELECT CONCAT(''* ['', OBJECT_SCHEMA_NAME(object_id), ''.'', OBJECT_NAME(object_id), ''](#'', REPLACE(LOWER(OBJECT_SCHEMA_NAME(object_id)), '' '', ''-''), REPLACE(LOWER(OBJECT_NAME(object_id)), '' '', ''-''), '')'')
362-
FROM [sys].[tables]
363-
WHERE [type] = ''U''
364-
AND [is_ms_shipped] = 0
365-
ORDER BY OBJECT_SCHEMA_NAME([object_id]), [name] ASC;' +
361+
SELECT CONCAT(''* ['', OBJECT_SCHEMA_NAME([t].[object_id]), ''.'', OBJECT_NAME([t].[object_id]), ''](#'', REPLACE(LOWER(OBJECT_SCHEMA_NAME([t].[object_id])), '' '', ''-''), REPLACE(LOWER(OBJECT_NAME([t].[object_id])), '' '', ''-''), '')'')
362+
FROM [sys].[tables] [t]
363+
LEFT JOIN [sys].[extended_properties] [ep] ON [t].[object_id] = [ep].[major_id]
364+
AND [ep].[minor_id] = 0 --On the table
365+
AND [ep].[class] = 1 --Object or col
366+
AND [ep].[name] = ''microsoft_database_tools_support''
367+
WHERE [t].[type] = ''U''
368+
AND [t].[is_ms_shipped] = 0
369+
AND [ep].[name] IS NULL --Exclude SSDT tables
370+
ORDER BY OBJECT_SCHEMA_NAME([t].[object_id]), [t].[name] ASC;' +
366371

367372
--Object details
368373
+ N'DECLARE obj_cursor CURSOR
369374
LOCAL STATIC READ_ONLY FORWARD_ONLY
370375
FOR
371-
SELECT [object_id]
372-
FROM [sys].[tables]
373-
WHERE [type] = ''U''
374-
AND [is_ms_shipped] = 0
375-
ORDER BY OBJECT_SCHEMA_NAME([object_id]), [name] ASC;
376+
SELECT [t].[object_id]
377+
FROM [sys].[tables] [t]
378+
LEFT JOIN [sys].[extended_properties] [ep] ON [t].[object_id] = [ep].[major_id]
379+
AND [ep].[minor_id] = 0 --On the table
380+
AND [ep].[class] = 1 --Object or col
381+
AND [ep].[name] = ''microsoft_database_tools_support''
382+
WHERE [t].[type] = ''U''
383+
AND [t].[is_ms_shipped] = 0
384+
AND [ep].[name] IS NULL --Exclude SSDT tables
385+
ORDER BY OBJECT_SCHEMA_NAME([t].[object_id]), [t].[name] ASC;
376386
377387
OPEN obj_cursor
378388
FETCH NEXT FROM obj_cursor INTO @ObjectId

sp_doc.sql

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ AS
8484
/*
8585
sp_doc - Always have current documentation by generating it on the fly in markdown.
8686
87-
Part of the DBA MultiTool http://dba-multitool.org
87+
Part of the DBA MultiTool https://dba-multitool.org
8888
89-
Version: 20210801
89+
Version: 20211223
9090
9191
MIT License
9292
@@ -358,21 +358,31 @@ BEGIN
358358
,(CONCAT(CHAR(13), CHAR(10), ''<details><summary>Click to expand</summary>'', CHAR(13), CHAR(10)));' +
359359

360360
+ N'INSERT INTO #markdown (value)
361-
SELECT CONCAT(''* ['', OBJECT_SCHEMA_NAME(object_id), ''.'', OBJECT_NAME(object_id), ''](#'', REPLACE(LOWER(OBJECT_SCHEMA_NAME(object_id)), '' '', ''-''), REPLACE(LOWER(OBJECT_NAME(object_id)), '' '', ''-''), '')'')
362-
FROM [sys].[tables]
363-
WHERE [type] = ''U''
364-
AND [is_ms_shipped] = 0
365-
ORDER BY OBJECT_SCHEMA_NAME([object_id]), [name] ASC;' +
361+
SELECT CONCAT(''* ['', OBJECT_SCHEMA_NAME([t].[object_id]), ''.'', OBJECT_NAME([t].[object_id]), ''](#'', REPLACE(LOWER(OBJECT_SCHEMA_NAME([t].[object_id])), '' '', ''-''), REPLACE(LOWER(OBJECT_NAME([t].[object_id])), '' '', ''-''), '')'')
362+
FROM [sys].[tables] [t]
363+
LEFT JOIN [sys].[extended_properties] [ep] ON [t].[object_id] = [ep].[major_id]
364+
AND [ep].[minor_id] = 0 --On the table
365+
AND [ep].[class] = 1 --Object or col
366+
AND [ep].[name] = ''microsoft_database_tools_support''
367+
WHERE [t].[type] = ''U''
368+
AND [t].[is_ms_shipped] = 0
369+
AND [ep].[name] IS NULL --Exclude SSDT tables
370+
ORDER BY OBJECT_SCHEMA_NAME([t].[object_id]), [t].[name] ASC;' +
366371

367372
--Object details
368373
+ N'DECLARE obj_cursor CURSOR
369374
LOCAL STATIC READ_ONLY FORWARD_ONLY
370375
FOR
371-
SELECT [object_id]
372-
FROM [sys].[tables]
373-
WHERE [type] = ''U''
374-
AND [is_ms_shipped] = 0
375-
ORDER BY OBJECT_SCHEMA_NAME([object_id]), [name] ASC;
376+
SELECT [t].[object_id]
377+
FROM [sys].[tables] [t]
378+
LEFT JOIN [sys].[extended_properties] [ep] ON [t].[object_id] = [ep].[major_id]
379+
AND [ep].[minor_id] = 0 --On the table
380+
AND [ep].[class] = 1 --Object or col
381+
AND [ep].[name] = ''microsoft_database_tools_support''
382+
WHERE [t].[type] = ''U''
383+
AND [t].[is_ms_shipped] = 0
384+
AND [ep].[name] IS NULL --Exclude SSDT tables
385+
ORDER BY OBJECT_SCHEMA_NAME([t].[object_id]), [t].[name] ASC;
376386
377387
OPEN obj_cursor
378388
FETCH NEXT FROM obj_cursor INTO @ObjectId

tests/sp_doc.Tests.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,11 @@ AS
342342
BEGIN
343343
SET NOCOUNT ON;
344344

345+
345346
DECLARE @Verbose BIT = 0;
346347
DECLARE @DatabaseName SYSNAME = DB_NAME(DB_ID());
347348
DECLARE @TableName SYSNAME = 'TestTable';
349+
DECLARE @SchemaName SYSNAME = 'dbo';
348350
DECLARE @Sql NVARCHAR(MAX);
349351
DECLARE @FailMessage NVARCHAR(1000) = N'Did not find '']'' replaced by ''&#93;'' in markdown output.';
350352
DECLARE @Expected NVARCHAR(250) = N'| Replace | TINYINT | yes | | | this is a bracket &#93; %';
@@ -354,9 +356,9 @@ IF OBJECT_ID('tempdb..#result') IS NOT NULL
354356
BEGIN
355357
DROP TABLE #result;
356358
END
357-
CREATE TABLE #result ([markdown] VARCHAR(8000));
359+
CREATE TABLE #result ([markdown] NVARCHAR(MAX));
358360

359-
SET @Sql = N'CREATE TABLE [dbo].' + QUOTENAME(@TableName) + '([Replace] TINYINT);';
361+
SET @Sql = N'CREATE TABLE ' + QUOTENAME(@SchemaName) + '.' + QUOTENAME(@TableName) + '([Replace] TINYINT);';
360362
EXEC sp_executesql @Sql;
361363

362364
EXEC sp_addextendedproperty

0 commit comments

Comments
 (0)