Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added comparison SSMS project
  • Loading branch information
mbt1 committed Sep 11, 2021
commit 90611f06393e164c46b8cb13002eb9d1c80fcc45
46 changes: 46 additions & 0 deletions OldSSMSStyle/OldSSMSStyle/Code/Code.ssmssqlproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0"?>
<SqlWorkbenchSqlProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="Code">
<Items>
<LogicalFolder Name="Connections" Type="2" Sorted="true">
<Items />
</LogicalFolder>
<LogicalFolder Name="Queries" Type="0" Sorted="true">
<Items>
<FileNode Name="build.sql">
<AssociatedConnectionMoniker />
<AssociatedConnSrvName />
<AssociatedConnUserName />
<FullPath>build.sql</FullPath>
</FileNode>
<FileNode Name="create.demo.db.sql">
<AssociatedConnectionMoniker />
<AssociatedConnSrvName />
<AssociatedConnUserName />
<FullPath>create.demo.db.sql</FullPath>
</FileNode>
<FileNode Name="dbo.ARandomProc.ssp.sql">
<AssociatedConnectionMoniker />
<AssociatedConnSrvName />
<AssociatedConnUserName />
<FullPath>dbo.ARandomProc.ssp.sql</FullPath>
</FileNode>
<FileNode Name="dbo.ARandomTable.tbl.sql">
<AssociatedConnectionMoniker />
<AssociatedConnSrvName />
<AssociatedConnUserName />
<FullPath>dbo.ARandomTable.tbl.sql</FullPath>
</FileNode>
</Items>
</LogicalFolder>
<LogicalFolder Name="Miscellaneous" Type="3" Sorted="true">
<Items>
<FileNode Name="build.bat">
<AssociatedConnectionMoniker />
<AssociatedConnSrvName />
<AssociatedConnUserName />
<FullPath>build.bat</FullPath>
</FileNode>
</Items>
</LogicalFolder>
</Items>
</SqlWorkbenchSqlProject>
11 changes: 11 additions & 0 deletions OldSSMSStyle/OldSSMSStyle/Code/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@echo OFF
pushd "%~dp0"

echo.
echo - Building and Deploying Project ----------------------------------------
"%SQLCMD_HOME%\sqlcmd.exe" -i "%~dp0\build.sql" -S "%~1" %~2 -v DEMODB="%~3"
echo.
echo - Finished Building and Deploying Project ---------------------------------

popd

9 changes: 9 additions & 0 deletions OldSSMSStyle/OldSSMSStyle/Code/build.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
:r create.demo.db.sql
GO

:r dbo.ARandomTable.tbl.sql
GO

:r dbo.ARandomProc.ssp.SQL
GO

15 changes: 15 additions & 0 deletions OldSSMSStyle/OldSSMSStyle/Code/create.demo.db.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
USE master
GO

IF(DB_ID('$(DEMODB)')IS NOT NULL)
BEGIN
-- EXEC returns the database context to the prior value once complete, despite the USE statement within.
EXEC('USE $(DEMODB);ALTER DATABASE $(DEMODB) SET SINGLE_USER WITH ROLLBACK IMMEDIATE;');
DROP DATABASE $(DEMODB);
END
GO
CREATE DATABASE $(DEMODB)
GO

USE $(DEMODB)
GO
7 changes: 7 additions & 0 deletions OldSSMSStyle/OldSSMSStyle/Code/dbo.ARandomProc.ssp.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DROP PROCEDURE IF EXISTS dbo.ARandomProc;
GO
CREATE PROCEDURE dbo.ARandomProc
AS
BEGIN
RAISERROR('GotHere',0,1)WITH NOWAIT;
END;
7 changes: 7 additions & 0 deletions OldSSMSStyle/OldSSMSStyle/Code/dbo.ARandomTable.tbl.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DROP TABLE IF EXISTS dbo.ARandomTable;
GO
CREATE TABLE dbo.ARandomTable
(
id INT
);
GO
28 changes: 28 additions & 0 deletions OldSSMSStyle/OldSSMSStyle/OldSSMSStyle.ssmssln
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# SQL Server Management Studio Solution File, Format Version 18.00
VisualStudioVersion = 15.0.28307.421
MinimumVisualStudioVersion = 10.0.40219.1
Project("{4F2E2C19-372F-40D8-9FA7-9D2138C6997A}") = "Code", "Code\Code.ssmssqlproj", "{6CBE4395-3F64-4917-A768-A07AAD4F1CEA}"
EndProject
Project("{4F2E2C19-372F-40D8-9FA7-9D2138C6997A}") = "Tests", "Tests\Tests.ssmssqlproj", "{4F31AE97-01FE-4E39-9202-0FCB26C7FC3C}"
EndProject
Project("{4F2E2C19-372F-40D8-9FA7-9D2138C6997A}") = "tSQLt", "tSQLt\tSQLt.ssmssqlproj", "{E4EDE155-99DD-4501-AAFE-9FAEB8FDCE20}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Default|Default = Default|Default
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6CBE4395-3F64-4917-A768-A07AAD4F1CEA}.Default|Default.ActiveCfg = Default
{977BB47B-B7FB-4E77-86CF-191D973B54F3}.Default|Default.ActiveCfg = Default
{4F31AE97-01FE-4E39-9202-0FCB26C7FC3C}.Default|Default.ActiveCfg = Default
{E4EDE155-99DD-4501-AAFE-9FAEB8FDCE20}.Default|Default.ActiveCfg = Default
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A5B51F2C-D28F-465E-941C-4C151BF838C7}
EndGlobalSection
EndGlobal
22 changes: 22 additions & 0 deletions OldSSMSStyle/OldSSMSStyle/Tests/SomeRandomTests.class.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
EXEC tSQLt.NewTestClass 'SomeRandomTests';
GO
CREATE PROCEDURE SomeRandomTests.[test 1]
AS
BEGIN

