---
# System prepended metadata

title: 伺服器資料庫設計
tags: [Server, Speaker]

---

###### tags: `Server` `Speaker`
# 伺服器資料庫設計
### 依據音箱後端的需求
*PK: Primary Key
*FK: Foreign Key
#### 音箱資訊 Speaker Info
    
| Attributes    | Data type    | Meaning     |
| ------------- | ------------ | ----------- |
| device_id     | nvarchar(50) | PK          |
| user_id       | nvarchar(50) | FK          |
| device_name   | nvarchar(50) |             |
| system_volume | int(50)      |             | 
| media_volume  | int(50)      |             |
| time_zone     | nvarchar(50) | for time    |
| region        | nvarchar(50) | for weather |
| status        | nvarchar(50) |             |


<!-- device_id 看要不要用樹梅派本身的 FCC ID or IC ID -->
#### 使用者資訊 User Info
| Attributes           | Data type    | Meaning |
| -------------------- | ------------ | ------- |
| user_id              | nvarchar(50) | PK      |
| google_refresh_token | nvarchar(50) |         |
| google_access_token  | nvarchar(50) |         |
| user_name            | nvarchar(50) |         |
| line_id              | nvarchar(50) |         |

<!-- line 的資訊待確認 -->
#### 搜尋結果資訊 Search Result Info
| Attributes          | Data type    | Meaning |
| ------------------- | ------------ | ------- |
| search_result_id    | nvarchar(50) | PK      |
| search_result_title | nvarchar(50) |         |
| search_result_url   | nvarchar(50) |         |
| search_result_text  | nvarchar(50) |         |
| user_id             | nvarchar(50) | PK      |

#### 函式名稱 function_name
| Attributes         | Data type    | Meaning |
| ------------------ | ------------ | ------- |
| function_name      | nvarchar(50) | PK      |

#### 函式關鍵字 Keyword
| Attributes         | Data type    | Meaning |
| ------------------ | ------------ | ------- |
| function_name      | nvarchar(50) |         |
| keyword            | nvarchar(50) | PK      |
