The PowerShell SQL Client module replaces the SQL Server utilities SQLCMD with native PowerShell commands.
This module can be installed from PsGallery.
Install-Module -Name PsSmo -Scope CurrentUser
Alternatively it can be build and installed from source.
- Install the development dependencies
- Download or clone it from GitHub
- Run the installation task:
Invoke-Build Install
TODO
Execute SQLCMD scripts like those created by DacFX.
Command | Description | Status |
---|---|---|
Connect-Instance | Create a new database connection. | ☑ |
Disconnect-Instance | Close connection | ☑ |
Invoke-Command | Execute SQLCMD scripts | ☐ |
⮱ Batch support | Support GO statements |
☑ |
⮱ File support | Script source from file | ☑ |
⮱ Variable support | Support variables like $(variable) |
☑ |
⮱ :setvar support | Support :setvar |
☑ |
⮱ SQLCMD command support | Support SQLCMD commans like :on error |
☐ |
Uninstall-Schema | Remove a database schema recursively | ☐ |
See the changelog file.
- This is a Portable Module based on PowerShell Standard and .NET Standard.
- VSCode is recommended as IDE. VSCode Tasks are configured.
- Build automation is based on InvokeBuild
- Test automation is based on Pester
- Commands are named based on Approved Verbs for PowerShell Commands
- This project uses git-flow.
- This project uses keep a changelog.
- This project uses PsBuildTasks.
The build scripts require InvokeBuild. If it is not installed, install it with the command Install-Module InvokeBuild -Scope CurrentUser
.
You can build the module using the VS Code build task or with the command Invoke-Build Build
.
The tests scripts are based on Pester. If it is not installed, install it with the command Install-Module -Name Pester -Force -SkipPublisherCheck
. Some tests require a SQL Server. The test creates a SQL Server in a Docker container. If needed, install Docker. The container are created using PSDocker, which can be installed using Install-Module PSDocker -Scope CurrentUser
.
For local testing use the VSCode test tasks or execute the test scripts directly or with Invoke-Pester
.
The InvokeBuild test tasks are for CI and do not generate console output.
- Create a release branch using git-flow.
- Update the version number in the module manifest.
- Extend the changelog in this readme.
- If you want to create a pre-release.
- Push the release branch to github, to publish the pre-release to PsGallery.
- Finish release using git-flow.
- Check if tags are not pushed to github.
- Check if the release branch is deleted on github.
- Create the release on github.