EXEC tSQLt.FakeTable @TableName = 'dbo.ARandomTable';

EXEC tSQLt.AssertEmptyTable @TableName = 'dbo.ARandomTable';
END;
GO
CREATE PROCEDURE SomeRandomTests.[test 2]
AS
BEGIN

EXEC tSQLt.FakeTable @TableName = 'dbo.ARandomTable';

EXEC dbo.ARandomProc;

EXEC tSQLt.AssertEmptyTable @TableName = 'dbo.ARandomTable';
END;
GO
34 changes: 34 additions & 0 deletions OldSSMSStyle/OldSSMSStyle/Tests/Tests.ssmssqlproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0"?>
<SqlWorkbenchSqlProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="Tests">
<Items>
<LogicalFolder Name="Connections" Type="2" Sorted="true">
<Items />
</LogicalFolder>
<LogicalFolder Name="Queries" Type="0" Sorted="true">
<Items>
<FileNode Name="build.sql">
<AssociatedConnectionMoniker />
<AssociatedConnSrvName />
<AssociatedConnUserName />
<FullPath>build.sql</FullPath>
</FileNode>
<FileNode Name="SomeRandomTests.class.sql">
<AssociatedConnectionMoniker />
<AssociatedConnSrvName />
<AssociatedConnUserName />
<FullPath>SomeRandomTests.class.sql</FullPath>
</FileNode>
</Items>
</LogicalFolder>
<LogicalFolder Name="Miscellaneous" Type="3" Sorted="true">
<Items>
<FileNode Name="build.bat">
<AssociatedConnectionMoniker />
<AssociatedConnSrvName />
<AssociatedConnUserName />
<FullPath>build.bat</FullPath>
</FileNode>
</Items>
</LogicalFolder>
</Items>
</SqlWorkbenchSqlProject>
22 changes: 22 additions & 0 deletions OldSSMSStyle/OldSSMSStyle/Tests/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@echo OFF
pushd "%~dp0"

echo - Installing Projects ------------------------------------------------
call "%~dp0\..\Code\build.bat" "%~1" "%~2" "%~3"
echo.

echo - Installing tSQLt ------------------------------------------------
call "%~dp0\..\tSQLt\build.bat" "%~1" "%~2" "%~3"
echo.

echo - Creating list of tests ------------------------------------------------
if not exist "%~dp0\temp\" mkdir "%~dp0\temp\"
(for /r %%i in (*.class.sql) do @echo :r "%%i" & echo GO) >temp\installalltests.sql
type temp\installalltests.sql
echo.

echo - Deploying tests --------------------------------------------------------
"%SQLCMD_HOME%\sqlcmd.exe" -i "%~dp0\build.sql" -S "%~1" %~2 -d "%~3"
echo.

popd
3 changes: 3 additions & 0 deletions OldSSMSStyle/OldSSMSStyle/Tests/build.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:r temp\installalltests.sql
GO
EXEC tSQLt.RunAll;
2 changes: 2 additions & 0 deletions OldSSMSStyle/OldSSMSStyle/Tests/temp/installalltests.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:r "C:\Data\git\tSQLt\tSQLt-visual-studio-examples\OldSSMSStyle\OldSSMSStyle\Tests\SomeRandomTests.class.sql"
GO
20 changes: 20 additions & 0 deletions OldSSMSStyle/OldSSMSStyle/tSQLt/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@echo OFF
pushd "%~dp0"

if not exist "%~dp0\tSQLt\" goto :download

:install

"%SQLCMD_HOME%\sqlcmd.exe" -i "%~dp0\build.sql" -S "%~1" %~2 -d "%~3"

popd
goto :EOF

:download

echo download tSQLt from https://tsqlt.org/download/tsqlt/
mkdir "%~dp0\tSQLt\"
curl https://tsqlt.org/download/tsqlt/ -o "%~dp0\tSQLt\tSQLt.zip"
tar -xf "%~dp0\tSQLt\tSQLt.zip" -C "%~dp0\tSQLt\\"

goto :install
10 changes: 10 additions & 0 deletions OldSSMSStyle/OldSSMSStyle/tSQLt/build.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*-- Run this once per server with sysadmin permissions
:r tSQLt\PrepareServer.sql
GO
--*/

:r tSQLt\tSQLt.class.sql
GO

SELECT @@VERSION;
GO
28 changes: 28 additions & 0 deletions OldSSMSStyle/OldSSMSStyle/tSQLt/tSQLt.ssmssqlproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0"?>
<SqlWorkbenchSqlProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="tSQLt">
<Items>
<LogicalFolder Name="Connections" Type="2" Sorted="true">
<Items />
</LogicalFolder>
<LogicalFolder Name="Queries" Type="0" Sorted="true">
<Items>
<FileNode Name="build.sql">
<AssociatedConnectionMoniker />
<AssociatedConnSrvName />
<AssociatedConnUserName />
<FullPath>build.sql</FullPath>
</FileNode>
</Items>
</LogicalFolder>
<LogicalFolder Name="Miscellaneous" Type="3" Sorted="true">
<Items>
<FileNode Name="build.bat">
<AssociatedConnectionMoniker />
<AssociatedConnSrvName />
<AssociatedConnUserName />
<FullPath>build.bat</FullPath>
</FileNode>
</Items>
</LogicalFolder>
</Items>
</SqlWorkbenchSqlProject>
Loading