做产品 PMaker
空格的键盘
模型定错了
项目客户名客户电话
品牌升级张明138…
包装设计张明139…
官网改版张 明138…
客户信息重复存了三份
改一次电话要改三处,还容易漏
模型定对了
customers
id · 姓名 · 电话
1 — 多
projects
id · 名称 · customer_id
客户只存一份
改一次,三个项目都跟着变

左边那张表能跑,问题要到用户改了一次电话号码才暴露出来,那时候界面已经写完了。

Data Model First

Changing the interface takes minutes; changing the data model means migrating everything already stored against it. It's the most expensive rework on the whole chain.

What you will run into
  • 某个信息在两个页面显示得不一致,因为它存了两份
  • 想加个筛选,发现这个字段当初是拼在一个文本里的
  • 界面怎么调都别扭,改了半天发现是数据关系不对

Let the AI build pages directly and it derives data from the surface: if the page shows a customer name, it adds a customer-name field to the project table. Looks fine on one page — until a second page also needs customer info, and the data starts forking.

How to Define It

步骤具体做什么
找名词把内容清单和场景描述里的名词圈出来:项目、客户、改稿记录、对账单
判断实体能被单独列出来、单独增删改的,就是实体;只是某个实体的属性的,就是字段
定关系两两问一遍:一个 A 能对应几个 B,一个 B 能对应几个 A
查重复同一个信息如果出现在两个表里,多半该抽成独立实体
Step three is the key. Many-to-many relationships need a junction table — the later you settle this, the harder it is to fix.
让 AI 直接做页面,它会顺着界面推数据 页面 A 要显示客户名 项目表 加个「客户名」字段 页面 B 也要用客户信息 又存一份 数据开始分叉 单页看没问题,第二个页面一来就分叉了。改一处要同步改几处,迟早会漏。 先抽出「客户」实体 它能被单独增删改 项目表只存客户 ID 客户名只有一份 两个页面引用同一处 改一处,处处生效 判断实体只要一句话:能被单独列出来、单独增删改的就是实体;只是某个实体的属性的,就是字段。 另外给所有表加一个软删除标记,别真删——用户误删能恢复,关联数据也不会突然断掉。 界面改一次是几分钟,数据模型改一次是把已有数据也一起迁走。
Step three is the key. Many-to-many relationships need a junction table — the later you settle this, the harder it is to fix.

Signals You Got It Wrong

Soft delete deserves a note here: add a deletion flag to the table instead of actually deleting. Users can recover from mistakes, and linked data won't suddenly snap.

Note for the AI

PROMPT · Define the data model
基于下面这份内容清单和使用场景,先设计数据模型,不要写界面。

内容清单:[粘贴清单]
场景:[谁、在什么时候、做什么]

请输出:
1. 实体列表。每个实体的字段、类型、是否必填、默认值。
2. 实体之间的关系,标明一对一、一对多还是多对多。
   多对多请明确指出需要中间表。
3. 逐条检查有没有重复存储:同一个信息是否出现在多个实体里。
   有的话说明为什么,或者建议怎么抽出来。
4. 列出你不确定的地方,比如某个字段该属于哪个实体、
   某个关系的多少端。逐条问我,不要自己决定。
5. 哪些字段将来可能需要被搜索或筛选,据此说明为什么
   不能把它们塞进一个大文本字段里。

另外:所有实体都加 created_at 和软删除标记。
我确认之后再写代码。

Point five prevents a common pitfall. To make the interface easier to write, the AI happily crams several pieces of information into a single field — and you only find out you can't split them apart when you need to filter.