chore: initial import to Nexus_Edu
This commit is contained in:
62
database/README.md
Normal file
62
database/README.md
Normal file
@@ -0,0 +1,62 @@
|
||||
# 数据库脚本使用说明
|
||||
|
||||
## 文件说明
|
||||
|
||||
- `schema.sql` - 完整建表语句(11张表)
|
||||
- `seed.sql` - 初始化示例数据
|
||||
- `drop.sql` - 清理所有表(危险!仅开发用)
|
||||
|
||||
## 使用步骤
|
||||
|
||||
### 1. 创建数据库
|
||||
|
||||
```sql
|
||||
CREATE DATABASE edunexus CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
USE edunexus;
|
||||
```
|
||||
|
||||
### 2. 执行建表脚本
|
||||
|
||||
```bash
|
||||
mysql -u root -p edunexus < schema.sql
|
||||
```
|
||||
|
||||
或在MySQL客户端中:
|
||||
```sql
|
||||
SOURCE schema.sql;
|
||||
```
|
||||
|
||||
### 3. 插入示例数据(可选)
|
||||
|
||||
```bash
|
||||
mysql -u root -p edunexus < seed.sql
|
||||
```
|
||||
|
||||
### 4. 清理数据(仅开发)
|
||||
|
||||
```bash
|
||||
mysql -u root -p edunexus < drop.sql
|
||||
```
|
||||
|
||||
## 表结构概览
|
||||
|
||||
| 模块 | 表名 | 说明 |
|
||||
|------|------|------|
|
||||
| 身份 | application_users | 用户账号 |
|
||||
| 组织 | schools, grades, classes, class_members | 学校组织架构 |
|
||||
| 教材 | subjects, textbooks, textbook_units, textbook_lessons, knowledge_points | 教材知识体系 |
|
||||
| 题库 | questions, question_knowledge | 题目库和知识点关联 |
|
||||
| 试卷 | exams, exam_nodes | 试卷和题目节点(树形) |
|
||||
| 作业 | assignments, student_submissions, submission_details | 作业发布和提交 |
|
||||
|
||||
## 重要说明
|
||||
|
||||
- 所有表都包含审计字段(created_at, created_by等)
|
||||
- 使用UUID作为主键(VARCHAR(36))
|
||||
- 支持软删除(is_deleted字段)
|
||||
- exam_nodes表支持无限层级嵌套
|
||||
- 密码使用bcrypt hash存储
|
||||
|
||||
## 下一步
|
||||
|
||||
数据库创建完成后,请使用后端API服务连接数据库。
|
||||
Reference in New Issue
Block a user