Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add replication support to dbatools! #8958

Merged
merged 229 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
229 commits
Select commit Hold shift + click to select a range
d6f902a
repl testing
jpomfret Feb 16, 2023
b18ea53
tests
jpomfret Feb 16, 2023
b778e4b
functions
jpomfret Feb 16, 2023
11f5682
psd1\psm1 merging
jpomfret Feb 16, 2023
dd981d6
update wf
jpomfret Feb 16, 2023
39914f8
Swap order of pub dist
jpomfret Feb 16, 2023
d22510f
rename
jpomfret Feb 16, 2023
dc96c0e
debug
jpomfret Feb 16, 2023
b4ed664
add name to get-dbareplpublication
jpomfret Feb 17, 2023
87001ee
add support for merge and snapshot
jpomfret Feb 17, 2023
7263dfd
change publicationtype --> type
jpomfret Feb 23, 2023
9bf954c
change pubtype --> type
jpomfret Feb 23, 2023
3492bea
working
jpomfret Mar 31, 2023
a574a76
tests
jpomfret Apr 6, 2023
b24c290
verbose
jpomfret Apr 6, 2023
40bba9b
test
jpomfret Apr 6, 2023
0781876
writewarning
jpomfret Apr 6, 2023
3c19467
no null
jpomfret Apr 6, 2023
5351d1e
verbose
jpomfret Apr 6, 2023
660304a
use hostname
jpomfret Apr 6, 2023
30a1bfd
right name
jpomfret Apr 6, 2023
e2ff595
remove hard coded localhost
jpomfret Apr 6, 2023
ed4e19f
fix issue causing test failure
jpomfret Apr 13, 2023
fc4088e
Added TODO why articles not appear in specific condition
ClaudioESSilva Apr 24, 2023
6384490
Fix property name & Change validation order
ClaudioESSilva Apr 24, 2023
ea1500f
Add PublicationName property
ClaudioESSilva Apr 24, 2023
7c61e5c
Change parameters name
ClaudioESSilva Apr 24, 2023
fbae7cb
So the local tests works
ClaudioESSilva May 4, 2023
c57ed81
add tests
jpomfret May 16, 2023
58d2213
add snapshot support
jpomfret May 16, 2023
54a5e84
add todo
jpomfret May 16, 2023
f3ddd68
bug fuix
jpomfret May 16, 2023
0cc9aee
function stub
jpomfret May 16, 2023
6e1f2b6
testing notes
jpomfret May 16, 2023
bf95f38
psm1\psd1 merging
jpomfret May 16, 2023
b0164fe
repl psd\psm changes
jpomfret May 16, 2023
0793003
change module to cache for library
jpomfret May 16, 2023
9493830
testy tests
jpomfret May 16, 2023
be4943a
psf --> just message
jpomfret May 16, 2023
87e9e7e
remove SupportsShouldProcess on get
jpomfret May 18, 2023
52038ec
updates
jpomfret May 26, 2023
89094f9
new tests
jpomfret May 26, 2023
8300876
stuff
jpomfret May 26, 2023
6cf3455
new command New-DbaReplCreationScriptOptions
jpomfret May 30, 2023
7461786
remove comment
jpomfret May 30, 2023
df229cf
fixes for remove article
jpomfret May 31, 2023
c3ca117
RefreshSubscriptions not a thing for merge
jpomfret Jun 1, 2023
715da5b
add url
jpomfret Jun 1, 2023
eff3db3
remove write-message and fix bug with publication output
jpomfret Jun 1, 2023
5c26828
enable piping and tidy up
jpomfret Jun 1, 2023
c3fa99a
more tests
jpomfret Jun 1, 2023
8eb4d6d
test fix
jpomfret Jun 1, 2023
97a395b
add logging
jpomfret Jun 1, 2023
69aedd0
fixed now?
jpomfret Jun 1, 2023
572a038
tests
jpomfret Jun 1, 2023
dc1af86
add more Add-DbaReplArticle tests
jpomfret Jun 2, 2023
150cf81
add examples, tidy up
jpomfret Jun 2, 2023
f840f89
remove a bug with piping
jpomfret Jun 2, 2023
4a7a43e
spelling word added
jpomfret Jun 2, 2023
aab5a3c
typos
jpomfret Jun 2, 2023
d46362b
more examples, cleaned up help
jpomfret Jun 2, 2023
d394731
tidy help and examples
jpomfret Jun 2, 2023
abf06fe
tidy help
jpomfret Jun 2, 2023
4ac31a0
add check for publishing and log reader job not for merge
jpomfret Jun 2, 2023
49466d4
added tests
jpomfret Jun 2, 2023
e3bed4d
remove hard coded default for snapshot
jpomfret Jun 2, 2023
5123bc7
add get-replsubscription
jpomfret Jun 2, 2023
2d7bd48
spacing and year
jpomfret Jun 2, 2023
534b784
tests
jpomfret Jun 2, 2023
2290aa1
add note about ReplicationDatabases property
jpomfret Jun 5, 2023
c77d0e6
change to allow piping
jpomfret Jun 5, 2023
ba418b6
change publicationname --> name
jpomfret Jun 5, 2023
199f6da
sort out piping
jpomfret Jun 6, 2023
d187ed8
fix piping issue
jpomfret Jun 6, 2023
ea5db60
tests
jpomfret Jun 6, 2023
162a7c0
repl testing
jpomfret Feb 16, 2023
f3827f8
tests
jpomfret Feb 16, 2023
2db7fa4
functions
jpomfret Feb 16, 2023
dd55165
psd1\psm1 merging
jpomfret Feb 16, 2023
1d18209
update wf
jpomfret Feb 16, 2023
6bccfa0
Swap order of pub dist
jpomfret Feb 16, 2023
39c92c7
rename
jpomfret Feb 16, 2023
23b9d41
debug
jpomfret Feb 16, 2023
867e9e2
add name to get-dbareplpublication
jpomfret Feb 17, 2023
a8bd41a
add support for merge and snapshot
jpomfret Feb 17, 2023
d821c84
change publicationtype --> type
jpomfret Feb 23, 2023
a989f1a
change pubtype --> type
jpomfret Feb 23, 2023
7c185c8
working
jpomfret Mar 31, 2023
4c97b4d
tests
jpomfret Apr 6, 2023
5414007
verbose
jpomfret Apr 6, 2023
1d6abd2
test
jpomfret Apr 6, 2023
67ddcd6
writewarning
jpomfret Apr 6, 2023
8302e90
no null
jpomfret Apr 6, 2023
d5a01b0
verbose
jpomfret Apr 6, 2023
56cc426
use hostname
jpomfret Apr 6, 2023
595f55a
right name
jpomfret Apr 6, 2023
836fe4d
remove hard coded localhost
jpomfret Apr 6, 2023
641b99c
fix issue causing test failure
jpomfret Apr 13, 2023
0315ea9
Added TODO why articles not appear in specific condition
ClaudioESSilva Apr 24, 2023
0f352c9
Fix property name & Change validation order
ClaudioESSilva Apr 24, 2023
1a07c2c
Add PublicationName property
ClaudioESSilva Apr 24, 2023
6096a6d
Change parameters name
ClaudioESSilva Apr 24, 2023
714c923
So the local tests works
ClaudioESSilva May 4, 2023
ab159ee
add tests
jpomfret May 16, 2023
e92629b
add snapshot support
jpomfret May 16, 2023
36e2b12
add todo
jpomfret May 16, 2023
f3256f8
bug fuix
jpomfret May 16, 2023
3c39b99
function stub
jpomfret May 16, 2023
b3c83c7
testing notes
jpomfret May 16, 2023
f41482e
psm1\psd1 merging
jpomfret May 16, 2023
0971580
repl psd\psm changes
jpomfret May 16, 2023
d033262
change module to cache for library
jpomfret May 16, 2023
e728f98
testy tests
jpomfret May 16, 2023
4905cd0
psf --> just message
jpomfret May 16, 2023
b74083d
remove SupportsShouldProcess on get
jpomfret May 18, 2023
2f65401
updates
jpomfret May 26, 2023
4052ea7
new tests
jpomfret May 26, 2023
657fad0
stuff
jpomfret May 26, 2023
ac484f8
new command New-DbaReplCreationScriptOptions
jpomfret May 30, 2023
3467134
remove comment
jpomfret May 30, 2023
bab88ef
fixes for remove article
jpomfret May 31, 2023
276f0e9
RefreshSubscriptions not a thing for merge
jpomfret Jun 1, 2023
72bd797
add url
jpomfret Jun 1, 2023
79809d3
remove write-message and fix bug with publication output
jpomfret Jun 1, 2023
86cd0f6
enable piping and tidy up
jpomfret Jun 1, 2023
e8ce7ec
more tests
jpomfret Jun 1, 2023
0d6af7d
test fix
jpomfret Jun 1, 2023
72beb49
add logging
jpomfret Jun 1, 2023
b78d274
fixed now?
jpomfret Jun 1, 2023
b393e20
tests
jpomfret Jun 1, 2023
d6793d8
add more Add-DbaReplArticle tests
jpomfret Jun 2, 2023
8c62889
add examples, tidy up
jpomfret Jun 2, 2023
fb934e0
remove a bug with piping
jpomfret Jun 2, 2023
1b2ddc3
spelling word added
jpomfret Jun 2, 2023
608fc9e
typos
jpomfret Jun 2, 2023
3a78f7f
more examples, cleaned up help
jpomfret Jun 2, 2023
245aecb
tidy help and examples
jpomfret Jun 2, 2023
675fb91
tidy help
jpomfret Jun 2, 2023
ac58040
add check for publishing and log reader job not for merge
jpomfret Jun 2, 2023
8093aaf
added tests
jpomfret Jun 2, 2023
675383c
remove hard coded default for snapshot
jpomfret Jun 2, 2023
4af3054
add get-replsubscription
jpomfret Jun 2, 2023
84f4fca
spacing and year
jpomfret Jun 2, 2023
c9f7fa3
tests
jpomfret Jun 2, 2023
52f0163
add note about ReplicationDatabases property
jpomfret Jun 5, 2023
2ce1c17
change to allow piping
jpomfret Jun 5, 2023
e90fcfa
change publicationname --> name
jpomfret Jun 5, 2023
5403577
sort out piping
jpomfret Jun 6, 2023
1d72564
fix piping issue
jpomfret Jun 6, 2023
243b1a1
tests
jpomfret Jun 6, 2023
a93d17c
Merge branch 'dmm' of https://github.com/Data-Masterminds/dbatools in…
jpomfret Jun 6, 2023
69c2558
formatting
jpomfret Jun 8, 2023
61404d7
rename test files
jpomfret Jun 8, 2023
5a83896
add unit tests
jpomfret Jun 8, 2023
5a5edfb
change to psobject with a check
jpomfret Jun 8, 2023
afabc0a
change tests to Tests
jpomfret Jun 8, 2023
09e6517
fixing some tests
jpomfret Jun 8, 2023
e39637e
variables and scopes oh my
jpomfret Jun 8, 2023
3fcf91b
ghaction test failure
jpomfret Jun 8, 2023
e20eab1
too many dlls
jpomfret Jun 8, 2023
3da4ac4
remove unneeded test setup files
jpomfret Jun 18, 2023
373cd37
moved to be issue #8995
jpomfret Jun 18, 2023
340455a
Apply suggestions from code review
jpomfret Jun 18, 2023
6d9944f
Merge branch 'dmm' of https://github.com/Data-Masterminds/dbatools in…
jpomfret Jun 18, 2023
c35829e
Update public/Disable-DbaReplPublishing.ps1
jpomfret Jul 4, 2023
d446664
responding to review comments. thanks!
jpomfret Jul 4, 2023
6fcdae8
fix for pull sub
jpomfret Jul 4, 2023
8f6e6ae
Update public/Add-DbaReplArticle.ps1
jpomfret Jul 6, 2023
ae3b02d
Merge branch 'dmm' of https://github.com/Data-Masterminds/dbatools in…
jpomfret Jul 6, 2023
7cbd2db
improve whatif messaging
jpomfret Jul 6, 2023
103b334
move filter like where to top
jpomfret Jul 6, 2023
f93ee70
split try catch into more sections
jpomfret Jul 6, 2023
fba4040
remove try\ catch for get
jpomfret Jul 6, 2023
30bc26b
working on reviwe
jpomfret Jul 6, 2023
ac8d20b
review fixes
jpomfret Jul 6, 2023
b1ae839
fix review, make whatif more verbose
jpomfret Jul 6, 2023
79bcaed
changes from review
jpomfret Jul 6, 2023
885ec50
review fixes
jpomfret Jul 6, 2023
4e88ff9
change serverconnection standard message
jpomfret Jul 6, 2023
44be61e
add props to mocked objects
jpomfret Jul 6, 2023
068981b
format doc
jpomfret Jul 6, 2023
681a137
improve confirm messaging for disable commands
jpomfret Jul 6, 2023
e90cf4a
bug when there aren't subscriptiosns
jpomfret Jul 7, 2023
0e0b21c
add examples
jpomfret Jul 7, 2023
9b09acd
should we use the sqlinstance object so piping works
jpomfret Jul 7, 2023
1d907d5
wip remove-replsub
jpomfret Jul 7, 2023
0f3c4a6
improve help for new sub
jpomfret Jul 12, 2023
5242d09
Update public/Get-DbaReplSubscription.ps1
jpomfret Jul 12, 2023
54bd532
add some params for filterign
jpomfret Jul 12, 2023
5fb6e58
capital letters
jpomfret Jul 12, 2023
d6ec1ab
couple of fixes for subscriptions
jpomfret Jul 14, 2023
4f8f224
swap sqlinstance around to publisher for subscription commands
jpomfret Jul 21, 2023
635e4cd
formatter
jpomfret Jul 28, 2023
85930c3
remove dupe param name
jpomfret Jul 31, 2023
5857426
add tests for subscriptions
jpomfret Jul 31, 2023
14863f0
note about pull subs
jpomfret Aug 1, 2023
8d00ef7
fix test
jpomfret Aug 1, 2023
1995e72
add schema to Get articles
jpomfret Aug 9, 2023
59c2228
schema missed a file
jpomfret Aug 9, 2023
7ac55a5
create sub schema if it doesn't exist
jpomfret Aug 9, 2023
966f56f
param name incorrect
jpomfret Aug 9, 2023
946ab83
set output to null when creating new schema
jpomfret Aug 9, 2023
3c5c254
not dbo schema
jpomfret Aug 9, 2023
2eae1d5
conditions are hard
jpomfret Aug 9, 2023
2051a6b
better error handling
jpomfret Aug 9, 2023
b21cea5
always stop job (it'll restart)
jpomfret Aug 9, 2023
6acc361
change to high impact
jpomfret Aug 9, 2023
cb0c1d9
don't output killing
jpomfret Aug 9, 2023
9d8f2f6
ensure enableexception is passed through
jpomfret Aug 21, 2023
b577aee
but not for jobs.. this is just best effort
jpomfret Aug 21, 2023
d27969c
remove one enableexception option
jpomfret Aug 21, 2023
38c4320
remove force add tags
jpomfret Aug 21, 2023
25e97cf
break repl tests into two files
jpomfret Sep 21, 2023
0b3b832
call the new file names would be nice
jpomfret Sep 21, 2023
9d815e0
update comment
jpomfret Sep 21, 2023
76c8661
lets have 2 nicely named jobs
jpomfret Sep 21, 2023
1523fb6
yaml!
jpomfret Sep 21, 2023
abb472d
couple of bug fixes
jpomfret Sep 21, 2023
bc8285c
subscriber wrong
jpomfret Sep 21, 2023
8f12cf8
skip New-DbaReplSubscription and see if it works
jpomfret Sep 21, 2023
0dadcd1
split into 3 repl gh jobs
jpomfret Sep 21, 2023
cf1512e
what is going on
jpomfret Sep 21, 2023
82244c4
skip sub tests for now
jpomfret Sep 22, 2023
c7dbc4c
skip tests
jpomfret Sep 22, 2023
45183e6
different skips
jpomfret Sep 22, 2023
60dfd57
how about get
jpomfret Sep 22, 2023
8bffe4f
comment some out
jpomfret Sep 22, 2023
6e332ec
comment everything?
jpomfret Sep 22, 2023
ef68ec7
test fix
jpomfret Sep 22, 2023
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
152 changes: 152 additions & 0 deletions .github/workflows/integration-tests-repl.yml
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/psmodulecache@v5.2
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/psmodulecache@v5.2
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/psmodulecache@v5.2
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
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"Kokkinos",
"Kravtsov",
"Mikey",
"mssql",
"nchar",
"niphlod",
"ntext",
Expand Down
99 changes: 99 additions & 0 deletions ReplicationDemo.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# dbatools 💜 dbatools
wsmelton marked this conversation as resolved.
Show resolved Hide resolved

##############################
# 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
42 changes: 35 additions & 7 deletions dbatools.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
'Export-DbaLogin',
'Export-DbaPfDataCollectorSetTemplate',
'Export-DbaRegServer',
'Export-DbaRepServerSetting',
'Export-DbaReplServerSetting',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think we are safe to move these to the section below, keep them all organized together.

'Export-DbaScript',
'Export-DbaServerRole',
'Export-DbaSpConfigure',
Expand Down Expand Up @@ -350,9 +350,10 @@
'Get-DbaRegServer',
'Get-DbaRegServerGroup',
'Get-DbaRegServerStore',
'Get-DbaRepDistributor',
'Get-DbaRepPublication',
'Get-DbaRepServer',
'Get-DbaReplDistributor',
'Get-DbaReplPublication',
'Get-DbaReplPublisher',
'Get-DbaReplServer',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think we are safe to move these to the section below, keep them all organized together.

'Get-DbaResourceGovernor',
'Get-DbaRgClassifierFunction',
'Get-DbaRgResourcePool',
Expand Down Expand Up @@ -693,7 +694,7 @@
'Test-DbaOptimizeForAdHoc',
'Test-DbaPath',
'Test-DbaPowerPlan',
'Test-DbaRepLatency',
'Test-DbaReplLatency',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are safe to move this to the section below.

'Test-DbaSpn',
'Test-DbaTempDbConfig',
'Test-DbaWindowsLogin',
Expand Down Expand Up @@ -728,7 +729,23 @@
'New-DbaLinkedServerLogin',
'Remove-DbaLinkedServerLogin',
'Remove-DbaCredential',
'Remove-DbaAgentProxy'
'Remove-DbaAgentProxy',

# NEW REPLICATION STUFF
'Disable-DbaReplDistributor',
'Enable-DbaReplDistributor',
'Disable-DbaReplPublishing',
'Enable-DbaReplPublishing',
'New-DbaReplPublication',
'Get-DbaReplArticle',
'Get-DbaReplArticleColumn',
'Add-DbaReplArticle',
'Remove-DbaReplArticle',
'Remove-DbaReplPublication',
'New-DbaReplSubscription',
'Remove-DbaReplSubscription',
'New-DbaReplCreationScriptOptions',
'Get-DbaReplSubscription'
)

