The SqlCodeReview module provides a powershell one-liner for a developer to request a code review for production deployment.
$objectsToReview = @(
"AdventureWorks.Person.Person",
"WorldWideImporters.InMemory.Insert50ThousandVehicleLocations"
)
Request-DBCodeReview $objectsToReviewThe above script will launch a chrome session to your repo where you can submit a pull request comparing the differences between the two named objects in you prod and qa environments.
Provide a comma-separated list of 3-part-qualified database objects. These objects will be written to disk from the prod and qa environments defined in your default config.
- The developer must have
VIEW DEFINITIONpermissions in both the source and target environments.- It is assumed that the developer has elevated permissions in a source/target environment and is not permitted to deploy objects to a target/production environment
- The developer must have permission to push to a GitHub or VSTS repository where a pull request will take place
- Branch-level security may be applied so long as the developer has permission to create a new branch at the remote as well as push to a shared base branch
If you just can't be bothered, invoke install.ps1 in the root of this repo from an Administrator PS session.
STANDARD DISCLAIMER: If you're in the habit of executing code you found on the internet in an elevated shell without reading it, you're gonna have a bad time...
Otherwise, you'll need to...
- install
SqlServerfrom the Powershell gallery- note in the above link, you will need to forcibly remove the
SQLPSmodule if it is installed. a reboot may be required
- note in the above link, you will need to forcibly remove the
- clone or copy the
SqlCreateTablemodule to a discoverable path (enumerated inenv:PsModulePath.Split(";")) - clone or copy this module to a discoverable path
- add
Import-Module SqlCodeReviewto your profile if you please- prepare yourself for increased shell load times
- Validate the required config files (2 are required)
- a
jsonfile that identifies directory location & format style of the git repo you'll be using - a
csvfile describing server addresses for different environments by database in your infrastructure
- a
The solution is developed for SQL Server 2016/2017 and requires the `SqlServer` PS Module, which is incompatible with the earlier `SQLPS` module. Glhf resolving these conflicts ¯\_(ツ)_/¯