Files
ai-scoring-application/database/README.md

79 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 資料庫配置說明
## 資料庫資訊
- **主機**: mysql.theaken.com
- **端口**: 33306
- **資料庫名稱**: db_AI_scoring
- **用戶名**: root
- **密碼**: zh6161168
## 環境變數設定
請在專案根目錄建立 `.env.local` 檔案,並加入以下配置:
```env
# 資料庫配置
DB_HOST=mysql.theaken.com
DB_PORT=33306
DB_NAME=db_AI_scoring
DB_USER=root
DB_PASSWORD=zh6161168
# 應用程式配置
NEXT_PUBLIC_APP_URL=http://localhost:3000
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-secret-key-here
# 文件上傳配置
UPLOAD_DIR=./uploads
MAX_FILE_SIZE=104857600
ALLOWED_FILE_TYPES=ppt,pptx,pdf,mp4,avi,mov,wmv,flv,webm
```
## 初始化資料庫
1. 安裝依賴:
```bash
pnpm install
```
2. 初始化資料庫:
```bash
pnpm run db:init
```
3. 測試資料庫連接:
```bash
pnpm run db:test
```
## 資料表結構
### 核心資料表
- `users` - 用戶管理
- `criteria_templates` - 評分標準模板
- `criteria_items` - 評分項目明細
- `projects` - 評審專案
- `project_files` - 專案文件
- `project_websites` - 專案網站連結
- `evaluations` - 評審記錄
- `evaluation_scores` - 評分結果明細
- `evaluation_feedback` - AI 評語和建議
- `system_settings` - 系統設定
### 關聯關係
- 用戶 → 多個評分標準模板
- 評分標準模板 → 多個評分項目
- 用戶 → 多個專案
- 專案 → 多個文件/網站連結
- 專案 → 一個評審記錄
- 評審記錄 → 多個評分結果
- 評審記錄 → 多個評語建議
## 預設數據
系統會自動建立:
- 預設評分標準模板
- 5個預設評分項目內容品質、視覺設計、邏輯結構、創新性、實用性
- 系統設定參數