|
Bogdan Timofte
authored
4 days ago
|
1
|
# Table: `hosts`
|
|
|
2
|
|
|
|
3
|
Canonical host registry. Hosts are identified by full DNS name in `fqdn`.
|
|
|
4
|
|
|
|
5
|
`legacy_id` exists for compatibility with the current UI/API, but it is not the canonical identity.
|
|
|
6
|
|
|
|
7
|
## Columns
|
|
|
8
|
|
|
|
9
|
| Column | Type | Null | Default | Notes |
|
|
|
10
|
|--------|------|------|---------|-------|
|
|
|
11
|
| `fqdn` | `TEXT` | no | none | Canonical full host name. Primary key. |
|
|
|
12
|
| `legacy_id` | `TEXT` | no | none | Short ID used by the existing UI/API. Unique. |
|
|
|
13
|
| `status` | `TEXT` | no | `'active'` | Host lifecycle state, currently `active`, `planned`, or `retired`. |
|
|
Bogdan Timofte
authored
4 days ago
|
14
|
| `hosts_ip` | `TEXT` | no | `''` | Legacy compatibility column. The current app model keeps one canonical routable IP and mirrors it here. |
|
|
|
15
|
| `dns_ip` | `TEXT` | no | `''` | Canonical routable IP for the host. The current UI/API expose this as a single `ip` field. |
|
|
Bogdan Timofte
authored
4 days ago
|
16
|
| `monitoring` | `TEXT` | no | `'pending'` | Monitoring state. |
|
|
|
17
|
| `notes` | `TEXT` | no | `''` | Operator notes. |
|
|
|
18
|
| `created_at` | `TEXT` | no | none | ISO UTC creation timestamp. |
|
|
|
19
|
| `updated_at` | `TEXT` | no | none | ISO UTC update timestamp. |
|
|
|
20
|
|
|
|
21
|
## Keys And Indexes
|
|
|
22
|
|
|
|
23
|
- Primary key: `fqdn`
|
|
|
24
|
- Unique key: `legacy_id`
|
|
|
25
|
|
|
|
26
|
## Relationships
|
|
|
27
|
|
|
|
28
|
Referenced by:
|
|
|
29
|
|
|
|
30
|
- `host_aliases.host_fqdn`
|
|
|
31
|
- `host_roles.host_fqdn`
|
|
|
32
|
- `host_sources.host_fqdn`
|
|
|
33
|
- `host_flags.host_fqdn`
|
|
|
34
|
- `host_ssh.host_fqdn`
|
|
|
35
|
- `vhosts.host_fqdn`
|
|
|
36
|
- `dhcp_leases.host_fqdn`
|
|
|
37
|
- `mdns_observations.host_fqdn`
|
|
|
38
|
- `certificates.host_fqdn`
|
|
|
39
|
- `work_order_actions.host_fqdn`
|
|
|
40
|
|
|
|
41
|
## Definition
|
|
|
42
|
|
|
|
43
|
```sql
|
|
|
44
|
CREATE TABLE IF NOT EXISTS hosts (
|
|
|
45
|
fqdn TEXT PRIMARY KEY,
|
|
|
46
|
legacy_id TEXT NOT NULL UNIQUE,
|
|
|
47
|
status TEXT NOT NULL DEFAULT 'active',
|
|
|
48
|
hosts_ip TEXT NOT NULL DEFAULT '',
|
|
|
49
|
dns_ip TEXT NOT NULL DEFAULT '',
|
|
|
50
|
monitoring TEXT NOT NULL DEFAULT 'pending',
|
|
|
51
|
notes TEXT NOT NULL DEFAULT '',
|
|
|
52
|
created_at TEXT NOT NULL,
|
|
|
53
|
updated_at TEXT NOT NULL
|
|
|
54
|
);
|
|
|
55
|
```
|