Newer Older
51 lines | 1.928kb
Bogdan Timofte authored 4 days ago
1
# Table: `host_ssh`
2

            
3
Stores SSH access profiles separately from `hosts`.
4

            
5
## Columns
6

            
7
| Column | Type | Null | Default | Notes |
8
|--------|------|------|---------|-------|
9
| `host_fqdn` | `TEXT` | no | none | Target host. References `hosts(fqdn)`. |
10
| `profile_name` | `TEXT` | no | `'default'` | SSH profile name. |
11
| `username` | `TEXT` | no | `''` | SSH username. |
12
| `port` | `INTEGER` | no | `22` | SSH port. |
13
| `identity_file` | `TEXT` | no | `''` | SSH identity path or key label. |
14
| `address` | `TEXT` | no | `''` | Optional override address. |
15
| `local_forward_host` | `TEXT` | no | `''` | Optional local-forward host. |
16
| `local_forward_port` | `INTEGER` | yes | `NULL` | Optional local-forward port. |
17
| `remote_forward_host` | `TEXT` | no | `''` | Optional remote-forward host. |
18
| `remote_forward_port` | `INTEGER` | yes | `NULL` | Optional remote-forward port. |
19
| `notes` | `TEXT` | no | `''` | Operator notes. |
20
| `created_at` | `TEXT` | no | none | ISO UTC creation timestamp. |
21
| `updated_at` | `TEXT` | no | none | ISO UTC update timestamp. |
22

            
23
## Keys And Indexes
24

            
25
- Primary key: `(host_fqdn, profile_name)`
26

            
27
## Relationships
28

            
29
- `host_fqdn` references `hosts(fqdn)` with `ON UPDATE CASCADE ON DELETE RESTRICT`
30

            
31
## Definition
32

            
33
```sql
34
CREATE TABLE IF NOT EXISTS host_ssh (
35
    host_fqdn TEXT NOT NULL,
36
    profile_name TEXT NOT NULL DEFAULT 'default',
37
    username TEXT NOT NULL DEFAULT '',
38
    port INTEGER NOT NULL DEFAULT 22,
39
    identity_file TEXT NOT NULL DEFAULT '',
40
    address TEXT NOT NULL DEFAULT '',
41
    local_forward_host TEXT NOT NULL DEFAULT '',
42
    local_forward_port INTEGER,
43
    remote_forward_host TEXT NOT NULL DEFAULT '',
44
    remote_forward_port INTEGER,
45
    notes TEXT NOT NULL DEFAULT '',
46
    created_at TEXT NOT NULL,
47
    updated_at TEXT NOT NULL,
48
    PRIMARY KEY (host_fqdn, profile_name),
49
    FOREIGN KEY (host_fqdn) REFERENCES hosts(fqdn) ON UPDATE CASCADE ON DELETE RESTRICT
50
);
51
```