Fix: create config.remediation_action_log in install/, not the upgrade folder#1051
Merged
Merged
Conversation
…e folder The B3 Apply-Fix audit table (config.remediation_action_log) was placed ONLY in upgrades/2.11.0-to-2.12.0/02_create_remediation_action_log.sql and nowhere in install/. A FRESH 2.12.0 install therefore never created it, so every privileged remediation (force-plan, DB-config, RCSI, clear-plan) would hit its audit-table-absent hard block on a clean install. The upgrade folder is for schema changes to EXISTING objects only (ALTER ADD COLUMN, change datatype, nullable). New tables and view/proc code belong in install/* (idempotent), which the installer runs on BOTH fresh installs and upgrades (Installer/Program.cs runs upgrade folders, then re-runs install/*). - Move the table's CREATE (final shape incl. consent_acknowledged) into install/03_create_config_tables.sql, inside config.ensure_config_tables, with the same IF OBJECT_ID guard / @tables_created increment / collection_log entry as its siblings. Created on fresh AND upgrade. - Delete upgrades/2.11.0-to-2.12.0/02_create_remediation_action_log.sql and its upgrade.txt line; renumber 03_make_other_process_cpu_nullable.sql -> 02_. - The upgrade folder now holds only ALTER-existing-object scripts (01 add columns, 02 make column nullable). Verified by upgrade-path-validator: column shape identical to the deleted script; idempotent; no dangling references; fresh + upgrade both create it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…lock The header comment contained "install/*" twice; in a T-SQL block comment /* opens a NESTED comment, so the closing */ closed the nested one and left the outer comment unterminated -> "Missing end comment mark '*/'" aborted 03_create_config_tables. Reworded to "the install scripts" (no /* sequence). Verified by a clean fresh install on SQL2022 (exit 0): config.remediation_action_log created with all 17 columns incl. consent_acknowledged, action varchar(32); PerformanceMonitor DB online. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem (release-blocking)
config.remediation_action_log(the B3 Apply-Fix audit table, new in 2.12.0) was placed only inupgrades/2.11.0-to-2.12.0/02_create_remediation_action_log.sqland nowhere ininstall/. The installer runs the upgrade folders only when upgrading from a prior version; a fresh 2.12.0 install runsinstall/*only — so it never created the table. Result: on a fresh install every privileged remediation (force-plan, DB-config, RCSI, clear-plan) hits its audit-table-absent hard block → the whole Apply-Fix feature is dead.This also violated the rule that
upgrades/{from}-to-{to}/is for schema changes to EXISTING objects only (ALTER ADD COLUMN / change datatype / nullable). New tables + view/proc code belong ininstall/*(idempotent), which the installer runs on both fresh installs and upgrades (Installer/Program.csruns upgrade folders, then re-runsinstall/*).Fix
CREATE(final shape, incl.consent_acknowledged) intoinstall/03_create_config_tables.sql(theconfig.*home), insideconfig.ensure_config_tables, with the sameIF OBJECT_ID(...) IS NULLguard /@tables_createdincrement /config.collection_logentry as its sibling tables. → created on fresh AND upgrade.upgrades/2.11.0-to-2.12.0/02_create_remediation_action_log.sql+ itsupgrade.txtline; renumber03_make_other_process_cpu_nullable.sql→02_.01add columns,02make column nullable).Validation
config.ensure_config_tables; no dangling references; both fresh and upgrade create it.🤖 Generated with Claude Code