- 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>
198 lines
4.8 KiB
Markdown
198 lines
4.8 KiB
Markdown
# 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)
|
|
|
|
1. **comstypes** (8 cols) - Communication type lookup (IP, Serial, Network, etc.)
|
|
2. **communications** (9 cols) - Universal comm tracking with generic `address` field
|
|
3. **compliance** (14 cols) - Security/compliance data from inventory.xlsx
|
|
4. **compliancescans** (5 cols) - AV/malware scan log
|
|
5. **warranties** (5 cols) - Simple warranty tracking (name + expiration)
|
|
6. **relationshiptypes** (5 cols) - Machine relationship types (Dualpath, Controlled By, etc.)
|
|
7. **machinerelationships** (6 cols) - Machine-to-machine relationships tracking
|
|
|
|
---
|
|
|
|
## Modified Tables (2)
|
|
|
|
1. **machines** - Add 9 PC-related columns (hostname, serialnumber, osid, etc.)
|
|
2. **businessunits** - Add 2 liaison fields (liaisonname, liaisonsso)
|
|
|
|
---
|
|
|
|
## Renamed Tables (1)
|
|
|
|
1. **pcstatus → machinestatus** - Consistent naming
|
|
|
|
---
|
|
|
|
## Deprecated Tables (4)
|
|
|
|
Drop after 30-day testing:
|
|
1. pc
|
|
2. pc_comm_config
|
|
3. pc_network_interfaces
|
|
4. 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)
|
|
|
|
1. Create communications infrastructure
|
|
2. Extend machines table
|
|
3. Create PC machine types
|
|
4. Create warranty infrastructure
|
|
5. Create compliance infrastructure
|
|
6. Extend businessunits table
|
|
7. Rename pcstatus table
|
|
8. Create machine relationships infrastructure
|
|
|
|
**Time:** ~25 minutes
|
|
**Reversible:** Yes
|
|
|
|
---
|
|
|
|
## machines Table Final Structure (21 columns)
|
|
|
|
1. machineid (PK)
|
|
2. machinetypeid (now includes PC types!)
|
|
3. machinenumber
|
|
4. alias
|
|
5. hostname (NEW - for PCs)
|
|
6. serialnumber (NEW)
|
|
7. loggedinuser (NEW - for PCs)
|
|
8. modelnumberid
|
|
9. controllertypeid (NEW - for CNC machines)
|
|
10. controllerosid (NEW - controller OS, uses operatingsystems table)
|
|
11. osid (NEW - for PCs, uses operatingsystems table)
|
|
12. machinestatusid (NEW - renamed from pcstatusid)
|
|
13. businessunitid
|
|
14. printerid
|
|
15. mapleft
|
|
16. maptop
|
|
17. isactive
|
|
18. islocationonly
|
|
19. machinenotes
|
|
20. lastupdated (NEW)
|
|
21. 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)
|
|
|
|
1. comid (PK)
|
|
2. machineid (FK)
|
|
3. comstypeid (FK)
|
|
4. **address** (VARCHAR - universal: IP, COM1, eth0, etc.)
|
|
5. port (for IP types)
|
|
6. macaddress (for network types)
|
|
7. description
|
|
8. settings (JSON - type-specific config)
|
|
9. isactive
|
|
|
|
---
|
|
|
|
## compliance Table Structure (15 columns)
|
|
|
|
1. complianceid (PK)
|
|
2. machineid (FK)
|
|
3. ongenetwork
|
|
4. gecoreload
|
|
5. assetcriticality
|
|
6. cuidataclassification
|
|
7. dodassettype
|
|
8. dodassetsubtype
|
|
9. otenvironment
|
|
10. managedbyvendorid (FK to vendors)
|
|
11. changerestricted
|
|
12. jumpbox
|
|
13. mft (Managed File Transfer)
|
|
14. notes
|
|
15. isactive
|
|
|
|
---
|
|
|
|
## warranties Table Structure (5 columns)
|
|
|
|
1. warrantyid (PK)
|
|
2. machineid (FK)
|
|
3. warrantyname
|
|
4. enddate
|
|
5. isactive
|
|
|
|
---
|
|
|
|
## relationshiptypes Table Structure (5 columns)
|
|
|
|
1. relationshiptypeid (PK)
|
|
2. relationshiptype ('Dualpath', 'Controlled By', 'Controls', etc.)
|
|
3. description
|
|
4. isbidirectional (1 for symmetric, 0 for directional)
|
|
5. isactive
|
|
|
|
---
|
|
|
|
## machinerelationships Table Structure (6 columns)
|
|
|
|
1. relationshipid (PK)
|
|
2. relationshiptypeid (FK)
|
|
3. machineid1 (FK to machines)
|
|
4. machineid2 (FK to machines)
|
|
5. notes
|
|
6. 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.
|