# Cmdlets to export from this module
Expand All @@ -751,9 +768,20 @@
'Write-DbaDataTable',
'Get-DbaDbModule',
'Get-DbaBuildReference',
'Copy-DbaSysDbUserObject'
'Copy-DbaSysDbUserObject',

# replication aliases - these existed before the repl overhaul in 2.0+
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also reference the PR number here?

'Get-DbaRepServer',
'Export-DbaRepServerSetting',
'Get-DbaRepDistributor',
'Test-DbaRepLatency',
'Get-DbaRepDistributor',
'Get-DbaRepPublication',
'Get-DbaRepServer'

)


# List of all modules packaged with this module
ModuleList = @()

Expand Down
22 changes: 17 additions & 5 deletions dbatools.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,18 @@ $forever = @{
foreach ($_ in $forever.GetEnumerator()) {
Set-Alias -Name $_.Key -Value $_.Value
}

# Replication Aliases
$replAliases = @{
'Get-DbaRepServer' = 'Get-DbaReplServer'
'Export-DbaRepServerSetting' = 'Export-DbaReplServerSetting'
'Get-DbaRepDistributor' = 'Get-DbaReplDistributor'
'Test-DbaRepLatency' = 'Test-DbaReplLatency'
'Get-DbaRepPublication' = 'Get-DbaReplPublication'
}
foreach ($_ in $replAliases.GetEnumerator()) {
Set-Alias -Name $_.Key -Value $_.Value
}
#endregion Aliases

# apparently this is no longer required? :O
Expand Down Expand Up @@ -846,7 +858,7 @@ if ($PSVersionTable.PSVersion.Major -lt 5) {
)
$script:noncoresmo = @(
# SMO issues
'Get-DbaRepDistributor',
'Get-DbaReplDistributor',
'Copy-DbaPolicyManagement',
'Copy-DbaDataCollector',
'Get-DbaPbmCategory',
Expand All @@ -855,10 +867,10 @@ if ($PSVersionTable.PSVersion.Major -lt 5) {
'Get-DbaPbmObjectSet',
'Get-DbaPbmPolicy',
'Get-DbaPbmStore',
'Get-DbaRepPublication',
'Test-DbaRepLatency',
'Export-DbaRepServerSetting',
'Get-DbaRepServer'
'Get-DbaReplPublication',
'Test-DbaReplLatency',
'Export-DbaReplServerSetting',
'Get-DbaReplServer'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these still non-core SMO if you are running the commands through an Ubuntu container?

)
$script:windowsonly = @(
# filesystem (\\ related),
Expand Down
Loading
Loading