Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
potatoqualitee committed Oct 21, 2022
0 parents commit 95d7e71
Show file tree
Hide file tree
Showing 118 changed files with 14,530 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: [potatoqualitee, Stuart-Moore, sanderstad, jpomfret]
40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
dbatools-startmigration-transcript.txt
dbatools-exceptions.txt
*TempPoint*
*.pssproj

# ignore the settings folder and files for VSCode
.vscode/*
*.psproj
dbatools.psprojs

# ignore the settings folder and files for Visual Studio
.vs/*

# VIM backup files
*~

# msbuild log file and structured binary log file
msbuild.log
msbuild.binlog

# Local constant file
tests/constants.local.ps1

# For those that want to use Docker images for testing
# Integration with Docker requires the docker compose file to exist within the project folder
docker-compose.yml

### NCrunch ###
# NCrunch
*.ncrunch*
_NCrunch_*
*.crunch.xml
*.ncrunchsolution*
nCrunchTemp_*

debug.log
bin/
temp/
runtimes/
lib/
7 changes: 7 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"MD024": false,
"MD022": false,
"MD032": false,
"MD013": false,
"MD001": true
}
32 changes: 32 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Code of Conduct

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.

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.

Examples of encouraged behavior that contributes to a positive environment include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for everyone at the event
- Showing empathy towards other participants

Unacceptable behavior includes:

- 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
- Trolling, insulting or derogatory comments, personal or political attacks
- Deliberate intimidation
- Harassment of any kind, even in a joking or ironic manner
- Other conduct which could reasonably be considered inappropriate in a professional setting
- Sexually explicit or violent material
- Or any other kinds of harassment
- 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.

Use your best judgement. If it will possibly make others uncomfortable, do not post it.

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).

# Credit

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.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Data Platform Community

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# dbatools-library
150 changes: 150 additions & 0 deletions actions-build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# Go compile the DLLs
Set-Location ./dbatools-library
Remove-Item .\project\dbatools\obj -Recurse -ErrorAction Ignore
Remove-Item .\project\dbatools.Tests\lib -Recurse -ErrorAction Ignore
Remove-Item .\project\dbatools.Tests\obj -Recurse -ErrorAction Ignore
Get-ChildItem -Recurse lib | Remove-Item -Recurse -ErrorAction Ignore
Get-ChildItem -Recurse temp | Remove-Item -Recurse -ErrorAction Ignore
Push-Location ".\project"
dotnet clean
dotnet publish --configuration release --framework net6.0 --self-contained | Out-String -OutVariable build
dotnet publish --configuration release --framework net462 --self-contained | Out-String -OutVariable build
dotnet test --framework net462 --verbosity normal | Out-String -OutVariable test
dotnet test --framework net6.0 --verbosity normal | Out-String -OutVariable test
Pop-Location

Get-ChildItem .\lib -Recurse -Include *.pdb | Remove-Item -Force
Get-ChildItem .\lib -Recurse -Include *.xml | Remove-Item -Force
Get-ChildItem .\lib\net462\ -Exclude *dbatools*, publish | Remove-Item -Force -Recurse
Get-ChildItem .\lib\ -Include runtimes -Recurse | Remove-Item -Force -Recurse
Get-ChildItem .\lib\*\dbatools.deps.json -Recurse | Remove-Item -Force

if ($IsLinux -or $IsMacOs) {
$tempdir = "/tmp"
} else {
$tempdir = "C:\temp"
}

$null = mkdir $tempdir -Force -ErrorAction Ignore
$null = mkdir ./temp/dacfull -Force -ErrorAction Ignore
$null = mkdir ./lib/sqlpackage/windows -Force -ErrorAction Ignore
$null = mkdir ./lib/sqlpackage/mac -ErrorAction Ignore
$null = mkdir ./temp/xe -ErrorAction Ignore
$null = mkdir ./lib/third-party
$null = mkdir ./lib/third-party/XESmartTarget
$null = mkdir ./lib/third-party/bogus
$null = mkdir ./lib/third-party/LumenWorks
$null = mkdir ./lib/third-party/LumenWorks/netstandard2.0
$null = mkdir ./lib/third-party/LumenWorks/net461
$null = mkdir ./lib/third-party/bogus/netstandard2.0
$null = mkdir ./lib/third-party/bogus/net40
$null = mkdir ./temp/bogus
$null = mkdir ./lib/net6.0/publish/win

$ProgressPreference = "SilentlyContinue"


Invoke-WebRequest -Uri https://aka.ms/sqlpackage-linux -OutFile .\temp\sqlpackage-linux.zip
Invoke-WebRequest -Uri https://aka.ms/sqlpackage-macos -OutFile .\temp\sqlpackage-macos.zip
Invoke-WebRequest -Uri https://aka.ms/dacfx-msi -OutFile .\temp\DacFramework.msi
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/Bogus -OutFile .\temp\bogus.zip
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/LumenWorksCsvReader -OutFile .\temp\LumenWorksCsvReader.zip
Invoke-WebRequest -Uri https://github.com/spaghettidba/XESmartTarget/releases/download/v1.4.9/XESmartTarget_x64.msi -OutFile .\temp\XESmartTarget_x64.msi

$ProgressPreference = "Continue"

Expand-Archive -Path .\temp\sqlpackage-linux.zip -DestinationPath .\temp\linux
Expand-Archive -Path .\temp\sqlpackage-macos.zip -DestinationPath .\temp\macos
Expand-Archive -Path .\temp\LumenWorksCsvReader.zip -DestinationPath .\temp\LumenWorksCsvReader
Expand-Archive -Path .\temp\bogus.zip -DestinationPath .\temp\bogus

msiexec /a $(Resolve-Path .\temp\DacFramework.msi) /qb TARGETDIR=$(Resolve-Path .\temp\dacfull)
Start-Sleep 3
msiexec /a $(Resolve-Path .\temp\XESmartTarget_x64.msi) /qb TARGETDIR=$(Resolve-Path .\temp\xe)
Start-Sleep 3

$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'
$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'
$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'

Get-ChildItem "./temp/dacfull/" -Recurse | Where-Object Name -in $winfull | Copy-Item -Destination lib/sqlpackage/windows
Get-ChildItem "./temp/xe/*.dll" -Recurse | Copy-Item -Destination lib/third-party/XESmartTarget
Get-ChildItem "./temp/bogus/*/netstandard2.0/bogus.dll" -Recurse | Copy-Item -Destination lib/third-party/bogus/netstandard2.0/bogus.dll
Get-ChildItem "./temp/bogus/*/net40/bogus.dll" -Recurse | Copy-Item -Destination lib/third-party/bogus/net40/bogus.dll

