Skip to content

Commit 234e3c3

Browse files
committed
docs: update database.md
1 parent f370408 commit 234e3c3

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

docs/database.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,27 +66,29 @@ Tracks user devices, type, status, and optional metadata.
6666

6767
Stores sensor readings from devices. Flexible using JSONB.
6868

69-
| Column | Type | Notes |
70-
| ----------- | --------- | ------------------------- |
71-
| id | UUID | Primary Key |
72-
| device_id | UUID | Foreign Key → Devices(id) |
73-
| type | VARCHAR | E.g., environment, motion |
74-
| payload | JSONB | Sensor readings, flexible |
75-
| recorded_at | TIMESTAMP | Timestamp of reading |
69+
| Column | Type | Notes |
70+
| -------------- | --------- | ------------------------------------------- |
71+
| id | UUID | Primary Key |
72+
| device_id | UUID | Foreign Key → Devices(id) |
73+
| telemetry_type | VARCHAR | E.g., environment, motion |
74+
| payload | JSONB | Sensor readings, flexible |
75+
| recorded_at | TIMESTAMP | Timestamp of reading |
76+
| created_at | TIMESTAMP | Timestamp the database stored the telemetry |
7677

7778
**Example:**
7879

7980
```json
8081
{
8182
"id": "uuid-9012",
8283
"device_id": "uuid-5678",
83-
"data_type": "environment",
84-
"value": {
84+
"telemetry_type": "environment",
85+
"payload": {
8586
"temperature": 24.5,
8687
"humidity": 48.2,
8788
"light": 300
8889
},
89-
"recorded_at": "2025-08-14T12:10:00Z"
90+
"recorded_at": "2025-08-14T12:10:00Z",
91+
"created_at": "2025-08-14T12:10:00Z"
9092
}
9193
```
9294

@@ -110,12 +112,12 @@ Stores commands issued to devices with flexible payloads.
110112
{
111113
"id": "uuid-3456",
112114
"device_id": "uuid-5678",
113-
"command": "set_threshold",
115+
"command_name": "set_threshold",
114116
"payload": {
115117
"temperature": 25.0,
116118
"humidity": 50.0
117119
},
118-
"status": "Pending",
120+
"status": "pending",
119121
"created_at": "2025-08-14T12:15:00Z",
120122
"executed_at": null
121123
}

0 commit comments

Comments
 (0)