Step 1 of 6
Create comment and thread data models
Define persistent storage for comments and their threads.
The current codebase uses a relational database with an ORM (e.g., Prisma, Sequelize, TypeORM). Examine the existing schema folder and add new models without breaking existing migrations.
1. Open the project's ORM schema file (e.g., prisma/schema.prisma, models/*.js). 2. Add a `Comment` model/table with the following columns: `id` (primary key, UUID or auto‑increment), `content` (text, required), `authorId` (foreign key to Users, required), `createdAt` (timestamp default now), `updatedAt` (timestamp default now, on update), `parentCommentId` (nullable foreign key to Comment.id for replies), `threadId` (foreign key to Thread.id, required). 3. Add a `Thread` model/table with columns: `id` (primary key), `entityId` (foreign key to the object the thread belongs to, e.g., Post.id), `createdAt` (timestamp default now). 4. Define the proper relations (one‑to‑many Thread→Comments, self‑referencing one‑to‑many Comment→Comment). 5. Generate a migration script using the project's standard CLI (e.g., `prisma migrate dev`, `sequelize db:migrate`). 6. Run the migration and verify the new tables exist via the database console.
Expected after this step
A new Comment table and Thread table are added, migrations run without error, and the DB console shows both tables with correct columns and foreign keys.
Should not happen
- ✕AI returns only mock schema or in‑memory arrays instead of real ORM definitions.
- ✕Generated endpoints contain placeholder responses (e.g., static JSON) instead of DB calls.
- ✕Threading logic omitted or cycle detection not implemented.
- ✕Frontend components use hard‑coded sample data rather than fetching from the API.
Verify before continuing
Do not move on until every check is true. The complete button stays locked until then.
Do not continue if…
- !AI returns only mock schema or in‑memory arrays instead of real ORM definitions.
- !Generated endpoints contain placeholder responses (e.g., static JSON) instead of DB calls.
- !Threading logic omitted or cycle detection not implemented.
- !Frontend components use hard‑coded sample data rather than fetching from the API.
- !Forms submit to fake URLs or only log to console.
- !End‑to‑end tests mock network calls, failing to verify real persistence.
If the AI messes this up
Use this when the AI fakes progress or breaks the feature. It forces a real fix.
The schema you provided is incomplete or uses in‑memory placeholders. Please supply actual ORM/model definitions and a real migration script that can be executed in the current project.