Copy-Item .\temp\LumenWorksCsvReader\lib\net461\LumenWorks.Framework.IO.dll -Destination ./lib/third-party/LumenWorks/net461/LumenWorks.Framework.IO.dll

Copy-Item .\temp\LumenWorksCsvReader\lib\netstandard2.0\LumenWorks.Framework.IO.dll -Destination ./lib/third-party/LumenWorks/netstandard2.0/LumenWorks.Framework.IO.dll

Get-ChildItem lib/net462/dbatools.dll | Remove-Item -Force
Get-ChildItem lib/net6.0/dbatools.dll | Remove-Item -Force
Get-ChildItem lib/net462/dbatools.dll.config | Remove-Item -Force
Get-ChildItem lib/net6.0/dbatools.dll.config | Remove-Item -Force

Get-ChildItem ./temp/linux | Where-Object Name -in $linux | Copy-Item -Destination lib/net6.0
Get-ChildItem ./temp/macos | Where-Object Name -in $mac | Copy-Item -Destination lib/sqlpackage/mac/

Register-PackageSource -provider NuGet -name nugetRepository -Location https://www.nuget.org/api/v2 -Trusted -ErrorAction Ignore

$parms = @{
Provider = "Nuget"
Destination = "$tempdir\nuget"
Source = "nugetRepository"
Scope = "CurrentUser"
Force = $true
SkipDependencies = $true
}

$parms.Name = "System.Resources.Extensions"
$parms.RequiredVersion = "6.0.0.0"
Install-Package @parms

$parms.Name = "Microsoft.SqlServer.DacFx"
$parms.RequiredVersion = "161.6319.0-preview"
Install-Package @parms

$parms.Name = "Microsoft.SqlServer.SqlManagementObjects"
$parms.RequiredVersion = "170.7.0-preview"
Install-Package @parms

$parms.Name = "Microsoft.Data.SqlClient"
$parms.RequiredVersion = "5.0.1"
Install-Package @parms

$parms.Name = "Microsoft.Data.SqlClient.SNI.runtime"
$parms.RequiredVersion = "5.0.1"
Install-Package @parms

$parms.Name = "Microsoft.Identity.Client"
$parms.RequiredVersion = "4.45.0"
Install-Package @parms

$parms.Name = "Azure.Identity"
$parms.RequiredVersion = "1.6.0"
Install-Package @parms

Copy-Item "$tempdir\nuget\Microsoft.Data.SqlClient.5.0.1\runtimes\unix\lib\netcoreapp3.1\Microsoft.Data.SqlClient.dll" -Destination lib/net6.0/publish
Copy-Item "$tempdir\nuget\Microsoft.Identity.Client.4.45.0\lib\net461\Microsoft.Identity.Client.dll" -Destination lib/net462/publish/
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
Copy-Item "$tempdir\nuget\Microsoft.Identity.Client.4.45.0\lib\netcoreapp2.1\Microsoft.Identity.Client.dll" -Destination lib/net6.0/publish/win
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
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/

Copy-Item "replication/Microsoft.SqlServer.Rmo.dll" -Destination lib/net462/publish/
Copy-Item "replication/Microsoft.SqlServer.Replication.dll" -Destination lib/net462/publish/
Copy-Item "replication/Microsoft.SqlServer.Rmo.dll" -Destination lib/net6.0/publish/
Copy-Item "replication/Microsoft.SqlServer.Replication.dll" -Destination lib/net6.0/publish/

Move-Item -Path lib/net6.0/publish/* -Destination lib/net6.0/
Move-Item -Path lib/net462/publish/* -Destination lib/net462/

Remove-Item -Path lib/net6.0/publish -Recurse -ErrorAction Ignore
Remove-Item -Path lib/net462/publish -Recurse -ErrorAction Ignore

Remove-Item -Path lib/*.xml -Recurse -ErrorAction Ignore
Remove-Item -Path lib/*.pdb -Recurse -ErrorAction Ignore

Get-ChildItem -Directory -Path .\lib\net462 | Where-Object Name -notin 'x64', 'x86', 'win', 'mac', 'macos' | Remove-Item -Recurse
Get-ChildItem -Directory -Path .\lib\net6.0 | Where-Object Name -notin 'x64', 'x86', 'win', 'mac', 'macos' | Remove-Item -Recurse

Import-Module ./dbatools-library/dbatools-library.psd1 -Force
Loading

0 comments on commit 95d7e71

Please sign in to comment.