Skip to content

Commit d8ff7e8

Browse files
authored
Sizeoptimiser 2012 features (#92) (#93)
* Bring sp_sizeopt in line with other sprocs * sp_sizeoptimiser - clean up print statements * Automate installer script gen * Fix @isexpress setting * Reduce printing on sizeoptimiser - Move PS module installs to install step * Add token to appveyor for commits * Move appveyor to dir
1 parent eab0b25 commit d8ff7e8

File tree

7 files changed

+338
-245
lines changed

7 files changed

+338
-245
lines changed

appveyor.yml renamed to appveyor/appveyor.yml

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,17 @@ max_jobs: 1
88
clone_folder: C:\sqlexpress\
99

1010
environment:
11-
#MSSQL Credentials
11+
access_token:
12+
secure: XQvkhXxMw7yJPQF4xQe/OV5+u0Dhx0bsaXIHE2PNvPJr15qw+oA9SNlKYnGo6UNQ
13+
1214
MSSQL_LOGIN: sa
1315
MSSQL_PASS: Password12!
14-
15-
#Test Files
16-
CREATESCRIPT1: sp_sizeoptimiser.sql
17-
CREATESCRIPT2: sp_helpme.sql
18-
CREATESCRIPT3: sp_doc.sql
1916
TSQLTSETCLR: tests\tSQLt\SetClrEnabled.sql
2017
TSQLTCREATEDB: tests\tSQLt\CreateDatabase.sql
2118
TSQLTINSTALL: tests\tSQLt\tSQLt.class.sql
2219
TSQLTBUILDPATH: tests\build
23-
TSQLTTEST: tests\run\run_tests.sql
24-
25-
#Build Constants
20+
TSQLTTESTPATH: tests\run
21+
COMBINED_FILE: install_expsql.sql
2622
TARGET_DB: tSQLt
2723

2824
matrix:
@@ -46,19 +42,16 @@ environment:
4642
MSSQL: SQL2012SP1
4743
DB_INSTANCE: (local)\SQL2012SP1
4844

49-
build_script:
45+
install:
46+
- ps: Install-Module SqlServer -Force -AllowClobber
47+
5048
- echo Starting SQL Server
5149
- ps: >-
52-
5350
$SQLInstance = $env:MSSQL;
5451
Start-Service "MSSQL`$$SQLInstance";
55-
56-
- echo Installing SqlServer PS Module
57-
- ps: Install-Module SqlServer -Force -AllowClobber
5852
5953
- echo Setting up tSQLt
6054
- cmd: >-
61-
6255
SET SCRIPT=%CLONE_FOLDER%%TSQLTSETCLR%
6356
6457
sqlcmd -S %DB_INSTANCE% -U %MSSQL_LOGIN% -P %MSSQL_PASS% -i %SCRIPT% -d master -b > NUL
@@ -71,27 +64,22 @@ build_script:
7164
7265
sqlcmd -S %DB_INSTANCE% -U %MSSQL_LOGIN% -P %MSSQL_PASS% -i %SCRIPT% -d %TARGET_DB% -b
7366
67+
build_script:
7468
- echo Installing ExpressSQL Scripts
7569
- ps: >-
76-
7770
ForEach ($filename in Get-Childitem -Path $env:CLONE_FOLDER -Filter "*.sql") {
7871
Invoke-SqlCmd –ServerInstance $env:DB_INSTANCE -Database $env:TARGET_DB -InputFile $filename.fullname -Username $env:MSSQL_LOGIN -Password $env:MSSQL_PASS
7972
}
8073
8174
- echo Building tSQLt Tests
8275
- ps: >-
83-
8476
ForEach ($filename in Get-Childitem -Path $env:TSQLTBUILDPATH -Filter "*.sql") {
8577
Invoke-SqlCmd –ServerInstance $env:DB_INSTANCE -Database $env:TARGET_DB -InputFile $filename.fullname -Username $env:MSSQL_LOGIN -Password $env:MSSQL_PASS
8678
}
8779
8880
test_script:
8981
- echo Running unit tests
90-
- cmd: >-
91-
92-
SET SCRIPT=%CLONE_FOLDER%%TSQLTTEST%
93-
94-
sqlcmd -S %DB_INSTANCE% -U %MSSQL_LOGIN% -P %MSSQL_PASS% -i %SCRIPT% -d %TARGET_DB% -b -r 1 > NUL
95-
96-
97-
deploy: off
82+
- ps: >-
83+
ForEach ($filename in Get-Childitem -Path $env:TSQLTTESTPATH -Filter "*.sql") {
84+
Invoke-SqlCmd –ServerInstance $env:DB_INSTANCE -Database $env:TARGET_DB -InputFile $filename.fullname -Username $env:MSSQL_LOGIN -Password $env:MSSQL_PASS -Verbose | Out-Null
85+
}

appveyor/make_combined_script.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
$File = "install_expsql.sql"
2+
3+
Set-Location ../
4+
Get-Item *.sql | Get-Content | Out-File $File

install_expsql.sql

391 KB
Binary file not shown.

sp_doc.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ WITH RECOMPILE
2020
AS
2121

2222
/*
23+
sp_doc - Part of the ExpressSQL Suite https://expresssql.lowlydba.com/
24+
2325
MIT License
2426
2527
Copyright (c) 2020 John McCall
@@ -42,7 +44,7 @@ DEALINGS IN THE SOFTWARE.
4244
4345
Example:
4446
45-
EXEC sp_doc @DatabaseName = 'WideWorldImporters';
47+
EXEC sp_doc @DatabaseName = 'WideWorldImporters';
4648
4749
*/
4850

@@ -55,7 +57,7 @@ BEGIN
5557
,@ParmDefinition NVARCHAR(500)
5658
,@QuotedDatabaseName SYSNAME
5759
,@Msg NVARCHAR(MAX)
58-
,@LastUpdated NVARCHAR(20) = '2020-06-24';
60+
,@LastUpdated NVARCHAR(20) = '2020-06-29';
5961

6062
-- Find Version
6163
IF (@SqlMajorVersion = 0)

sp_helpme.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ ALTER PROCEDURE [dbo].[sp_helpme]
1919
AS
2020

2121
/*
22+
sp_helpme - Part of the ExpressSQL Suite https://expresssql.lowlydba.com/
23+
2224
MIT License
2325
2426
Copyright (c) 2020 John McCall
@@ -41,7 +43,7 @@ DEALINGS IN THE SOFTWARE.
4143
4244
Example:
4345
44-
EXEC sp_helpme 'dbo.Sales';
46+
EXEC sp_helpme 'dbo.Sales';
4547
4648
*/
4749

@@ -65,7 +67,7 @@ BEGIN
6567
,@SQLString NVARCHAR(MAX) = N''
6668
,@Msg NVARCHAR(MAX) = N''
6769
,@ParmDefinition NVARCHAR(500)
68-
,@LastUpdated NVARCHAR(20) = '2020-06-24';
70+
,@LastUpdated NVARCHAR(20) = '2020-06-29';
6971

7072
/* Find Version */
7173
IF (@SqlMajorVersion = 0)

0 commit comments

Comments
 (0)