Fix database schema documentation to match actual tables
- Fix table names: pc_comm_config → commconfig, pc_dnc_config → dncconfig - Fix column name: communications.gateway → defaultgateway - Clarify printers uses 'ipaddress' while communications uses 'address' - Update CREATE TABLE statements to match actual schema - Add warranties table to QUICK_REFERENCE.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -123,9 +123,11 @@ docker exec -it dev-mysql mysql -u root -prootpassword shopdb
|
|||||||
- Strings are 1-indexed, not 0-indexed
|
- Strings are 1-indexed, not 0-indexed
|
||||||
|
|
||||||
### Column Name Gotchas
|
### Column Name Gotchas
|
||||||
- `address` not `ipaddress` in communications table
|
- `address` not `ipaddress` in communications table (but printers uses `ipaddress`)
|
||||||
|
- `defaultgateway` not `gateway` in communications table
|
||||||
- `machinenotes` not `notes` in machines table
|
- `machinenotes` not `notes` in machines table
|
||||||
- `machineid` not `pcid` for PCs in machines table
|
- `machineid` not `pcid` for PCs in machines table
|
||||||
|
- `commconfig` and `dncconfig` tables (not pc_comm_config, pc_dnc_config)
|
||||||
|
|
||||||
### PC Identification
|
### PC Identification
|
||||||
PCs are in the machines table, identified by:
|
PCs are in the machines table, identified by:
|
||||||
|
|||||||
76
docs/API.md
76
docs/API.md
@@ -86,10 +86,10 @@ This ASP API replaces the PHP api.php and provides the same functionality but ru
|
|||||||
1. Insert/update record in `machines` table with `pctypeid IS NOT NULL`
|
1. Insert/update record in `machines` table with `pctypeid IS NOT NULL`
|
||||||
2. Clear old network interfaces from `communications`
|
2. Clear old network interfaces from `communications`
|
||||||
3. Insert new network interfaces to `communications` with `comstypeid = 1`
|
3. Insert new network interfaces to `communications` with `comstypeid = 1`
|
||||||
4. Clear old serial port configs from `pc_comm_config`
|
4. Clear old serial port configs from `commconfig`
|
||||||
5. Insert new serial port configs to `pc_comm_config`
|
5. Insert new serial port configs to `commconfig`
|
||||||
6. Clear old DNC config from `pc_dnc_config`
|
6. Clear old DNC config from `dncconfig`
|
||||||
7. Insert new DNC config to `pc_dnc_config`
|
7. Insert new DNC config to `dncconfig`
|
||||||
8. Create PC-to-equipment relationship in `machinerelationships` if `machineNo` provided
|
8. Create PC-to-equipment relationship in `machinerelationships` if `machineNo` provided
|
||||||
9. Update warranty data in `warranties` table
|
9. Update warranty data in `warranties` table
|
||||||
|
|
||||||
@@ -338,7 +338,7 @@ This ASP API replaces the PHP api.php and provides the same functionality but ru
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
**Stored in:** `pc_comm_config` table
|
**Stored in:** `commconfig` table
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -362,7 +362,7 @@ This ASP API replaces the PHP api.php and provides the same functionality but ru
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**Stored in:** `pc_dnc_config` table
|
**Stored in:** `dncconfig` table
|
||||||
|
|
||||||
**Additional DNC fields sent as separate parameters:**
|
**Additional DNC fields sent as separate parameters:**
|
||||||
- `dncDualPathEnabled` - true/false
|
- `dncDualPathEnabled` - true/false
|
||||||
@@ -407,51 +407,55 @@ CREATE TABLE communications (
|
|||||||
address VARCHAR(45), -- IP address
|
address VARCHAR(45), -- IP address
|
||||||
macaddress VARCHAR(17),
|
macaddress VARCHAR(17),
|
||||||
subnetmask VARCHAR(45),
|
subnetmask VARCHAR(45),
|
||||||
gateway VARCHAR(45),
|
defaultgateway VARCHAR(45),
|
||||||
interfacename VARCHAR(50),
|
interfacename VARCHAR(50),
|
||||||
isprimary TINYINT(1),
|
isprimary TINYINT(1),
|
||||||
isactive TINYINT(1)
|
isactive TINYINT(1)
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
#### pc_comm_config (Serial Port Configs)
|
#### commconfig (Serial Port Configs)
|
||||||
```sql
|
```sql
|
||||||
CREATE TABLE pc_comm_config (
|
CREATE TABLE commconfig (
|
||||||
commconfigid INT(11) PRIMARY KEY AUTO_INCREMENT,
|
configid INT(11) PRIMARY KEY AUTO_INCREMENT,
|
||||||
machineid INT(11), -- Changed from pcid
|
machineid INT(11),
|
||||||
portname VARCHAR(50),
|
configtype VARCHAR(50),
|
||||||
baudrate INT(11),
|
portid VARCHAR(20),
|
||||||
|
baud INT(11),
|
||||||
databits INT(11),
|
databits INT(11),
|
||||||
parity VARCHAR(20),
|
parity VARCHAR(10),
|
||||||
stopbits VARCHAR(20),
|
stopbits VARCHAR(5),
|
||||||
flowcontrol VARCHAR(50)
|
ipaddress VARCHAR(45),
|
||||||
|
socketnumber INT(11),
|
||||||
|
additionalsettings TEXT,
|
||||||
|
lastupdated DATETIME
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
#### pc_dnc_config (DNC Configuration)
|
#### dncconfig (DNC Configuration)
|
||||||
```sql
|
```sql
|
||||||
CREATE TABLE pc_dnc_config (
|
CREATE TABLE dncconfig (
|
||||||
dncconfigid INT(11) PRIMARY KEY AUTO_INCREMENT,
|
dncid INT(11) PRIMARY KEY AUTO_INCREMENT,
|
||||||
machineid INT(11), -- Changed from pcid
|
machineid INT(11),
|
||||||
site VARCHAR(50),
|
site VARCHAR(100),
|
||||||
cnc VARCHAR(50),
|
cnc VARCHAR(100),
|
||||||
ncif VARCHAR(50),
|
ncif VARCHAR(50),
|
||||||
machinenumber VARCHAR(50),
|
machinenumber VARCHAR(50),
|
||||||
hosttype VARCHAR(50),
|
hosttype VARCHAR(50),
|
||||||
ftphostprimary VARCHAR(100),
|
ftphostprimary VARCHAR(100),
|
||||||
ftphostsecondary VARCHAR(100),
|
ftphostsecondary VARCHAR(100),
|
||||||
ftpaccount VARCHAR(100),
|
ftpaccount VARCHAR(100),
|
||||||
debug VARCHAR(50),
|
debug VARCHAR(10),
|
||||||
uploads VARCHAR(100),
|
uploads VARCHAR(10),
|
||||||
scanner VARCHAR(50),
|
scanner VARCHAR(10),
|
||||||
dripfeed VARCHAR(50),
|
dripfeed VARCHAR(10),
|
||||||
additionalsettings VARCHAR(255),
|
additionalsettings TEXT,
|
||||||
dualpath_enabled TINYINT(1),
|
dualpath_enabled TINYINT(1),
|
||||||
path1_name VARCHAR(100),
|
path1_name VARCHAR(255),
|
||||||
path2_name VARCHAR(100),
|
path2_name VARCHAR(255),
|
||||||
ge_registry_32bit TINYINT(1),
|
ge_registry_32bit TINYINT(1),
|
||||||
ge_registry_64bit TINYINT(1),
|
ge_registry_64bit TINYINT(1),
|
||||||
ge_registry_notes VARCHAR(255),
|
ge_registry_notes TEXT,
|
||||||
lastupdated DATETIME
|
lastupdated DATETIME
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
@@ -747,8 +751,8 @@ mysql -h 192.168.122.1 -u root -p shopdb < sql/migration_phase2/08_update_schema
|
|||||||
```
|
```
|
||||||
|
|
||||||
This renames `pcid` → `machineid` in:
|
This renames `pcid` → `machineid` in:
|
||||||
- `pc_comm_config`
|
- `commconfig`
|
||||||
- `pc_dnc_config`
|
- `dncconfig`
|
||||||
|
|
||||||
### Step 2: Deploy api.asp
|
### Step 2: Deploy api.asp
|
||||||
|
|
||||||
@@ -857,11 +861,11 @@ ALTER TABLE machines ADD INDEX idx_machinenumber (machinenumber);
|
|||||||
ALTER TABLE communications ADD INDEX idx_machineid (machineid);
|
ALTER TABLE communications ADD INDEX idx_machineid (machineid);
|
||||||
ALTER TABLE communications ADD INDEX idx_comstypeid (comstypeid);
|
ALTER TABLE communications ADD INDEX idx_comstypeid (comstypeid);
|
||||||
|
|
||||||
-- pc_comm_config table
|
-- commconfig table
|
||||||
ALTER TABLE pc_comm_config ADD INDEX idx_machineid (machineid);
|
ALTER TABLE commconfig ADD INDEX idx_machineid (machineid);
|
||||||
|
|
||||||
-- pc_dnc_config table
|
-- dncconfig table
|
||||||
ALTER TABLE pc_dnc_config ADD INDEX idx_machineid (machineid);
|
ALTER TABLE dncconfig ADD INDEX idx_machineid (machineid);
|
||||||
|
|
||||||
-- machinerelationships table
|
-- machinerelationships table
|
||||||
ALTER TABLE machinerelationships ADD INDEX idx_machineid (machineid);
|
ALTER TABLE machinerelationships ADD INDEX idx_machineid (machineid);
|
||||||
|
|||||||
@@ -50,11 +50,11 @@ machines (machineid, hostname, serialnumber, alias, machinenumber,
|
|||||||
pctype (pctypeid, typename)
|
pctype (pctypeid, typename)
|
||||||
-- Values: Standard, Engineer, Shopfloor, CMM, Wax Trace, etc.
|
-- Values: Standard, Engineer, Shopfloor, CMM, Wax Trace, etc.
|
||||||
|
|
||||||
-- PC Communication Config (serial ports)
|
-- Communication Config (serial ports for equipment)
|
||||||
pc_comm_config (commconfigid, machineid, portname, baudrate, databits, parity, stopbits)
|
commconfig (configid, machineid, configtype, portid, baud, databits, parity, ipaddress)
|
||||||
|
|
||||||
-- PC DNC Config
|
-- DNC Config
|
||||||
pc_dnc_config (dncconfigid, machineid, site, cnc, ncif, dualpath_enabled, path1_name, path2_name)
|
dncconfig (dncid, machineid, site, cnc, ncif, dualpath_enabled, path1_name, path2_name)
|
||||||
|
|
||||||
-- PC-to-Equipment Relationships
|
-- PC-to-Equipment Relationships
|
||||||
machinerelationships (relationshipid, machineid, related_machineid, relationshiptypeid)
|
machinerelationships (relationshipid, machineid, related_machineid, relationshiptypeid)
|
||||||
@@ -63,9 +63,9 @@ machinerelationships (relationshipid, machineid, related_machineid, relationship
|
|||||||
|
|
||||||
### Network & Communications
|
### Network & Communications
|
||||||
```sql
|
```sql
|
||||||
-- All network interfaces (replaces pc_network_interfaces)
|
-- All network interfaces
|
||||||
communications (comid, machineid, comstypeid, address, macaddress,
|
communications (comid, machineid, comstypeid, address, macaddress,
|
||||||
subnetmask, gateway, interfacename, isprimary, isactive)
|
subnetmask, defaultgateway, interfacename, isprimary, isactive)
|
||||||
-- comstypeid 1 = Network Interface
|
-- comstypeid 1 = Network Interface
|
||||||
-- NOTE: Column is 'address' not 'ipaddress'
|
-- NOTE: Column is 'address' not 'ipaddress'
|
||||||
|
|
||||||
@@ -97,11 +97,14 @@ knowledgebase (linkid, shortdescription, keywords, applicationid, linkurl, click
|
|||||||
### Infrastructure
|
### Infrastructure
|
||||||
```sql
|
```sql
|
||||||
-- Printers (separate table, not in machines)
|
-- Printers (separate table, not in machines)
|
||||||
printers (printerid, printercsfname, modelid, serialnumber, address, fqdn, isactive)
|
printers (printerid, printercsfname, modelid, serialnumber, ipaddress, fqdn, isactive)
|
||||||
-- NOTE: Column is 'address' not 'ipaddress'
|
-- NOTE: Printers use 'ipaddress' (unlike communications which uses 'address')
|
||||||
|
|
||||||
-- Notifications
|
-- Notifications
|
||||||
notifications (notificationid, notification, starttime, endtime, isactive, notificationtypeid)
|
notifications (notificationid, notification, starttime, endtime, isactive, notificationtypeid)
|
||||||
|
|
||||||
|
-- Warranties
|
||||||
|
warranties (warrantyid, machineid, enddate, servicelevel, status, daysremaining)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Reference Data
|
### Reference Data
|
||||||
|
|||||||
Reference in New Issue
Block a user