Newer Older
56 lines | 1.962kb
Bogdan Timofte authored 4 days ago
1
# Table: `hosts`
2

            
3
Canonical host registry. Hosts are identified by full DNS name in `fqdn`.
4

            
Bogdan Timofte authored a day ago
5
`legacy_id` and `hosts_ip` exist for compatibility with existing runtime databases and Work Orders, but they are not the product contract. UI and exports identify hosts by `fqdn` and expose one canonical `ip`.
Bogdan Timofte authored 4 days ago
6

            
7
## Columns
8

            
9
| Column | Type | Null | Default | Notes |
10
|--------|------|------|---------|-------|
11
| `fqdn` | `TEXT` | no | none | Canonical full host name. Primary key. |
Bogdan Timofte authored a day ago
12
| `legacy_id` | `TEXT` | no | none | Internal compatibility ID. Unique. |
Bogdan Timofte authored 4 days ago
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`
Bogdan Timofte authored a day ago
34
- `host_tags.host_fqdn`
Bogdan Timofte authored 4 days ago
35
- `host_ssh.host_fqdn`
36
- `vhosts.host_fqdn`
37
- `dhcp_leases.host_fqdn`
38
- `mdns_observations.host_fqdn`
39
- `certificates.host_fqdn`
40
- `work_order_actions.host_fqdn`
41

            
42
## Definition
43

            
44
```sql
45
CREATE TABLE IF NOT EXISTS hosts (
46
    fqdn TEXT PRIMARY KEY,
47
    legacy_id TEXT NOT NULL UNIQUE,
48
    status TEXT NOT NULL DEFAULT 'active',
49
    hosts_ip TEXT NOT NULL DEFAULT '',
50
    dns_ip TEXT NOT NULL DEFAULT '',
51
    monitoring TEXT NOT NULL DEFAULT 'pending',
52
    notes TEXT NOT NULL DEFAULT '',
53
    created_at TEXT NOT NULL,
54
    updated_at TEXT NOT NULL
55
);
56
```