- Move completed migration docs to docs/archive/ - Move session summaries to docs/archive/sessions/ - Rename API_ASP_DOCUMENTATION.md to docs/API.md - Archive redundant Claude reference files - Update docs/README.md as simplified index - Reduce active docs from 45+ files to 8 essential files Remaining docs: - CLAUDE.md (AI context) - TODO.md (task tracking) - docs/README.md, API.md, QUICK_REFERENCE.md - docs/ASP_DEVELOPMENT_GUIDE.md, STANDARDS.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
10 KiB
Database Schema Comparison Report
Date: 2025-11-20 Comparison: database-backup-11-20-25-eod-with-drop.sql vs Current Dev Database Dev Backup Created: /home/camp/projects/windows/shopdb/sql/dev-backup-20251120-105614.sql
Executive Summary
The backup file contains Phase 1 schema (pre-migration) with 63 tables, while the current dev database contains Phase 2 schema (post-migration) with 30 tables.
Key Findings:
- 4 tables have schema changes (businessunits, controllertypes, machine_overrides, machines)
- 8 new Phase 2 tables exist in dev but not in backup
- 41 legacy tables exist in backup but not in dev (deprecated/views)
Tables Requiring DROP and Recreate
1. Tables with Schema Changes (4 tables)
These tables exist in both files but have different column structures. They should be dropped and recreated from the backup file if you want to revert to the backup schema.
machines (CRITICAL - Most Changes)
Columns Removed in Dev (exist in backup):
ipaddress1- Removed (now in communications table)ipaddress2- Removed (now in communications table)
Columns Added in Dev (not in backup):
hostname- For PC hostnamesserialnumber- Equipment serial numbersloggedinuser- Current logged-in user (PCs)pctypeid- Identifies PCs (NULL = equipment, NOT NULL = PC)osid- Foreign key to operatingsystems (PC OS)controllertypeid- Foreign key to controllertypescontrollerosid- Controller OS (for CNCs)controllermodelid- Controller model referencemachinestatusid- Replaces pcstatusidlastupdated- Auto-updated timestamprequires_manual_machine_config- Configuration flag
Impact: This is the core table for Phase 2 migration. Reverting will break all PC and network device functionality.
businessunits
Columns Added in Dev (not in backup):
liaisonname- Liaison contact nameliaisonsso- Liaison SSOfacility_id- Facility identifierdt_lead- DT Lead namedt_lead_sso- DT Lead SSO
Impact: Minor. These are additional metadata fields that don't affect core functionality.
controllertypes
Columns Added in Dev (not in backup):
vendorid- Foreign key to vendorscontrollermodel- Controller model namecontroller_os- Controller OS namecontrollernotes- Additional notes
Impact: Minor. Enhanced metadata for CNC controllers.
machine_overrides
Issue: Same columns but definition differences (likely data types or constraints changed)
Impact: Unknown without detailed field-by-field comparison.
New Tables in Dev (Phase 2 Migration)
These 8 tables exist in the current dev database but NOT in the backup file. They are Phase 2 migration tables and should be preserved.
Phase 2 Tables (DO NOT DROP)
communications- Unified network interface storage (replaces pc_network_interfaces, printer IPs)comstypes- Communication types (IP, Serial, USB, etc.)compliance- Compliance tracking datacompliancescans- Compliance scan historymachinerelationships- Machine-to-machine relationships (dualpath, controls)relationshiptypes- Relationship type definitionsmachinestatus- Replaces pcstatus with broader scopewarranties- Warranty tracking
These tables are critical for Phase 2 functionality and should NOT be dropped.
Legacy Tables in Backup (Not in Dev)
These 41 tables exist in the backup file but NOT in the current dev database. Most are deprecated or views.
Deprecated PC Tables (Replaced by machines + communications)
pc- DEPRECATED → Replaced by machines WHERE pctypeid IS NOT NULLpc_network_interfaces- DEPRECATED → Replaced by communicationspc_comm_config- DEPRECATED → Replaced by communicationspc_dnc_config- DEPRECATED → Integrated into machine relationshipspc_dualpath_assignments- DEPRECATED → Replaced by machinerelationshipspctype- DEPRECATED → Now stored in machines.pctypeidpcstatus- DEPRECATED → Replaced by machinestatus
Deprecated Network Device Tables (Replaced by machines)
accesspoints- DEPRECATED → Replaced by machines WHERE machinetypeid = 16cameras- DEPRECATED → Replaced by machines WHERE machinetypeid = 18switches- DEPRECATED → Replaced by machines WHERE machinetypeid = 19servers- DEPRECATED → Replaced by machines WHERE machinetypeid = 20idfs- DEPRECATED → Replaced by machines WHERE machinetypeid = 17
Legacy Relationship Table
machine_pc_relationships- DEPRECATED → Replaced by machinerelationships
Backup Table
pc_model_backup- Backup table (can be dropped)
Views (33 views)
All views with vw_ prefix are query views, not base tables:
vw_active_pcsvw_dnc_configvw_dualpath_managementvw_engineer_pcsvw_ge_machinesvw_idf_inventoryvw_infrastructure_summaryvw_machine_assignmentsvw_machine_assignment_statusvw_machinetype_comparisonvw_machine_type_statsvw_multi_pc_machinesvw_network_devicesvw_pc_network_summaryvw_pc_resolved_machinesvw_pcs_by_hardwarevw_pc_summaryvw_pctype_configvw_recent_updatesvw_shopfloor_applications_summaryvw_shopfloor_comm_configvw_shopfloor_pcsvw_standard_pcsvw_unmapped_machinesvw_vendor_summaryvw_warranties_expiringvw_warranty_status
Note: Views need to be recreated to match Phase 2 schema.
Recommendation: What to Drop and Recreate
CRITICAL WARNING
DO NOT apply the backup file schema if you want to keep Phase 2 functionality!
The backup file represents the OLD Phase 1 schema before the major PC migration work completed on Nov 17, 2025. Applying it would:
- Lose all Phase 2 migration work (20+ days of development)
- Break all PC pages (displaypcs.asp, displaypc.asp, editpc.asp, etc.)
- Break network device display (network_map.asp, network_devices.asp)
- Lose unified communications table
- Lose machine relationships functionality
- Lose compliance tracking
- Lose warranty management
If You Must Revert to Backup Schema
Tables to DROP and recreate from backup:
machines- DROP and recreate (loses Phase 2 columns)businessunits- DROP and recreate (loses liaison/facility fields)controllertypes- DROP and recreate (loses enhanced metadata)machine_overrides- DROP and recreate (definition changes)
Tables to DROP from dev (Phase 2 tables):
communications- DROP (then recreate from backup if needed)comstypes- DROPcompliance- DROPcompliancescans- DROPmachinerelationships- DROPrelationshiptypes- DROPmachinestatus- DROP (will recreatepcstatusfrom backup)warranties- DROP
Tables to ADD from backup (legacy tables):
- ➕
pc- CREATE from backup - ➕
pc_network_interfaces- CREATE from backup - ➕
pc_comm_config- CREATE from backup - ➕
pc_dnc_config- CREATE from backup - ➕
pc_dualpath_assignments- CREATE from backup - ➕
pctype- CREATE from backup - ➕
pcstatus- CREATE from backup - ➕
accesspoints- CREATE from backup (if needed) - ➕
cameras- CREATE from backup (if needed) - ➕
switches- CREATE from backup (if needed) - ➕
servers- CREATE from backup (if needed) - ➕
idfs- CREATE from backup (if needed) - ➕
machine_pc_relationships- CREATE from backup
Views to recreate (33 views): All vw_* views need to be dropped and recreated from backup.
Recommended Action Plan
Option 1: Keep Phase 2 Schema (RECOMMENDED)
DO NOTHING. Your current dev database is the latest Phase 2 schema with all improvements.
The backup file is outdated and should not be applied unless you need to revert Phase 2 changes.
Option 2: Sync Backup File to Match Dev
If the backup file is supposed to be the "source of truth", then UPDATE the backup file to include Phase 2 schema:
- Export current dev schema:
mysqldump shopdb > new-phase2-backup.sql - Replace old backup file with Phase 2 schema
- Use Phase 2 schema for future deployments
Option 3: Revert to Backup Schema (NOT RECOMMENDED)
If you absolutely must revert to Phase 1 schema:
- Backup current dev database (already done: dev-backup-20251120-105614.sql)
- Drop Phase 2 tables: communications, compliance, machinerelationships, etc.
- Restore machines, businessunits, controllertypes to backup versions
- Restore all legacy tables (pc, pc_network_interfaces, etc.)
- Recreate all views
- Accept that all Phase 2 functionality will be lost
Table Count Summary
| Category | Backup File | Dev Database | Difference |
|---|---|---|---|
| Total Tables | 63 | 30 | -33 |
| Base Tables | 36 | 30 | -6 |
| Views | 27 | 0 | -27 |
| Schema Changes | - | 4 | - |
| New in Dev | - | 8 | +8 |
| Missing in Dev | 41 | - | - |
Files Generated
- Current Dev Backup:
/home/camp/projects/windows/shopdb/sql/dev-backup-20251120-105614.sql(464 KB) - This Report:
/home/camp/projects/windows/shopdb/SCHEMA_COMPARISON_REPORT_2025-11-20.md
Conclusion
The backup file (database-backup-11-20-25-eod-with-drop.sql) is from BEFORE Phase 2 migration.
Your current dev database has the Phase 2 schema with significant improvements:
- Unified machines table for all infrastructure
- Consolidated communications table
- Machine relationships tracking
- Compliance management
- Warranty tracking
Recommendation: Do NOT apply the backup file schema. Keep your current Phase 2 dev schema.
If production needs updating, use your current dev schema as the source, not the backup file.
Generated: 2025-11-20 10:56 Analyst: Claude Code Status: Analysis Complete