Skip to content

Commit

Permalink
Merge pull request dataplat#292 from sqlcollaborative/development
Browse files Browse the repository at this point in the history
october release!
  • Loading branch information
Chrissy LeMaire authored Oct 29, 2016
2 parents a391741 + aff3388 commit 077a064
Show file tree
Hide file tree
Showing 48 changed files with 4,566 additions and 3,321 deletions.
84 changes: 84 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Contributing.md
This is the contribute.md of our project. Great to have you here! Here are a few ways you can help make this project better.

## Team members

We've got over 20 Major Contributors to the dbatools project! Check us out on [the Team page](https://dbatools.io/team) and on [LinkedIn](https://www.linkedin.com/vsearch/p?f_CC=15211157).

There area number of ways to become Major Contributor which includes getting your mug & link to your blog/twitter on dbatools.io and adding dbatools to your experience on LinkedIn and your resume! Major Contributors of dbatools have done at least one of the following:

* Contributed one approved command
* Added over 100 lines of code
* Setup Jenkins for continuous integration
* Became a designated tester
* Added lots of/fixed documentation
* Fixed some super hard bugs

We aim to be **inclusive**. If you'd like to become a Major Contributor, just let us know your intent and we'll help get you there.

## Learn & Hangout

Want to join the team or just come hang out? You can find us here:

