Newer Older
35 lines | 1.065kb
Bogdan Timofte authored 4 days ago
1
# Table: `host_sources`
2

            
3
Stores evidence/source labels for a host.
4

            
5
## Columns
6

            
7
| Column | Type | Null | Default | Notes |
8
|--------|------|------|---------|-------|
9
| `host_fqdn` | `TEXT` | no | none | Target host. References `hosts(fqdn)`. |
Bogdan Timofte authored a day ago
10
| `source` | `TEXT` | no | none | Source label kept for historical audit, for example `madagascar.json`. |
Bogdan Timofte authored 4 days ago
11
| `status` | `TEXT` | no | `'active'` | Source lifecycle state. |
12
| `created_at` | `TEXT` | no | none | ISO UTC creation timestamp. |
13
| `retired_at` | `TEXT` | yes | `NULL` | ISO UTC retirement timestamp. |
14

            
15
## Keys And Indexes
16

            
17
- Primary key: `(host_fqdn, source)`
18

            
19
## Relationships
20

            
21
- `host_fqdn` references `hosts(fqdn)` with `ON UPDATE CASCADE ON DELETE RESTRICT`
22

            
23
## Definition
24

            
25
```sql
26
CREATE TABLE IF NOT EXISTS host_sources (
27
    host_fqdn TEXT NOT NULL,
28
    source TEXT NOT NULL,
29
    status TEXT NOT NULL DEFAULT 'active',
30
    created_at TEXT NOT NULL,
31
    retired_at TEXT,
32
    PRIMARY KEY (host_fqdn, source),
33
    FOREIGN KEY (host_fqdn) REFERENCES hosts(fqdn) ON UPDATE CASCADE ON DELETE RESTRICT
34
);
35
```