Skip to content

Latest commit

 

History

History
73 lines (56 loc) · 1.82 KB

数据库表结构.md

File metadata and controls

73 lines (56 loc) · 1.82 KB

1. topics

该表用于存储不同主题(topic)的信息。

列名 数据类型 描述
id int 主题 ID,主键
topic_title string 主题名称
topic_content string 对主题的描述(可空)

对应的 topic 对象结构如下:

{
    "id": int,
    "topicTitle": string,
    "topicDescription": string
}

对应的 SQL 创建语句如下:

CREATE TABLE "topics" (
    "id" INTEGER PRIMARY KEY AUTOINCREMENT,
    "topic_title" TEXT NOT NULL,
    "topic_content" TEXT
);

2. todos

该表用于存储待办事项的信息,并将每个待办事项与所属的主题关联起来。

列名 数据类型 描述 备注
id int 待办事项 ID,主键 自动生成
todo_title string 待办事项文本
deadline date 截止日期 可以为空
topic_id int 外键,指向 topics 作为新的外键,更符合要求
todo_content string 待办事项具体内容
todo_status int 此项任务的完成情况

对应的 todo 对象结构如下:

{
    "id": int,
    "todoTitle": string,
    "todoContent": string,
    "todoStatus": int,
    "topicId": int,
    "deadline": date
}

对应的 SQL 创建语句如下:

CREATE TABLE "todos" (
    "id" INTEGER PRIMARY KEY AUTOINCREMENT,
    "todo_title" TEXT NOT NULL,
    "todo_content" TEXT,
    "todo_status" INTEGER,
    "topic_id" INTEGER NOT NULL,
    "deadline" TEXT,
    FOREIGN KEY ("topic_id") REFERENCES "topics" ("id")
);