Newer Older
42 lines | 1.145kb
Bogdan Timofte authored 4 days ago
1
# Table: `work_orders`
2

            
3
Stores Work Order headers.
4

            
5
## Columns
6

            
7
| Column | Type | Null | Default | Notes |
8
|--------|------|------|---------|-------|
9
| `id` | `TEXT` | no | none | Work Order ID. Primary key. |
10
| `status` | `TEXT` | no | `'pending'` | Work Order state. |
11
| `title` | `TEXT` | no | `''` | Title. |
12
| `reason` | `TEXT` | no | `''` | Reason/context. |
13
| `created_at` | `TEXT` | no | none | ISO UTC creation timestamp. |
14
| `confirmed_at` | `TEXT` | no | `''` | Confirmation timestamp, empty until confirmed. |
15
| `result` | `TEXT` | no | `''` | Result summary. |
16
| `updated_at` | `TEXT` | no | none | ISO UTC update timestamp. |
17

            
18
## Keys And Indexes
19

            
20
- Primary key: `id`
21

            
22
## Relationships
23

            
24
Referenced by:
25

            
26
- `work_order_checklist.work_order_id`
27
- `work_order_actions.work_order_id`
28

            
29
## Definition
30

            
31
```sql
32
CREATE TABLE IF NOT EXISTS work_orders (
33
    id TEXT PRIMARY KEY,
34
    status TEXT NOT NULL DEFAULT 'pending',
35
    title TEXT NOT NULL DEFAULT '',
36
    reason TEXT NOT NULL DEFAULT '',
37
    created_at TEXT NOT NULL,
38
    confirmed_at TEXT NOT NULL DEFAULT '',
39
    result TEXT NOT NULL DEFAULT '',
40
    updated_at TEXT NOT NULL
41
);
42
```