Skip to content

New Function Get-DbaDbObjectTrigger & Improve Find-DbaTrigger#5570

Merged
potatoqualitee merged 15 commits intoprereleasefrom
Triggers
May 23, 2019
Merged

New Function Get-DbaDbObjectTrigger & Improve Find-DbaTrigger#5570
potatoqualitee merged 15 commits intoprereleasefrom
Triggers

Conversation

@ClaudioESSilva
Copy link
Contributor

Type of Change

  • Bug fix (non-breaking change, fixes #)
  • New feature (non-breaking change, adds functionality)
  • Breaking change (effects multiple commands or functionality)
  • Ran manual Pester test and has passed (`.\tests\manual.pester.ps1)
  • Adding code coverage to existing functionality
  • Pester test is included
  • If new file reference added for test, has is been added to github.com/sqlcollaborative/appveyor-lab ?
  • Nunit test is included
  • Documentation
  • Build system

Purpose

new function Get-DbaDbObjectTrigger that search for triggers on object level. This means Tables and Views

Also improved the Find-DbaTrigger to include triggers on views.

Motivation: https://twitter.com/TheRockstarDBA/status/1129059763373912065?s=01

Approach

Commands to test

Get-DbaDbObjectTrigger
Find-DbaTrigger

Screenshots

Learning

Drop database instead of triggers.
Fix table/view name inside triggers
process {
foreach ($Instance in $SqlInstance) {
$InputObject += Get-DbaDbTable -SqlInstance $SqlInstance -SqlCredential $SqlCredential -Database $Database -ExcludeDatabase $ExcludeDatabase
$InputObject += Get-DbaDbView -SqlInstance $SqlInstance -SqlCredential $SqlCredential -Database $Database -ExcludeDatabase $ExcludeDatabase
Copy link
Member

Choose a reason for hiding this comment

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

With the number of tables and views that can be in data warehouse systems I think we should offer up the ability to only retrieve one or the other. Get-DbaDbObjectTrigger ...-Type Table or -Type View ?

Copy link
Contributor

Choose a reason for hiding this comment

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

An alternative would be to accept piping from Get-DbaDbTable or Get-DbaDbView

Copy link
Contributor

Choose a reason for hiding this comment

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

An alternative would be to accept piping from Get-DbaDbTable or Get-DbaDbView

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks Shawn & Patrick. Will definitely add the -Type identical to Find-DbaTrigger and see the piping from Get-*Table/View.

function Get-DbaDbObjectTrigger {
<#
.SYNOPSIS
Get all existing database triggers on one or more SQL instances.
Copy link
Member

Choose a reason for hiding this comment

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

Need to update references to database triggers to be object-level triggers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks Shawn! Will update tonight.

@ClaudioESSilva
Copy link
Contributor Author

@potatoqualitee @wsmelton @sqllensman
Seems it is stuck on appveyor/branch.
Regarding the failed ones there, I haven't change anything.
What should I do? Will you force the merge?

@potatoqualitee
Copy link
Member

mmm you will need to recreate your branches, it's super messed up - 1283 files modified. Please copy your changed files to a diff directory, get latest prerelease, rebranch then try again. Going to close, please feel free to reopen this PR if you can fix it, otherwise, I will wait for the updated PR.

@wsmelton
Copy link
Member

There is only 3 changes for the PR.

@wsmelton wsmelton reopened this May 22, 2019
@potatoqualitee
Copy link
Member

my last commit must have worked but not showed up, thanks for rechecking 💯 will merge when tests pass

@wsmelton
Copy link
Member

The branch failure is n/a as the PR test was successful. Since it is reopened it will have to run both again.

@potatoqualitee
Copy link
Member

thanks so much for the new function! 🙇 gonna do a mass function comparison towards the end and add all new commands at once to psd1/psm1

@potatoqualitee potatoqualitee merged commit 5a0ea6c into prerelease May 23, 2019
@potatoqualitee potatoqualitee deleted the Triggers branch May 23, 2019 01:38
@potatoqualitee
Copy link
Member

boooom 💣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants