Skip to content

Commit

Permalink
Update docs to allow installing ps sqlserver module with -AllowClobber.
Browse files Browse the repository at this point in the history
Should be fine for the most use cases, but if this causes issues, we may
need to update the docs again or find another approach.
  • Loading branch information
stevewgr committed May 22, 2024
1 parent 9d9952a commit ffc3a64
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Brief explanation of the directory structure under `src`:
- Download the latest MSSQL Management Studio: https://learn.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms
- Note that it can connect to any version of SQL Server, so even if you use 2008, just get the latest Management Studio for better development experience
- Powershell `sqlserver` module
- Open Powershell as Admin and run the following command: `Install-Module -Name sqlserver -Force`
- Open Powershell as Admin and run the following command: `Install-Module sqlserver -AllowClobber -Force`
- Note that if you're getting errors during the installation, it is likely because because your SQL installation installed its own powershell module which conflicts with the one we intend to use. They're incompatible and behave differently when creating db exports, hence you need to delete it from your System Environment Variable `PSModulePath` and restart powershell to reload without these modules. Basically if you see in your `PSModulePath` environment variable something with `Microsoft SQL Server`, just remove it, since we want to use the module that we intend to use.
- Python and installing via pip the following packages (if you get errors, run powershell as admin):
- T-SQL code formatter: `pip install sqlfluff`
Expand Down
5 changes: 2 additions & 3 deletions import.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ param (

. "$PSScriptRoot\logger.ps1"

# Note that the script will fail if you don't have powershell sqlserver module installed.
# To install it, run powershell as admin and execute the following command: `Install-Module sqlserver`

function ConnectToSqlServer {
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") > $null
$server = $null
Expand Down Expand Up @@ -140,7 +139,7 @@ function Main {
if (-not (Get-Module -Name sqlserver -ListAvailable)) {
MessageError "Error: The 'sqlserver' powershell module is not installed."
MessageError "Please open PowerShell as Administrator and execute the following command to install it:"
MessageError "Install-Module -Name sqlserver -Force"
MessageError "Install-Module sqlserver -AllowClobber -Force"
exit 1
}

Expand Down
2 changes: 1 addition & 1 deletion src/migration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Couple of rules and notes when writing migration scripts:

Below are instructions for the release engineer in order to create a new db release:
- Create a new release branch following the db new release version according version semantics (`git checkout -b release/1.0.1`)
- Run the import script skipping the migration scripts (`.\import.ps1 -run_migration_scripts $false`)
- Run the import script skipping the migration scripts (`.\import.ps1 -skip_migration_scripts`)
- Run the export script, to be sure that no diff is produced (`.\export.ps1` and then `git status`)
- If there are local changes, something is probably off. Repeat the steps above
- If you're sure all in order, best is if you create a new separate PR with the changes, in case empty spaces and such were added
Expand Down

0 comments on commit ffc3a64

Please sign in to comment.