- Strip emojis from 47 markdown files across docs/, sql/, and root - Add docs/DOCS_CONSOLIDATION_PLAN.md with plan to reduce 45 docs to 8 - Establish no-emoji rule for documentation going forward 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4.8 KiB
Database Migration - Quick Reference
Date: 2025-11-06 Status: Design Finalized
What We're Doing
Consolidating PCs into machines table + adding communications, compliance, and warranty tracking.
New Tables (7)
- comstypes (8 cols) - Communication type lookup (IP, Serial, Network, etc.)
- communications (9 cols) - Universal comm tracking with generic
addressfield - compliance (14 cols) - Security/compliance data from inventory.xlsx
- compliancescans (5 cols) - AV/malware scan log
- warranties (5 cols) - Simple warranty tracking (name + expiration)
- relationshiptypes (5 cols) - Machine relationship types (Dualpath, Controlled By, etc.)
- machinerelationships (6 cols) - Machine-to-machine relationships tracking
Modified Tables (2)
- machines - Add 9 PC-related columns (hostname, serialnumber, osid, etc.)
- businessunits - Add 2 liaison fields (liaisonname, liaisonsso)
Renamed Tables (1)
- pcstatus → machinestatus - Consistent naming
Deprecated Tables (4)
Drop after 30-day testing:
- pc
- pc_comm_config
- pc_network_interfaces
- pctype
Key Design Decisions
Generic address field - One field for IP/COM/USB/etc (determined by comstypeid)
Simplified warranties - Just name + expiration date
Liaison in businessunits - No separate liaisons table
Unified machine types - PC types added to machinetypes
Vendor FK - compliance.managedbyvendorid → vendors table
Minimal audit - Removed unnecessary dateadded/lastupdated fields
Machine relationships - Generic table for dualpath, PC-to-machine control, future clusters
Migration Volumes
| Source | Destination | Records |
|---|---|---|
| pc table | machines | 277 |
| machines.ipaddress1/2 | communications | ~266 |
| pc_network_interfaces | communications | ~277+ |
| pc_comm_config | communications | ~100+ |
| pc warranties | warranties | ~277+ |
| Total | ~650+ comms |
Phase 1 Scripts (Ready to Create)
- Create communications infrastructure
- Extend machines table
- Create PC machine types
- Create warranty infrastructure
- Create compliance infrastructure
- Extend businessunits table
- Rename pcstatus table
- Create machine relationships infrastructure
Time: ~25 minutes Reversible: Yes
machines Table Final Structure (21 columns)
- machineid (PK)
- machinetypeid (now includes PC types!)
- machinenumber
- alias
- hostname (NEW - for PCs)
- serialnumber (NEW)
- loggedinuser (NEW - for PCs)
- modelnumberid
- controllertypeid (NEW - for CNC machines)
- controllerosid (NEW - controller OS, uses operatingsystems table)
- osid (NEW - for PCs, uses operatingsystems table)
- machinestatusid (NEW - renamed from pcstatusid)
- businessunitid
- printerid
- mapleft
- maptop
- isactive
- islocationonly
- machinenotes
- lastupdated (NEW)
- dateadded (NEW)
Key Design: Both PC OS and Controller OS use the same operatingsystems table!
Removed: pctypeid, isvnc, requires_manual_machine_config, ipaddress1, ipaddress2
communications Table Structure (9 columns)
- comid (PK)
- machineid (FK)
- comstypeid (FK)
- address (VARCHAR - universal: IP, COM1, eth0, etc.)
- port (for IP types)
- macaddress (for network types)
- description
- settings (JSON - type-specific config)
- isactive
compliance Table Structure (15 columns)
- complianceid (PK)
- machineid (FK)
- ongenetwork
- gecoreload
- assetcriticality
- cuidataclassification
- dodassettype
- dodassetsubtype
- otenvironment
- managedbyvendorid (FK to vendors)
- changerestricted
- jumpbox
- mft (Managed File Transfer)
- notes
- isactive
warranties Table Structure (5 columns)
- warrantyid (PK)
- machineid (FK)
- warrantyname
- enddate
- isactive
relationshiptypes Table Structure (5 columns)
- relationshiptypeid (PK)
- relationshiptype ('Dualpath', 'Controlled By', 'Controls', etc.)
- description
- isbidirectional (1 for symmetric, 0 for directional)
- isactive
machinerelationships Table Structure (6 columns)
- relationshipid (PK)
- relationshiptypeid (FK)
- machineid1 (FK to machines)
- machineid2 (FK to machines)
- notes
- isactive
Key Feature: Both machines and PCs are in machines table, so any machine can relate to any other machine.
Example:
- Machines 2001 & 2002 are dualpath (relationshiptypeid=1)
- Both controlled by PC 500 (relationshiptypeid=2)
Next Step
Create Phase 1 SQL Scripts (8 scripts + 8 rollback scripts)
See DATABASE_MIGRATION_FINAL_DESIGN.md for complete specification.