-
-
Notifications
You must be signed in to change notification settings - Fork 808
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into shawn/syncpwd
- Loading branch information
Showing
330 changed files
with
5,003 additions
and
913 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ jobs: | |
- name: Install and cache PowerShell modules | ||
uses: potatoqualitee/[email protected] | ||
with: | ||
modules-to-cache: dbatools.library:2023.5.5 | ||
modules-to-cache: dbatools.library:2023.9.21 | ||
|
||
- name: Download dbatools from Gallery | ||
run: | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
name: Run Replication Tests | ||
on: [push] | ||
defaults: | ||
run: | ||
shell: pwsh | ||
jobs: | ||
repl-tests-part1: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install and cache PowerShell modules | ||
uses: potatoqualitee/[email protected] | ||
with: | ||
modules-to-cache: dbatools.library:2023.5.5 | ||
|
||
- name: Set encryption values | ||
run: | | ||
Import-Module ./dbatools.psd1 -Force | ||
Set-DbatoolsConfig -FullName sql.connection.trustcert -Value $true -Register | ||
Set-DbatoolsConfig -FullName sql.connection.encrypt -Value Optional -Register | ||
Get-DbatoolsConfigValue -FullName sql.connection.encrypt | Write-Warning | ||
- name: Setup docker images | ||
run: | | ||
# create a shared network | ||
docker network create localnet | ||
# Expose engine and endpoint then setup a shared path for migrations | ||
docker run -p 1433:1433 --volume shared:/shared:z --name mssql1 --hostname mssql1 --network localnet -d dbatools/sqlinstance | ||
# Expose second engine and endpoint on different port | ||
docker run -p 14333:1433 --volume shared:/shared:z --name mssql2 --hostname mssql2 --network localnet -d dbatools/sqlinstance2 | ||
- name: Add hostname to hosts file | ||
run: | | ||
echo "127.0.0.1 mssql1 mssql2" | sudo tee -a /etc/hosts | ||
- name: 👥 Clone appveyor repo | ||
working-directory: /tmp | ||
run: | | ||
gh repo clone dataplat/appveyor-lab | ||
- name: Setup Replication | ||
run: | | ||
Import-Module ./dbatools.psd1 -Force | ||
# need some folders for our repl stuff | ||
docker exec mssql1 mkdir /shared/data /shared/repldata /var/opt/mssql/ReplData | ||
- name: Run replication tests part 1 | ||
run: | | ||
Import-Module ./dbatools.psd1 -Force | ||
$null = Invoke-Pester ./tests/gh-actions-repl-1.ps1 -Output Detailed -PassThru -Verbose | ||
repl-tests-part2: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install and cache PowerShell modules | ||
uses: potatoqualitee/[email protected] | ||
with: | ||
modules-to-cache: dbatools.library:2023.5.5 | ||
|
||
- name: Set encryption values | ||
run: | | ||
Import-Module ./dbatools.psd1 -Force | ||
Set-DbatoolsConfig -FullName sql.connection.trustcert -Value $true -Register | ||
Set-DbatoolsConfig -FullName sql.connection.encrypt -Value Optional -Register | ||
Get-DbatoolsConfigValue -FullName sql.connection.encrypt | Write-Warning | ||
- name: Setup docker images | ||
run: | | ||
# create a shared network | ||
docker network create localnet | ||
# Expose engine and endpoint then setup a shared path for migrations | ||
docker run -p 1433:1433 --volume shared:/shared:z --name mssql1 --hostname mssql1 --network localnet -d dbatools/sqlinstance | ||
# Expose second engine and endpoint on different port | ||
docker run -p 14333:1433 --volume shared:/shared:z --name mssql2 --hostname mssql2 --network localnet -d dbatools/sqlinstance2 | ||
- name: Add hostname to hosts file | ||
run: | | ||
echo "127.0.0.1 mssql1 mssql2" | sudo tee -a /etc/hosts | ||
- name: 👥 Clone appveyor repo | ||
working-directory: /tmp | ||
run: | | ||
gh repo clone dataplat/appveyor-lab | ||
- name: Setup Replication | ||
run: | | ||
Import-Module ./dbatools.psd1 -Force | ||
# need some folders for our repl stuff | ||
docker exec mssql1 mkdir /shared/data /shared/repldata /var/opt/mssql/ReplData | ||
- name: Run replication tests part 2 | ||
run: | | ||
Import-Module ./dbatools.psd1 -Force | ||
$null = Invoke-Pester ./tests/gh-actions-repl-2.ps1 -Output Detailed -PassThru -Verbose | ||
repl-tests-part3: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install and cache PowerShell modules | ||
uses: potatoqualitee/[email protected] | ||
with: | ||
modules-to-cache: dbatools.library:2023.5.5 | ||
|
||
- name: Set encryption values | ||
run: | | ||
Import-Module ./dbatools.psd1 -Force | ||
Set-DbatoolsConfig -FullName sql.connection.trustcert -Value $true -Register | ||
Set-DbatoolsConfig -FullName sql.connection.encrypt -Value Optional -Register | ||
Get-DbatoolsConfigValue -FullName sql.connection.encrypt | Write-Warning | ||
- name: Setup docker images | ||
run: | | ||
# create a shared network | ||
docker network create localnet | ||
# Expose engine and endpoint then setup a shared path for migrations | ||
docker run -p 1433:1433 --volume shared:/shared:z --name mssql1 --hostname mssql1 --network localnet -d dbatools/sqlinstance | ||
# Expose second engine and endpoint on different port | ||
docker run -p 14333:1433 --volume shared:/shared:z --name mssql2 --hostname mssql2 --network localnet -d dbatools/sqlinstance2 | ||
- name: Add hostname to hosts file | ||
run: | | ||
echo "127.0.0.1 mssql1 mssql2" | sudo tee -a /etc/hosts | ||
- name: 👥 Clone appveyor repo | ||
working-directory: /tmp | ||
run: | | ||
gh repo clone dataplat/appveyor-lab | ||
- name: Setup Replication | ||
run: | | ||
Import-Module ./dbatools.psd1 -Force | ||
# need some folders for our repl stuff | ||
docker exec mssql1 mkdir /shared/data /shared/repldata /var/opt/mssql/ReplData | ||
- name: Run replication tests part 3 | ||
run: | | ||
Import-Module ./dbatools.psd1 -Force | ||
Invoke-Pester ./tests/gh-actions-repl-3.ps1 -Output Detailed -PassThru -Verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ jobs: | |
- name: Install and cache PowerShell modules | ||
uses: potatoqualitee/[email protected] | ||
with: | ||
modules-to-cache: dbatools.library:2023.5.5 | ||
modules-to-cache: dbatools.library:2023.9.21 | ||
|
||
- name: Set encryption values | ||
run: | | ||
|
@@ -71,7 +71,7 @@ jobs: | |
uses: potatoqualitee/[email protected] | ||
with: | ||
shell: powershell, pwsh | ||
modules-to-cache: dbatools.library:2023.5.5 | ||
modules-to-cache: dbatools.library:2023.9.21 | ||
|
||
- name: Install SQL Server localdb | ||
uses: potatoqualitee/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ jobs: | |
- name: Install and cache PowerShell modules | ||
uses: potatoqualitee/[email protected] | ||
with: | ||
modules-to-cache: dbatools.library:2023.5.5 | ||
modules-to-cache: dbatools.library:2023.9.21 | ||
|
||
- name: Perform the import | ||
shell: pwsh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# dbatools 💜 dbatools | ||
|
||
############################## | ||
# create docker environment | ||
############################## | ||
# create a shared network | ||
docker network create localnet | ||
|
||
# Expose engines and setup shared path for migrations | ||
docker run -p 2500:1433 --volume shared:/shared:z --name mssql1 --hostname mssql1 --network localnet -d dbatools/sqlinstance | ||
docker run -p 2600:1433 --volume shared:/shared:z --name mssql2 --hostname mssql2 --network localnet -d dbatools/sqlinstance2 | ||
|
||
# create the repl folder | ||
docker exec mssql1 mkdir /var/opt/mssql/ReplData | ||
|
||
# also need these folders for setting up replication | ||
docker exec mssql1 mkdir /shared/data /shared/repldata | ||
|
||
############################## | ||
|
||
# import out version of the module | ||
cd C:\GitHub\DMM-GitHub\dbatools | ||
Import-Module .\dbatools.psd1 | ||
|
||
# lets save the password for connecting to containers because I'm lazy | ||
$securePassword = ('dbatools.IO' | ConvertTo-SecureString -AsPlainText -Force) | ||
$credential = New-Object System.Management.Automation.PSCredential('sqladmin', $securePassword) | ||
|
||
$PSDefaultParameterValues = @{ | ||
"*:SqlCredential" = $credential | ||
"*:DestinationCredential" = $credential | ||
"*:DestinationSqlCredential" = $credential | ||
"*:SourceSqlCredential" = $credential | ||
"*:PublisherSqlCredential" = $credential | ||
} | ||
|
||
# what do we have so far | ||
Get-DbaReplServer -SqlInstance mssql1 | ||
Get-DbaReplDistributor -SqlInstance mssql1 | ||
Get-DbaReplPublisher -SqlInstance mssql1 | ||
|
||
# enable distribution | ||
Enable-DbaReplDistributor -SqlInstance mssql1 | ||
|
||
# enable publishing | ||
Enable-DbaReplPublishing -SqlInstance mssql1 | ||
|
||
# create a transactional publication using splat format | ||
$pub = @{ | ||
SqlInstance = 'mssql1' | ||
Database = 'pubs' | ||
PublicationName = 'testPub' | ||
Type = 'Transactional' | ||
} | ||
New-DbaReplPublication @pub | ||
|
||
# add an article to the publication | ||
$article = @{ | ||
SqlInstance = 'mssql1' | ||
Database = 'pubs' | ||
PublicationName = 'testpub' | ||
Name = 'authors' | ||
} | ||
Add-DbaReplArticle @article | ||
|
||
# create a pubs database on mssql2 to replicate to | ||
New-DbaDatabase -SqlInstance mssql2 -Name pubs | ||
|
||
# if you don't the New-DbaReplSubscription command will create the database for you | ||
|
||
# add a subscription to the publication | ||
$sub = @{ | ||
SqlInstance = 'mssql2' | ||
Database = 'pubs' | ||
PublicationDatabase = 'pubs' | ||
PublisherSqlInstance = 'mssql1' | ||
PublicationName = 'testpub' | ||
Type = 'Push' | ||
SubscriptionSqlCredential = $credential | ||
|
||
} | ||
New-DbaReplSubscription @sub | ||
|
||
# creates the snapshot job with a daily schedule at 8am - is that expected? good default? | ||
# should adding a subscription kick off snapshot? should that be an param -StartSnapshotNow -- yes | ||
# create that without a schedule by default maybe a param for a schedule | ||
# | ||
|
||
# stats on the subscription - in the distribution database | ||
# could we make a command to get stats | ||
|
||
|
||
|
||
|
||
|
||
## when adding an article - we need the options | ||
# - action if name is in use 'drop existing object and create new' | ||
# copy nonclusterd indexes | ||
# nuno |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.