Fix compliance table column names (snake_case to camelCase)
Renamed columns in compliance and compliancescans tables: - scan_date -> scandate - deployment_notes -> deploymentnotes - is_third_party_managed -> isthirdpartymanaged - third_party_manager -> thirdpartymanager - ot_asset_* -> otasset* - is_compliant -> iscompliant - compliance_notes -> compliancenotes - scan_name -> scanname - scan_result -> scanresult - scan_details -> scandetails Updated ASP files: - displaymachine.asp, displaypc.asp - fixed column reads - editmachine.asp, editpc.asp, editdevice.asp, machine_edit.asp - fixed column reads - savemachineedit.asp, savemachine_direct.asp, updatedevice_direct.asp - fixed SQL Updated production migration guide with new Step 4 for compliance columns. Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -655,7 +655,7 @@ End If
|
||||
thirdPartyManaged = rs2("isthirdpartymanaged") & ""
|
||||
thirdPartyManager = rs2("thirdpartymanager") & ""
|
||||
otAssetSystem = rs2("otenvironment") & ""
|
||||
dodAssetDeviceType = rs2("dodassettype") & ""
|
||||
dodAssetDeviceType = rs2("otassetdevicetype") & ""
|
||||
isCompliant = rs2("ischangerestricted") & ""
|
||||
|
||||
' Third party managed badge
|
||||
@@ -705,7 +705,7 @@ End If
|
||||
Set rs2 = Nothing
|
||||
|
||||
' Query security scans
|
||||
strSQL2 = "SELECT * FROM compliancescans WHERE machineid = ? ORDER BY scan_date DESC LIMIT 10"
|
||||
strSQL2 = "SELECT * FROM compliancescans WHERE machineid = ? ORDER BY scandate DESC LIMIT 10"
|
||||
Set rs2 = ExecuteParameterizedQuery(objConn, strSQL2, Array(machineid))
|
||||
|
||||
If rs2.EOF Then
|
||||
@@ -713,10 +713,10 @@ End If
|
||||
Else
|
||||
Do While Not rs2.EOF
|
||||
Dim scanName, scanDate, scanResult, scanDetails, resultBadge
|
||||
scanName = rs2("scan_name") & ""
|
||||
scanDate = rs2("scan_date") & ""
|
||||
scanResult = rs2("scan_result") & ""
|
||||
scanDetails = rs2("scan_details") & ""
|
||||
scanName = rs2("scanname") & ""
|
||||
scanDate = rs2("scandate") & ""
|
||||
scanResult = rs2("scanresult") & ""
|
||||
scanDetails = rs2("scandetails") & ""
|
||||
|
||||
If scanName = "" Then scanName = "Security Scan"
|
||||
If scanDetails = "" Then scanDetails = "<span class='text-muted'>No details</span>"
|
||||
|
||||
@@ -599,11 +599,11 @@ End If
|
||||
<div class="col-md-8">
|
||||
<%
|
||||
Dim thirdPartyManaged, thirdPartyManager, otAssetSystem, dodAssetDeviceType, isCompliant
|
||||
thirdPartyManaged = rs2("is_third_party_managed") & ""
|
||||
thirdPartyManager = rs2("third_party_manager") & ""
|
||||
otAssetSystem = rs2("ot_asset_system") & ""
|
||||
dodAssetDeviceType = rs2("ot_asset_device_type") & ""
|
||||
isCompliant = rs2("is_compliant")
|
||||
thirdPartyManaged = rs2("isthirdpartymanaged") & ""
|
||||
thirdPartyManager = rs2("thirdpartymanager") & ""
|
||||
otAssetSystem = rs2("otassetsystem") & ""
|
||||
dodAssetDeviceType = rs2("otassetdevicetype") & ""
|
||||
isCompliant = rs2("iscompliant")
|
||||
|
||||
' Third party managed badge
|
||||
Dim tpmBadge
|
||||
@@ -654,7 +654,7 @@ End If
|
||||
Set rs2 = Nothing
|
||||
|
||||
' Query security scans
|
||||
strSQL2 = "SELECT * FROM compliancescans WHERE machineid = ? ORDER BY scan_date DESC LIMIT 10"
|
||||
strSQL2 = "SELECT * FROM compliancescans WHERE machineid = ? ORDER BY scandate DESC LIMIT 10"
|
||||
Set rs2 = ExecuteParameterizedQuery(objConn, strSQL2, Array(machineid))
|
||||
|
||||
If rs2.EOF Then
|
||||
@@ -662,10 +662,10 @@ End If
|
||||
Else
|
||||
Do While Not rs2.EOF
|
||||
Dim scanName, scanDate, scanResult, scanDetails, resultBadge
|
||||
scanName = rs2("scan_name") & ""
|
||||
scanDate = rs2("scan_date") & ""
|
||||
scanResult = rs2("scan_result") & ""
|
||||
scanDetails = rs2("scan_details") & ""
|
||||
scanName = rs2("scanname") & ""
|
||||
scanDate = rs2("scandate") & ""
|
||||
scanResult = rs2("scanresult") & ""
|
||||
scanDetails = rs2("scandetails") & ""
|
||||
|
||||
If scanName = "" Then scanName = "Security Scan"
|
||||
If scanDetails = "" Then scanDetails = "<span class='text-muted'>No details</span>"
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
If NOT rsCompliance.EOF Then
|
||||
If NOT IsNull(rsCompliance("isthirdpartymanaged")) Then thirdpartymanaged = rsCompliance("isthirdpartymanaged")
|
||||
If NOT IsNull(rsCompliance("thirdpartymanager")) Then thirdpartymanager = rsCompliance("thirdpartymanager")
|
||||
If NOT IsNull(rsCompliance("dodassettype")) Then dodassettype = rsCompliance("dodassettype")
|
||||
If NOT IsNull(rsCompliance("otassetdevicetype")) Then dodassettype = rsCompliance("otassetdevicetype")
|
||||
End If
|
||||
rsCompliance.Close
|
||||
Set rsCompliance = Nothing
|
||||
|
||||
@@ -154,10 +154,10 @@
|
||||
Dim rsCompliance
|
||||
Set rsCompliance = cmd.Execute
|
||||
If NOT rsCompliance.EOF Then
|
||||
If NOT IsNull(rsCompliance("is_third_party_managed")) Then thirdpartymanaged = rsCompliance("is_third_party_managed")
|
||||
If NOT IsNull(rsCompliance("third_party_manager")) Then thirdpartymanager = rsCompliance("third_party_manager")
|
||||
If NOT IsNull(rsCompliance("ot_asset_system")) Then otassetsystem = rsCompliance("ot_asset_system")
|
||||
If NOT IsNull(rsCompliance("ot_asset_device_type")) Then dodassettype = rsCompliance("ot_asset_device_type")
|
||||
If NOT IsNull(rsCompliance("isthirdpartymanaged")) Then thirdpartymanaged = rsCompliance("isthirdpartymanaged")
|
||||
If NOT IsNull(rsCompliance("thirdpartymanager")) Then thirdpartymanager = rsCompliance("thirdpartymanager")
|
||||
If NOT IsNull(rsCompliance("otassetsystem")) Then otassetsystem = rsCompliance("otassetsystem")
|
||||
If NOT IsNull(rsCompliance("otassetdevicetype")) Then dodassettype = rsCompliance("otassetdevicetype")
|
||||
End If
|
||||
rsCompliance.Close
|
||||
Set rsCompliance = Nothing
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
If NOT rsCompliance.EOF Then
|
||||
If NOT IsNull(rsCompliance("isthirdpartymanaged")) Then thirdpartymanaged = rsCompliance("isthirdpartymanaged")
|
||||
If NOT IsNull(rsCompliance("thirdpartymanager")) Then thirdpartymanager = rsCompliance("thirdpartymanager")
|
||||
If NOT IsNull(rsCompliance("dodassettype")) Then dodassettype = rsCompliance("dodassettype")
|
||||
If NOT IsNull(rsCompliance("otassetdevicetype")) Then dodassettype = rsCompliance("otassetdevicetype")
|
||||
End If
|
||||
rsCompliance.Close
|
||||
Set rsCompliance = Nothing
|
||||
|
||||
@@ -157,8 +157,7 @@
|
||||
If NOT rsCompliance.EOF Then
|
||||
If NOT IsNull(rsCompliance("isthirdpartymanaged")) Then thirdpartymanaged = rsCompliance("isthirdpartymanaged")
|
||||
If NOT IsNull(rsCompliance("thirdpartymanager")) Then thirdpartymanager = rsCompliance("thirdpartymanager")
|
||||
' ot_asset_system column doesn't exist in current schema - using empty string
|
||||
If NOT IsNull(rsCompliance("dodassettype")) Then dodassettype = rsCompliance("dodassettype")
|
||||
If NOT IsNull(rsCompliance("otassetdevicetype")) Then dodassettype = rsCompliance("otassetdevicetype")
|
||||
End If
|
||||
rsCompliance.Close
|
||||
Set rsCompliance = Nothing
|
||||
|
||||
@@ -688,12 +688,12 @@
|
||||
|
||||
Set cmdCompliance = Server.CreateObject("ADODB.Command")
|
||||
cmdCompliance.ActiveConnection = objConn
|
||||
cmdCompliance.CommandText = "INSERT INTO compliance (machineid, isthirdpartymanaged, thirdpartymanager, dodassettype) VALUES (?, ?, ?, ?)"
|
||||
cmdCompliance.CommandText = "INSERT INTO compliance (machineid, isthirdpartymanaged, thirdpartymanager, otassetdevicetype) VALUES (?, ?, ?, ?)"
|
||||
cmdCompliance.CommandType = 1
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@machineid", 3, 1, , newMachineId)
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@isthirdpartymanaged", 200, 1, 1, tpmVal)
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@thirdpartymanager", 200, 1, 255, tpvendorName)
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@dodassettype", 200, 1, 100, dodassetVal)
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@otassetdevicetype", 200, 1, 100, dodassetVal)
|
||||
|
||||
On Error Resume Next
|
||||
cmdCompliance.Execute
|
||||
|
||||
@@ -734,7 +734,7 @@
|
||||
|
||||
If complianceExists Then
|
||||
' UPDATE existing compliance record
|
||||
cmdCompliance.CommandText = "UPDATE compliance SET isthirdpartymanaged = ?, thirdpartymanager = ?, dodassettype = ? WHERE machineid = ?"
|
||||
cmdCompliance.CommandText = "UPDATE compliance SET isthirdpartymanaged = ?, thirdpartymanager = ?, otassetdevicetype = ? WHERE machineid = ?"
|
||||
cmdCompliance.CommandType = 1
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@isthirdpartymanaged", 200, 1, 1, dbThirdPartyManaged)
|
||||
|
||||
@@ -745,17 +745,17 @@
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@thirdpartymanager", 200, 1, 255, thirdpartyvendorid)
|
||||
End If
|
||||
|
||||
' Handle nullable dodassettype
|
||||
' Handle nullable otassetdevicetype
|
||||
If dodassettype = "" Then
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@dodassettype", 200, 1, 100, Null)
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@otassetdevicetype", 200, 1, 100, Null)
|
||||
Else
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@dodassettype", 200, 1, 100, dodassettype)
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@otassetdevicetype", 200, 1, 100, dodassettype)
|
||||
End If
|
||||
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@machineid", 3, 1, , CLng(machineid))
|
||||
Else
|
||||
' INSERT new compliance record
|
||||
cmdCompliance.CommandText = "INSERT INTO compliance (machineid, isthirdpartymanaged, thirdpartymanager, dodassettype) VALUES (?, ?, ?, ?)"
|
||||
cmdCompliance.CommandText = "INSERT INTO compliance (machineid, isthirdpartymanaged, thirdpartymanager, otassetdevicetype) VALUES (?, ?, ?, ?)"
|
||||
cmdCompliance.CommandType = 1
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@machineid", 3, 1, , CLng(machineid))
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@isthirdpartymanaged", 200, 1, 1, dbThirdPartyManaged)
|
||||
@@ -767,11 +767,11 @@
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@thirdpartymanager", 200, 1, 255, thirdpartyvendorid)
|
||||
End If
|
||||
|
||||
' Handle nullable dodassettype
|
||||
' Handle nullable otassetdevicetype
|
||||
If dodassettype = "" Then
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@dodassettype", 200, 1, 100, Null)
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@otassetdevicetype", 200, 1, 100, Null)
|
||||
Else
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@dodassettype", 200, 1, 100, dodassettype)
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@otassetdevicetype", 200, 1, 100, dodassettype)
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
@@ -10,9 +10,10 @@ This guide covers all database changes made on December 10, 2025 that need to be
|
||||
|
||||
**Changes Summary:**
|
||||
1. Table naming convention fix (snake_case to camelCase)
|
||||
2. Fix backwards Controls relationships (Equipment->PC to PC->Equipment)
|
||||
3. Propagate controller assignments to dualpath machines
|
||||
4. Sync equipment data between dualpath partners
|
||||
2. Compliance table column rename (snake_case to camelCase)
|
||||
3. Fix backwards Controls relationships (Equipment->PC to PC->Equipment)
|
||||
4. Propagate controller assignments to dualpath machines
|
||||
5. Sync equipment data between dualpath partners
|
||||
|
||||
---
|
||||
|
||||
@@ -285,7 +286,76 @@ SELECT COUNT(*) FROM vw_active_pcs;
|
||||
|
||||
---
|
||||
|
||||
## Step 4: Fix Dualpath Controller Relationships
|
||||
## Step 4: Fix Compliance Table Column Names
|
||||
|
||||
Rename snake_case columns to camelCase in compliance and compliancescans tables.
|
||||
|
||||
Run `sql/naming_convention_fix/07_fix_compliance_columns.sql` or execute:
|
||||
|
||||
```sql
|
||||
-- Drop dependent view
|
||||
DROP VIEW IF EXISTS vw_compliance_summary;
|
||||
|
||||
-- Rename compliance table columns
|
||||
ALTER TABLE compliance
|
||||
CHANGE COLUMN scan_date scandate datetime,
|
||||
CHANGE COLUMN deployment_notes deploymentnotes text,
|
||||
CHANGE COLUMN is_third_party_managed isthirdpartymanaged enum('Yes','No','NA') DEFAULT 'NA',
|
||||
CHANGE COLUMN third_party_manager thirdpartymanager varchar(255),
|
||||
CHANGE COLUMN ot_asset_system otassetsystem varchar(255),
|
||||
CHANGE COLUMN ot_asset_device otassetdevice varchar(255),
|
||||
CHANGE COLUMN ot_asset_location otassetlocation varchar(255),
|
||||
CHANGE COLUMN ot_asset_device_type otassetdevicetype varchar(100),
|
||||
CHANGE COLUMN ot_asset_category otassetcategory varchar(100),
|
||||
CHANGE COLUMN ot_asset_last_seen otassetlastseen datetime,
|
||||
CHANGE COLUMN ot_asset_ip_source otassetipsource varchar(100),
|
||||
CHANGE COLUMN is_compliant iscompliant tinyint(1),
|
||||
CHANGE COLUMN compliance_notes compliancenotes text;
|
||||
|
||||
-- Rename compliancescans table columns
|
||||
ALTER TABLE compliancescans
|
||||
CHANGE COLUMN scan_name scanname varchar(255),
|
||||
CHANGE COLUMN scan_date scandate datetime NOT NULL,
|
||||
CHANGE COLUMN scan_result scanresult enum('Pass','Fail','Warning','Info') DEFAULT 'Info',
|
||||
CHANGE COLUMN scan_details scandetails text;
|
||||
|
||||
-- Recreate view with new column names
|
||||
CREATE VIEW vw_compliance_summary AS
|
||||
SELECT
|
||||
m.machineid,
|
||||
m.machinenumber,
|
||||
m.hostname,
|
||||
m.serialnumber,
|
||||
c.scan,
|
||||
c.scandate,
|
||||
c.isthirdpartymanaged,
|
||||
c.thirdpartymanager,
|
||||
c.mft,
|
||||
c.iscompliant,
|
||||
c.deploymentnotes,
|
||||
c.otassetsystem,
|
||||
c.otassetdevice,
|
||||
c.otassetlocation,
|
||||
(TO_DAYS(CURDATE()) - TO_DAYS(c.scandate)) AS days_since_scan,
|
||||
CASE
|
||||
WHEN c.scandate IS NULL THEN 'Never Scanned'
|
||||
WHEN c.scandate < (CURDATE() - INTERVAL 90 DAY) THEN 'Scan Overdue'
|
||||
WHEN c.scandate < (CURDATE() - INTERVAL 30 DAY) THEN 'Scan Due Soon'
|
||||
ELSE 'Scan Current'
|
||||
END AS scan_status
|
||||
FROM machines m
|
||||
LEFT JOIN compliance c ON m.machineid = c.machineid
|
||||
WHERE m.isactive = 1;
|
||||
|
||||
-- Verify
|
||||
SHOW COLUMNS FROM compliance;
|
||||
SHOW COLUMNS FROM compliancescans;
|
||||
SELECT COUNT(*) FROM vw_compliance_summary;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Step 5: Fix Dualpath Controller Relationships
|
||||
|
||||
This fixes two issues:
|
||||
1. Backwards relationship direction (Equipment->Controls->PC should be PC->Controls->Equipment)
|
||||
@@ -391,7 +461,7 @@ SELECT 'Controller relationship fix complete!' AS status;
|
||||
|
||||
---
|
||||
|
||||
## Step 5: Sync Dualpath Equipment Data
|
||||
## Step 6: Sync Dualpath Equipment Data
|
||||
|
||||
This syncs controller type, model, and communication settings between dualpath partners.
|
||||
|
||||
@@ -506,7 +576,7 @@ SELECT 'Dualpath data sync complete!' AS status;
|
||||
|
||||
---
|
||||
|
||||
## Step 6: Deploy Updated ASP Files
|
||||
## Step 7: Deploy Updated ASP Files
|
||||
|
||||
Pull the latest code from Gitea which includes:
|
||||
- Updated table names in all ASP files
|
||||
@@ -522,7 +592,7 @@ Or copy files manually from a prepared deployment package.
|
||||
|
||||
---
|
||||
|
||||
## Step 7: Start IIS
|
||||
## Step 8: Start IIS
|
||||
|
||||
```cmd
|
||||
iisreset /start
|
||||
@@ -530,7 +600,7 @@ iisreset /start
|
||||
|
||||
---
|
||||
|
||||
## Step 8: Verify Everything Works
|
||||
## Step 9: Verify Everything Works
|
||||
|
||||
### 8.1 Test key pages in browser:
|
||||
- http://yourserver/displaypcs.asp - PC listing
|
||||
@@ -549,7 +619,7 @@ http://yourserver/api.asp?action=getDashboardData
|
||||
|
||||
---
|
||||
|
||||
## Step 9: Optional Cleanup
|
||||
## Step 10: Optional Cleanup
|
||||
|
||||
After confirming everything works (wait at least a day):
|
||||
|
||||
|
||||
87
sql/naming_convention_fix/07_fix_compliance_columns.sql
Normal file
87
sql/naming_convention_fix/07_fix_compliance_columns.sql
Normal file
@@ -0,0 +1,87 @@
|
||||
-- ============================================================================
|
||||
-- Script: 07_fix_compliance_columns.sql
|
||||
-- Purpose: Rename snake_case columns to camelCase in compliance tables
|
||||
-- Target: MySQL 5.6 (dev and production)
|
||||
-- ============================================================================
|
||||
|
||||
-- ============================================================================
|
||||
-- STEP 1: DROP DEPENDENT VIEW
|
||||
-- ============================================================================
|
||||
|
||||
DROP VIEW IF EXISTS vw_compliance_summary;
|
||||
|
||||
-- ============================================================================
|
||||
-- STEP 2: RENAME COMPLIANCE TABLE COLUMNS
|
||||
-- ============================================================================
|
||||
|
||||
-- compliance table column renames
|
||||
ALTER TABLE compliance
|
||||
CHANGE COLUMN scan_date scandate datetime,
|
||||
CHANGE COLUMN deployment_notes deploymentnotes text,
|
||||
CHANGE COLUMN is_third_party_managed isthirdpartymanaged enum('Yes','No','NA') DEFAULT 'NA',
|
||||
CHANGE COLUMN third_party_manager thirdpartymanager varchar(255),
|
||||
CHANGE COLUMN ot_asset_system otassetsystem varchar(255),
|
||||
CHANGE COLUMN ot_asset_device otassetdevice varchar(255),
|
||||
CHANGE COLUMN ot_asset_location otassetlocation varchar(255),
|
||||
CHANGE COLUMN ot_asset_device_type otassetdevicetype varchar(100),
|
||||
CHANGE COLUMN ot_asset_category otassetcategory varchar(100),
|
||||
CHANGE COLUMN ot_asset_last_seen otassetlastseen datetime,
|
||||
CHANGE COLUMN ot_asset_ip_source otassetipsource varchar(100),
|
||||
CHANGE COLUMN is_compliant iscompliant tinyint(1),
|
||||
CHANGE COLUMN compliance_notes compliancenotes text;
|
||||
|
||||
-- ============================================================================
|
||||
-- STEP 3: RENAME COMPLIANCESCANS TABLE COLUMNS
|
||||
-- ============================================================================
|
||||
|
||||
ALTER TABLE compliancescans
|
||||
CHANGE COLUMN scan_name scanname varchar(255),
|
||||
CHANGE COLUMN scan_date scandate datetime NOT NULL,
|
||||
CHANGE COLUMN scan_result scanresult enum('Pass','Fail','Warning','Info') DEFAULT 'Info',
|
||||
CHANGE COLUMN scan_details scandetails text;
|
||||
|
||||
-- ============================================================================
|
||||
-- STEP 4: RECREATE VIEW WITH NEW COLUMN NAMES
|
||||
-- ============================================================================
|
||||
|
||||
CREATE VIEW vw_compliance_summary AS
|
||||
SELECT
|
||||
m.machineid,
|
||||
m.machinenumber,
|
||||
m.hostname,
|
||||
m.serialnumber,
|
||||
c.scan,
|
||||
c.scandate,
|
||||
c.isthirdpartymanaged,
|
||||
c.thirdpartymanager,
|
||||
c.mft,
|
||||
c.iscompliant,
|
||||
c.deploymentnotes,
|
||||
c.otassetsystem,
|
||||
c.otassetdevice,
|
||||
c.otassetlocation,
|
||||
(TO_DAYS(CURDATE()) - TO_DAYS(c.scandate)) AS days_since_scan,
|
||||
CASE
|
||||
WHEN c.scandate IS NULL THEN 'Never Scanned'
|
||||
WHEN c.scandate < (CURDATE() - INTERVAL 90 DAY) THEN 'Scan Overdue'
|
||||
WHEN c.scandate < (CURDATE() - INTERVAL 30 DAY) THEN 'Scan Due Soon'
|
||||
ELSE 'Scan Current'
|
||||
END AS scan_status
|
||||
FROM machines m
|
||||
LEFT JOIN compliance c ON m.machineid = c.machineid
|
||||
WHERE m.isactive = 1;
|
||||
|
||||
-- ============================================================================
|
||||
-- VERIFICATION
|
||||
-- ============================================================================
|
||||
|
||||
SELECT 'Compliance table columns after rename:' AS status;
|
||||
SHOW COLUMNS FROM compliance;
|
||||
|
||||
SELECT 'Compliancescans table columns after rename:' AS status;
|
||||
SHOW COLUMNS FROM compliancescans;
|
||||
|
||||
SELECT 'View test:' AS status;
|
||||
SELECT COUNT(*) AS row_count FROM vw_compliance_summary;
|
||||
|
||||
SELECT 'Column rename complete!' AS status;
|
||||
@@ -681,7 +681,7 @@
|
||||
|
||||
If complianceExists Then
|
||||
' UPDATE existing compliance record
|
||||
cmdCompliance.CommandText = "UPDATE compliance SET isthirdpartymanaged = ?, thirdpartymanager = ?, dodassettype = ? WHERE machineid = ?"
|
||||
cmdCompliance.CommandText = "UPDATE compliance SET isthirdpartymanaged = ?, thirdpartymanager = ?, otassetdevicetype = ? WHERE machineid = ?"
|
||||
cmdCompliance.CommandType = 1
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@isthirdpartymanaged", 200, 1, 1, dbThirdPartyManaged)
|
||||
|
||||
@@ -692,17 +692,17 @@
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@thirdpartymanager", 200, 1, 255, thirdpartyvendorid)
|
||||
End If
|
||||
|
||||
' Handle nullable dodassettype
|
||||
' Handle nullable otassetdevicetype
|
||||
If dodassettype = "" Then
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@dodassettype", 200, 1, 100, Null)
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@otassetdevicetype", 200, 1, 100, Null)
|
||||
Else
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@dodassettype", 200, 1, 100, dodassettype)
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@otassetdevicetype", 200, 1, 100, dodassettype)
|
||||
End If
|
||||
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@machineid", 3, 1, , CLng(machineid))
|
||||
Else
|
||||
' INSERT new compliance record
|
||||
cmdCompliance.CommandText = "INSERT INTO compliance (machineid, isthirdpartymanaged, thirdpartymanager, dodassettype) VALUES (?, ?, ?, ?)"
|
||||
cmdCompliance.CommandText = "INSERT INTO compliance (machineid, isthirdpartymanaged, thirdpartymanager, otassetdevicetype) VALUES (?, ?, ?, ?)"
|
||||
cmdCompliance.CommandType = 1
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@machineid", 3, 1, , CLng(machineid))
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@isthirdpartymanaged", 200, 1, 1, dbThirdPartyManaged)
|
||||
@@ -714,11 +714,11 @@
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@thirdpartymanager", 200, 1, 255, thirdpartyvendorid)
|
||||
End If
|
||||
|
||||
' Handle nullable dodassettype
|
||||
' Handle nullable otassetdevicetype
|
||||
If dodassettype = "" Then
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@dodassettype", 200, 1, 100, Null)
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@otassetdevicetype", 200, 1, 100, Null)
|
||||
Else
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@dodassettype", 200, 1, 100, dodassettype)
|
||||
cmdCompliance.Parameters.Append cmdCompliance.CreateParameter("@otassetdevicetype", 200, 1, 100, dodassettype)
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
Reference in New Issue
Block a user