* Slack: #dbatools on the [SQL Server Community Slack](https://dbatools.io/slack)
* Trello: [come see what we're working on and what we need help with](https://dbatools.io/trello)
* Blog: [our blog](https://dbatools.io/blog)
* Twitter: [we tweet, too](https://dbatools.io/twitter)
* YouTube: [and we've got some videos](https://dbatools.io/youtube)
* LinkedIn: [our "company" page](https://www.linkedin.com/vsearch/p?f_CC=15211157)

## Adding new commands and features

* **This is how we like people to add new commands**
<br><br>New command proposals must be approved by Chrissy LeMaire, the original creator of dbatools. This ensures the proposed command aligns with the intended spirit of the toolset. You can message Chrissy on [Slack](https://dbatools.io/slack) (@ctrlb) or post your proposal on the [Trello](https://dbatools.io/trello) Ideas list.<br><br>Check out the Ideas list on our [Trello board](https://dbatools.io/trello) to get a feel for the types of commands we like. Also take a look at [Microsoft's SqlServer Trello board](https://sqlps.io/vote) to see the commands that are more appropriate for the official SQL Server PowerShell module (and vote while you're there!)

* **Here are some specifics on the coding style we prefer**
<br><br>This will be available on the Wiki shortly. Until then, please look inside the .ps1 files or the [dbatools-templates](https://github.com/sqlcollaborative/dbatools-templates) repository.

* **This is how you send your pull request**
<br><br>This information will also be available on the Wiki as as step-by-step. The most important thing to note is that all pull requests must be made into the **development** branch. We only push to the master branch once a month.

* **You should include the following documentation**
<br><br>Please look at the available [dbatools-templates](https://github.com/sqlcollaborative/dbatools-templates) to see the kind of documentation we're looking for (basically everything that PowerShell allows - SYNOPSIS, DESCRIPTION, PARAMETERS, NOTES, EXAMPLES and so on.

* **You should include the following tests**
<br><br>Please include at least 3 Examples in your command's documentation section. We use these to perform our tests. You can also look at [this awesome Pull Request comment](https://github.com/sqlcollaborative/dbatools/pull/254#issuecomment-253355070) that has step-by-step tests and expected outcomes for our QA team.

# Bug triage

This sections explains how bug triaging is done for our project.

* You can help report bugs by filing them on our [GitHub Issues page](https://github.com/sqlcollaborative/dbatools/issues)
* You can look through the existing bugs on our [GitHub Issues page](https://github.com/sqlcollaborative/dbatools/issues)
* You can help us diagnose and fix existing bugs by asking and providing answers for the following:
* Is the bug reproducible as explained?
* Is it reproducible in other environments (for instance, on different browsers or devices)?
* Are the steps to reproduce the bug clear? If not, can you describe how you might reproduce it?
* What tags should the bug have?
* Is this bug something you have run into? Would you appreciate it being looked into faster?


# Beta testing

Early releases require heavy testing and how they can help with specially across different versions, editions and environments.

* For our project you will be able to find the roadmap and features that require
testing on the wiki (but it's not there yet).

# Translations

* You can help us translate our project by submitting a PR with the translation. We hope to add localization to the project by version 1.0

# Documentation

Code needs explanation, and sometimes those who know the code well have trouble explaining it to someone just getting into it.

* Help us with documentation by modifying the command's Help section and submitting a Pull Request. You can also message @ctrlb on Slack with modifications for the [documentation on the dbatools website](https://dbatools.io/commands).

# Community
This section includes ideas on how non-developers can help with the project.

* You can help us answer questions our users have on [Slack](https://dbatools.io/slack)
* You can help design the commands so that they solve your problems on [Trello](https://dbatools.io/trello)
* You can help write blog posts about dbatools
* You can help create videos and we'll put them on our [YouTube channel](https://dbatools.io/youtube)
75 changes: 44 additions & 31 deletions dbatools.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
RootModule = 'dbatools.psm1'

# Version number of this module.
ModuleVersion = '0.8.5.56'
ModuleVersion = '0.8.6'

# ID used to uniquely identify this module
GUID = '9d139310-ce45-41ce-8e8b-d76335aa1789'
Expand Down Expand Up @@ -96,7 +96,7 @@
'Import-SqlSpConfigure',
'Export-SqlSpConfigure',
'Get-SqlMaxMemory',
'Get-DetachedDBInfo',
'Get-DbaDetachedDatabaseInfo',
'Restore-SqlBackupFromDirectory',
'Test-SqlConnection',
'Import-CsvToSql',
Expand Down Expand Up @@ -144,7 +144,20 @@
'Test-DbaConnectionAuthScheme',
'Test-DbaServerName',
'Repair-DbaServerName',
'Stop-DbaProcess'
'Stop-DbaProcess',
'Get-DbaProcess',
'Get-DbaAvailabilityGroup',
'Copy-SqlMaintenancePlan',
'Test-DbaMaxDop',
'Copy-SqlSsisCatalog',
'Get-DbaLastGoodCheckDb',
'Test-DbaDatabaseBestPractice',
'Remove-DbaBackup',
'Find-DbaOrphanedFile',
'Test-DbaFullRecoveryModel',
'Test-DbaMaxDop',
'Get-DbaRunningJob',
'Set-DbaMaxDop'
)

# Cmdlets to export from this module
Expand All @@ -171,34 +184,34 @@
FileList = ''

PrivateData = @{
# PSData is module packaging and gallery metadata embedded in PrivateData
# It's for rebuilding PowerShellGet (and PoshCode) NuGet-style packages
# We had to do this because it's the only place we're allowed to extend the manifest
# https://connect.microsoft.com/PowerShell/feedback/details/421837
PSData = @{
# The primary categorization of this module (from the TechNet Gallery tech tree).
Category = "Databases"

# Keyword tags to help users find this module via navigations and search.
Tags = @('sqlserver','migrations','sql','dba','databases')

# The web address of an icon which can be used in galleries to represent this module
IconUri = "https://dbatools.io/logo.png"

# The web address of this module's project or support homepage.
ProjectUri = "https://dbatools.io"

# The web address of this module's license. Points to a page that's embeddable and linkable.
LicenseUri = "http://www.gnu.org/licenses/gpl-3.0.en.html"

# Release notes for this particular version of the module
# ReleaseNotes = False

# If true, the LicenseUrl points to an end-user license (not just a source license) which requires the user agreement before use.
# RequireLicenseAcceptance = ""

# Indicates this is a pre-release/testing version of the module.
IsPrerelease = 'True'
# PSData is module packaging and gallery metadata embedded in PrivateData
# It's for rebuilding PowerShellGet (and PoshCode) NuGet-style packages
# We had to do this because it's the only place we're allowed to extend the manifest
# https://connect.microsoft.com/PowerShell/feedback/details/421837
PSData = @{
# The primary categorization of this module (from the TechNet Gallery tech tree).
Category = "Databases"
# Keyword tags to help users find this module via navigations and search.
Tags = @('sqlserver', 'migrations', 'sql', 'dba', 'databases')
# The web address of an icon which can be used in galleries to represent this module
IconUri = "https://dbatools.io/logo.png"
# The web address of this module's project or support homepage.
ProjectUri = "https://dbatools.io"
# The web address of this module's license. Points to a page that's embeddable and linkable.
LicenseUri = "http://www.gnu.org/licenses/gpl-3.0.en.html"
# Release notes for this particular version of the module
# ReleaseNotes = False
# If true, the LicenseUrl points to an end-user license (not just a source license) which requires the user agreement before use.
# RequireLicenseAcceptance = ""
# Indicates this is a pre-release/testing version of the module.
IsPrerelease = 'True'
}
}
}
17 changes: 9 additions & 8 deletions dbatools.psm1
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# All supporting functions have been moved to Functions\SharedFunctions.ps1
# If you're looking through the code, you pretty much have to work with two files
# at any one time. The function you're working on, and SharedFunctions.ps1
# All internal functions privately avaialble within the toolset
foreach ($function in (Get-ChildItem "$PSScriptRoot\internal\*.ps1")) { . $function }

# All exported functions
foreach ($function in (Get-ChildItem "$PSScriptRoot\functions\*.ps1")) { . $function }

# Not supporting the provider path at this time
Expand All @@ -19,11 +20,11 @@ Set-Alias -Name Get-DiskSpace -Value Get-DbaDiskSpace
# Set-StrictMode -Version Latest

# In order to keep backwards compatability, these are loaded here instead of in the manifest.
$null = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Management.Sdk.Sfc")
$null = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Dmf")
$null = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlEnum")
$null = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Management.RegisteredServers")
$null = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.ConnectionInfo")
$null = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement")
$null = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Management.XEvent")
$null = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Dmf")
$null = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Management.Sdk.Sfc")
$null = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Management.RegisteredServers")
$null = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.ConnectionInfo")
$null = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement")
$null = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Management.IntegrationServices")
6 changes: 3 additions & 3 deletions functions/Copy-SqlDatabase.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Databases will be migrated from sqlserver2014a to sqlcluster using the detach/co
.EXAMPLE
Copy-SqlDatabase -Source sqlserver2014a -Destination sqlcluster -Exclude Northwind, pubs -IncludeSupportDbs -Force -BackupRestore \\fileshare\sql\migration
Copy-SqlDatabase -Source sqlserver2014a -Destination sqlcluster -Exclude Northwind, pubs -IncludeSupportDbs -Force -BackupRestore -NetworkShare \\fileshare\sql\migration
Migrates all user databases except for Northwind and pubs by using backup/restore (copy-only). Backup files are stored in \\fileshare\sql\migration. If the database exists on the destination, it will be dropped prior to attach.
Expand Down Expand Up @@ -159,7 +159,7 @@ It also includes the support databases (ReportServer, ReportServerTempDb, distri
[object]$DbPipeline
)

DynamicParam { if ($source) { return Get-ParamSqlDatabases -SqlServer $source -SqlCredential $SourceSqlCredential } }
DynamicParam { if ($source) { return Get-ParamSqlDatabases -SqlServer $source -SqlCredential $SourceSqlCredential -NoSystem $true} }

BEGIN
{
Expand Down Expand Up @@ -832,7 +832,7 @@ It also includes the support databases (ReportServer, ReportServerTempDb, distri

if ($sourceserver.versionMajor -eq 8)
{
$sql = "select DB_NAME (dbid) as dbname, name, filename, CASE WHEN groupid = 1 THEN 'ROWS' WHEN groupid = 0 THEN 'LOG' END as filetype from sysaltfiles"
$sql = "select DB_NAME (dbid) as dbname, name, filename, CASE WHEN groupid = 0 THEN 'LOG' ELSE 'ROWS' END as filetype from sysaltfiles"
}
else
{
Expand Down
10 changes: 6 additions & 4 deletions functions/Copy-SqlLogin.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ Limitations: Does not support Application Roles yet
Write-Output "Force was specified. Attempting to drop $username on $destination"
try
{
$destserver.EnumProcesses() | Where { $_.Login -eq $username } | ForEach-Object { $destserver.KillProcess($_.spid) }

$owneddbs = $destserver.Databases | Where { $_.Owner -eq $username }

Expand All @@ -197,7 +196,10 @@ Limitations: Does not support Application Roles yet
$ownedjob.Alter()
}

$login.drop()
$login.Disable()
$destserver.EnumProcesses() | Where-Object { $_.Login -eq $username } | ForEach-Object { $destserver.KillProcess($_.spid) }
$login.Drop()

Write-Output "Successfully dropped $username on $destination"
}
catch
Expand Down Expand Up @@ -282,7 +284,7 @@ Limitations: Does not support Application Roles yet
$sid = "0x"; $sourcelogin.sid | % { $sid += ("{0:X}" -f $_).PadLeft(2, "0") }
$sqlfailsafe = "CREATE LOGIN [$username] WITH PASSWORD = $hashedpass HASHED, SID = $sid,
DEFAULT_DATABASE = [$defaultdb], CHECK_POLICY = $checkpolicy,
CHECK_EXPIRATION = $checkexpiration, DEFAULT_LANGUAGE = [$language]"
CHECK_EXPIRATION = $checkexpiration, DEFAULT_LANGUAGE = [$($sourcelogin.Language)]"

$null = $destserver.ConnectionContext.ExecuteNonQuery($sqlfailsafe)
$destlogin = $destserver.logins[$username]
Expand Down Expand Up @@ -449,4 +451,4 @@ Limitations: Does not support Application Roles yet
Write-Output "Total elapsed time: $totaltime"
}
}
}
}
Loading

0 comments on commit 077a064

Please sign in to comment.