Install-DbaWhoIsActive - Select version-appropriate SQL file based on server version#10341
Install-DbaWhoIsActive - Select version-appropriate SQL file based on server version#10341andreasjordan wants to merge 3 commits intodevelopmentfrom
Conversation
… server version sp_WhoIsActive now ships version-specific scripts in subfolders named with year ranges (e.g. 2005-2008, 2012-2019). The root file targets the latest SQL Server version. The SQL file selection is moved from the begin block to the process block so each target server gets the correct script version based on its VersionMajor property. Subfolder matching parses year ranges from directory names (e.g. "2005-2008") and checks whether the server's release year falls within that range. Closes #10339 (do Install-DbaWhoIsActive) Co-authored-by: Andreas Jordan <andreasjordan@users.noreply.github.com>
|
@claude the folder structure is different than expected. This is the new structure: Folder "2008" with the files for "SQL Server 2005 - 2008 compatible version":
Folder "2019" with the files for "SQL Server 2012 - 2019 compatible version":
Base folder with the files for current versions (2022+):
|
|
Claude finished @andreasjordan's task in 1m 43s —— View job Updating SQL file selection logic for actual folder structure
The matching logic has been updated. The folder name (e.g.
Committed as |
…folder names (2008, 2019) Folder names represent the maximum supported SQL Server year, not ranges. Sort subfolders ascending and pick the first where serverYear <= folderYear. (do Install-DbaWhoIsActive) Co-authored-by: Andreas Jordan <andreasjordan@users.noreply.github.com>
|
@claude I think this is to much code and to much flexibility. Let's only test:
Just in case no file is found or the folder is not present then try to find the old "who_is_active.sql" file. |
|
Claude finished @andreasjordan's task in 2m 16s —— View job Simplifying version selection logic
The SQL file selection logic has been replaced with a simple 3-branch check: if ($server.VersionMajor -le 10) {
# SQL Server 2008 or older -> folder 2008
} elseif ($server.VersionMajor -le 15) {
# SQL Server 2012-2019 -> folder 2019
} else {
# SQL Server 2022+ -> base folder
}If the resolved file doesn't exist, it falls back to searching for the old Committed as |
Replace flexible dynamic folder parsing with simple hardcoded checks: - VersionMajor <= 10 (SQL 2008 or older) -> folder 2008 - VersionMajor <= 15 (SQL 2019 or older) -> folder 2019 - Else (SQL 2022+) -> base folder Falls back to old who_is_active.sql filename if no file is found. (do Install-DbaWhoIsActive) Co-authored-by: Andreas Jordan <andreasjordan@users.noreply.github.com>
Implements version-based SQL file selection for sp_WhoIsActive to support the new multi-script release structure.
The SQL file selection is moved from the begin block to the process block so each target server gets the correct script version based on its VersionMajor property. Subfolder matching parses year ranges from directory names (e.g. "2005-2008") and checks whether the server's release year falls within that range.
Closes #10339
Generated with Claude Code