Skip to content

Commit 95d7e71

Browse files
Initial commit
0 parents  commit 95d7e71

File tree

118 files changed

+14530
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+14530
-0
lines changed

.github/FUNDING.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
github: [potatoqualitee, Stuart-Moore, sanderstad, jpomfret]

.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
dbatools-startmigration-transcript.txt
2+
dbatools-exceptions.txt
3+
*TempPoint*
4+
*.pssproj
5+
6+
# ignore the settings folder and files for VSCode
7+
.vscode/*
8+
*.psproj
9+
dbatools.psprojs
10+
11+
# ignore the settings folder and files for Visual Studio
12+
.vs/*
13+
14+
# VIM backup files
15+
*~
16+
17+
# msbuild log file and structured binary log file
18+
msbuild.log
19+
msbuild.binlog
20+
21+
# Local constant file
22+
tests/constants.local.ps1
23+
24+
# For those that want to use Docker images for testing
25+
# Integration with Docker requires the docker compose file to exist within the project folder
26+
docker-compose.yml
27+
28+
### NCrunch ###
29+
# NCrunch
30+
*.ncrunch*
31+
_NCrunch_*
32+
*.crunch.xml
33+
*.ncrunchsolution*
34+
nCrunchTemp_*
35+
36+
debug.log
37+
bin/
38+
temp/
39+
runtimes/
40+
lib/

.markdownlint.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"MD024": false,
3+
"MD022": false,
4+
"MD032": false,
5+
"MD013": false,
6+
"MD001": true
7+
}

CODE_OF_CONDUCT.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Code of Conduct
2+
3+
SQLCollaborative Organization and the dbatools team is dedicated to providing a positive and harassment-free experience for everyone, regardless of age, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, ethnicity, race, religion, nationality, or level of experience. We do not tolerate harassment in any form, nor do we tolerate any behavior that would reasonably lead to someone being made to feel unsafe, insecure, or frightened for their physical or emotional well-being.
4+
5+
This applies to all interactions here on GitHub, Slack, YouTube comments and YouTube chat. All communication should be appropriate for a professional audience including people of many different backgrounds.
6+
7+
Examples of encouraged behavior that contributes to a positive environment include:
8+
9+
- Using welcoming and inclusive language
10+
- Being respectful of differing viewpoints and experiences
11+
- Gracefully accepting constructive criticism
12+
- Focusing on what is best for everyone at the event
13+
- Showing empathy towards other participants
14+
15+
Unacceptable behavior includes:
16+
17+
- Offensive comments related to gender identity and expression, sexual orientation, race, ethnicity, language, neuro-type, size, ability, class, religion, culture, subculture, political opinion, age, skill level, occupation, or background
18+
- Trolling, insulting or derogatory comments, personal or political attacks
19+
- Deliberate intimidation
20+
- Harassment of any kind, even in a joking or ironic manner
21+
- Other conduct which could reasonably be considered inappropriate in a professional setting
22+
- Sexually explicit or violent material
23+
- Or any other kinds of harassment
24+
- Be kind to others. Do not insult or put down others. Behave professionally. Remember that harassment and sexist, racist, or exclusionary jokes are not appropriate.
25+
26+
Use your best judgement. If it will possibly make others uncomfortable, do not post it.
27+
28+
If you believe someone is violating the code of conduct, we ask that you report it by contacting [Chrissy LeMaire](https://twitter.com/cl) or [Shawn Melton](https://twitter.com/wsmelton).
29+
30+
# Credit
31+
32+
Portions of this Code of Conduct are based on the [example anti-harassment policy](http://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy) from the Geek Feminism wiki, created by the Ada Initiative and other volunteers, under a Creative Commons Zero license.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Data Platform Community
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# dbatools-library

actions-build.ps1

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# Go compile the DLLs
2+
Set-Location ./dbatools-library
3+
Remove-Item .\project\dbatools\obj -Recurse -ErrorAction Ignore
4+
Remove-Item .\project\dbatools.Tests\lib -Recurse -ErrorAction Ignore
5+
Remove-Item .\project\dbatools.Tests\obj -Recurse -ErrorAction Ignore
6+
Get-ChildItem -Recurse lib | Remove-Item -Recurse -ErrorAction Ignore
7+
Get-ChildItem -Recurse temp | Remove-Item -Recurse -ErrorAction Ignore
8+
Push-Location ".\project"
9+
dotnet clean
10+
dotnet publish --configuration release --framework net6.0 --self-contained | Out-String -OutVariable build
11+
dotnet publish --configuration release --framework net462 --self-contained | Out-String -OutVariable build
12+
dotnet test --framework net462 --verbosity normal | Out-String -OutVariable test
13+
dotnet test --framework net6.0 --verbosity normal | Out-String -OutVariable test
14+
Pop-Location
15+
16+
Get-ChildItem .\lib -Recurse -Include *.pdb | Remove-Item -Force
17+
Get-ChildItem .\lib -Recurse -Include *.xml | Remove-Item -Force
18+
Get-ChildItem .\lib\net462\ -Exclude *dbatools*, publish | Remove-Item -Force -Recurse
19+
Get-ChildItem .\lib\ -Include runtimes -Recurse | Remove-Item -Force -Recurse
20+
Get-ChildItem .\lib\*\dbatools.deps.json -Recurse | Remove-Item -Force
21+
22+
if ($IsLinux -or $IsMacOs) {
23+
$tempdir = "/tmp"
24+
} else {
25+
$tempdir = "C:\temp"
26+
}
27+
28+
$null = mkdir $tempdir -Force -ErrorAction Ignore
29+
$null = mkdir ./temp/dacfull -Force -ErrorAction Ignore
30+
$null = mkdir ./lib/sqlpackage/windows -Force -ErrorAction Ignore
31+
$null = mkdir ./lib/sqlpackage/mac -ErrorAction Ignore
32+
$null = mkdir ./temp/xe -ErrorAction Ignore
33+
$null = mkdir ./lib/third-party
34+
$null = mkdir ./lib/third-party/XESmartTarget
35+
$null = mkdir ./lib/third-party/bogus
36+
$null = mkdir ./lib/third-party/LumenWorks
37+
$null = mkdir ./lib/third-party/LumenWorks/netstandard2.0
38+
$null = mkdir ./lib/third-party/LumenWorks/net461
39+
$null = mkdir ./lib/third-party/bogus/netstandard2.0
40+
$null = mkdir ./lib/third-party/bogus/net40
41+
$null = mkdir ./temp/bogus
42+
$null = mkdir ./lib/net6.0/publish/win
43+
44+
$ProgressPreference = "SilentlyContinue"
45+
46+
47+
Invoke-WebRequest -Uri https://aka.ms/sqlpackage-linux -OutFile .\temp\sqlpackage-linux.zip
48+
Invoke-WebRequest -Uri https://aka.ms/sqlpackage-macos -OutFile .\temp\sqlpackage-macos.zip
49+
Invoke-WebRequest -Uri https://aka.ms/dacfx-msi -OutFile .\temp\DacFramework.msi
50+
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/Bogus -OutFile .\temp\bogus.zip
51+
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/LumenWorksCsvReader -OutFile .\temp\LumenWorksCsvReader.zip
52+
Invoke-WebRequest -Uri https://github.com/spaghettidba/XESmartTarget/releases/download/v1.4.9/XESmartTarget_x64.msi -OutFile .\temp\XESmartTarget_x64.msi
53+
54+
$ProgressPreference = "Continue"
55+
56+
Expand-Archive -Path .\temp\sqlpackage-linux.zip -DestinationPath .\temp\linux
57+
Expand-Archive -Path .\temp\sqlpackage-macos.zip -DestinationPath .\temp\macos
58+
Expand-Archive -Path .\temp\LumenWorksCsvReader.zip -DestinationPath .\temp\LumenWorksCsvReader
59+
Expand-Archive -Path .\temp\bogus.zip -DestinationPath .\temp\bogus
60+
61+
msiexec /a $(Resolve-Path .\temp\DacFramework.msi) /qb TARGETDIR=$(Resolve-Path .\temp\dacfull)
62+
Start-Sleep 3
63+
msiexec /a $(Resolve-Path .\temp\XESmartTarget_x64.msi) /qb TARGETDIR=$(Resolve-Path .\temp\xe)
64+
Start-Sleep 3
65+
66+
$mac = 'libclrjit.dylib', 'libcoreclr.dylib', 'libhostfxr.dylib', 'libhostpolicy.dylib', 'libSystem.Native.dylib', 'libSystem.Security.Cryptography.Native.Apple.dylib', 'Microsoft.Data.Tools.Schema.Sql.dll', 'Microsoft.Data.Tools.Utilities.dll', 'Microsoft.IdentityModel.JsonWebTokens.dll', 'Microsoft.Win32.Primitives.dll', 'sqlpackage', 'sqlpackage.deps.json', 'sqlpackage.dll', 'sqlpackage.pdb', 'sqlpackage.runtimeconfig.json', 'sqlpackage.xml', 'System.Collections.Concurrent.dll', 'System.Collections.dll', 'System.Console.dll', 'System.Diagnostics.FileVersionInfo.dll', 'System.Diagnostics.StackTrace.dll', 'System.Diagnostics.TextWriterTraceListener.dll', 'System.Diagnostics.TraceSource.dll', 'System.Linq.dll', 'System.Memory.dll', 'System.Net.Http.Json.dll', 'System.Private.CoreLib.dll', 'System.Private.Xml.dll', 'System.Reflection.Metadata.dll', 'System.Runtime.dll', 'System.Runtime.Serialization.Json.dll', 'System.Security.Cryptography.Algorithms.dll', 'System.Security.Cryptography.Primitives.dll', 'System.Text.Json.dll', 'System.Threading.dll', 'System.Threading.Thread.dll', 'System.Xml.ReaderWriter.dll'
67+
$linux = 'libclrjit.so', 'libcoreclr.so', 'libcoreclrtraceptprovider.so', 'libhostfxr.so', 'libhostpolicy.so', 'libSystem.Native.so', 'libSystem.Security.Cryptography.Native.OpenSsl.so', 'Microsoft.Win32.Primitives.dll', 'System.Collections.Concurrent.dll', 'System.Collections.dll', 'System.Console.dll', 'System.Diagnostics.FileVersionInfo.dll', 'System.Diagnostics.StackTrace.dll', 'System.Diagnostics.TextWriterTraceListener.dll', 'System.Diagnostics.TraceSource.dll', 'System.Linq.dll', 'System.Memory.dll', 'System.Net.Http.Json.dll', 'System.Private.CoreLib.dll', 'System.Private.Xml.dll', 'System.Reflection.Metadata.dll', 'System.Runtime.dll', 'System.Runtime.Serialization.Json.dll', 'System.Security.Cryptography.Algorithms.dll', 'System.Text.Json.dll', 'System.Threading.dll', 'System.Threading.Thread.dll', 'System.Xml.ReaderWriter.dll', 'sqlpackage', 'sqlpackage.dll', 'sqlpackage.deps.json', 'sqlpackage.runtimeconfig.json'
68+
$winfull = 'Microsoft.Data.SqlClient.dll', 'Microsoft.Data.SqlClient.SNI.x64.dll', 'Microsoft.Data.SqlClient.SNI.x86.dll', 'System.Threading.Tasks.Dataflow.dll', 'Azure.Core.dll', 'Azure.Identity.dll', 'Microsoft.Build.dll', 'Microsoft.Build.Framework.dll', 'Microsoft.Data.Tools.Schema.Sql.dll', 'Microsoft.Data.Tools.Utilities.dll', 'Microsoft.SqlServer.Dac.dll', 'Microsoft.SqlServer.Dac.Extensions.dll', 'Microsoft.SqlServer.TransactSql.ScriptDom.dll', 'Microsoft.SqlServer.Types.dll', 'System.Memory.Data.dll', 'System.Resources.Extensions.dll', 'System.Security.SecureString.dll', 'sqlpackage.exe', 'sqlpackage.dll', 'libhostfxr.so', 'libhostpolicy.so', 'sqlpackage.runtimeconfig.json', 'sqlpackage.deps.json', 'hostpolicy.dll', 'hostfxr.dll', 'sqlpackage.dll'
69+
70+
Get-ChildItem "./temp/dacfull/" -Recurse | Where-Object Name -in $winfull | Copy-Item -Destination lib/sqlpackage/windows
71+
Get-ChildItem "./temp/xe/*.dll" -Recurse | Copy-Item -Destination lib/third-party/XESmartTarget
72+
Get-ChildItem "./temp/bogus/*/netstandard2.0/bogus.dll" -Recurse | Copy-Item -Destination lib/third-party/bogus/netstandard2.0/bogus.dll
73+
Get-ChildItem "./temp/bogus/*/net40/bogus.dll" -Recurse | Copy-Item -Destination lib/third-party/bogus/net40/bogus.dll
74+
75+
Copy-Item .\temp\LumenWorksCsvReader\lib\net461\LumenWorks.Framework.IO.dll -Destination ./lib/third-party/LumenWorks/net461/LumenWorks.Framework.IO.dll
76+
77+
Copy-Item .\temp\LumenWorksCsvReader\lib\netstandard2.0\LumenWorks.Framework.IO.dll -Destination ./lib/third-party/LumenWorks/netstandard2.0/LumenWorks.Framework.IO.dll
78+
79+
Get-ChildItem lib/net462/dbatools.dll | Remove-Item -Force
80+
Get-ChildItem lib/net6.0/dbatools.dll | Remove-Item -Force
81+
Get-ChildItem lib/net462/dbatools.dll.config | Remove-Item -Force
82+
Get-ChildItem lib/net6.0/dbatools.dll.config | Remove-Item -Force
83+
84+
Get-ChildItem ./temp/linux | Where-Object Name -in $linux | Copy-Item -Destination lib/net6.0
85+
Get-ChildItem ./temp/macos | Where-Object Name -in $mac | Copy-Item -Destination lib/sqlpackage/mac/
86+
87+
Register-PackageSource -provider NuGet -name nugetRepository -Location https://www.nuget.org/api/v2 -Trusted -ErrorAction Ignore
88+
89+
$parms = @{
90+
Provider = "Nuget"
91+
Destination = "$tempdir\nuget"
92+
Source = "nugetRepository"
93+
Scope = "CurrentUser"
94+
Force = $true
95+
SkipDependencies = $true
96+
}
97+
98+
$parms.Name = "System.Resources.Extensions"
99+
$parms.RequiredVersion = "6.0.0.0"
100+
Install-Package @parms
101+
102+
$parms.Name = "Microsoft.SqlServer.DacFx"
103+
$parms.RequiredVersion = "161.6319.0-preview"
104+
Install-Package @parms
105+
106+
$parms.Name = "Microsoft.SqlServer.SqlManagementObjects"
107+
$parms.RequiredVersion = "170.7.0-preview"
108+
Install-Package @parms
109+
110+
$parms.Name = "Microsoft.Data.SqlClient"
111+
$parms.RequiredVersion = "5.0.1"
112+
Install-Package @parms
113+
114+
$parms.Name = "Microsoft.Data.SqlClient.SNI.runtime"
115+
$parms.RequiredVersion = "5.0.1"
116+
Install-Package @parms
117+
118+
$parms.Name = "Microsoft.Identity.Client"
119+
$parms.RequiredVersion = "4.45.0"
120+
Install-Package @parms
121+
122+
$parms.Name = "Azure.Identity"
123+
$parms.RequiredVersion = "1.6.0"
124+
Install-Package @parms
125+
126+
Copy-Item "$tempdir\nuget\Microsoft.Data.SqlClient.5.0.1\runtimes\unix\lib\netcoreapp3.1\Microsoft.Data.SqlClient.dll" -Destination lib/net6.0/publish
127+
Copy-Item "$tempdir\nuget\Microsoft.Identity.Client.4.45.0\lib\net461\Microsoft.Identity.Client.dll" -Destination lib/net462/publish/
128+
Copy-Item "$tempdir\nuget\Microsoft.Data.SqlClient.5.0.1\runtimes\win\lib\netcoreapp3.1\Microsoft.Data.SqlClient.dll" -Destination lib/net6.0/publish/win
129+
Copy-Item "$tempdir\nuget\Microsoft.Identity.Client.4.45.0\lib\netcoreapp2.1\Microsoft.Identity.Client.dll" -Destination lib/net6.0/publish/win
130+
Copy-Item "$tempdir\nuget\Microsoft.Data.SqlClient.SNI.runtime.5.0.1\runtimes\win-x64\native\Microsoft.Data.SqlClient.SNI.dll" -Destination lib/net6.0/publish/win
131+
Copy-Item "$tempdir\nuget\Microsoft.Data.SqlClient.SNI.runtime.5.0.1\runtimes\win-x64\native\Microsoft.Data.SqlClient.SNI.dll" -Destination lib/net462/publish/
132+
133+
Copy-Item "replication/Microsoft.SqlServer.Rmo.dll" -Destination lib/net462/publish/
134+
Copy-Item "replication/Microsoft.SqlServer.Replication.dll" -Destination lib/net462/publish/
135+
Copy-Item "replication/Microsoft.SqlServer.Rmo.dll" -Destination lib/net6.0/publish/
136+
Copy-Item "replication/Microsoft.SqlServer.Replication.dll" -Destination lib/net6.0/publish/
137+
138+
Move-Item -Path lib/net6.0/publish/* -Destination lib/net6.0/
139+
Move-Item -Path lib/net462/publish/* -Destination lib/net462/
140+
141+
Remove-Item -Path lib/net6.0/publish -Recurse -ErrorAction Ignore
142+
Remove-Item -Path lib/net462/publish -Recurse -ErrorAction Ignore
143+
144+
Remove-Item -Path lib/*.xml -Recurse -ErrorAction Ignore
145+
Remove-Item -Path lib/*.pdb -Recurse -ErrorAction Ignore
146+
147+
Get-ChildItem -Directory -Path .\lib\net462 | Where-Object Name -notin 'x64', 'x86', 'win', 'mac', 'macos' | Remove-Item -Recurse
148+
Get-ChildItem -Directory -Path .\lib\net6.0 | Where-Object Name -notin 'x64', 'x86', 'win', 'mac', 'macos' | Remove-Item -Recurse
149+
150+
Import-Module ./dbatools-library/dbatools-library.psd1 -Force

0 commit comments

Comments
 (0)