feat(comment): db columns for comment suggestions (#315 phase 1)
Add suggested_text / suggestion_applied_at / suggestion_applied_by_id to the comments table (migration) and mirror them in the hand-curated db.d.ts Comments interface. suggested_text holds a proposed replacement for the comment's anchored selection; the applied_* columns record who applied it and when. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { type Kysely } from 'kysely';
|
||||
|
||||
export async function up(db: Kysely<any>): Promise<void> {
|
||||
// Agent comment suggestions (#315): a comment may carry a proposed replacement
|
||||
// for its anchored `selection`, which a human applies via the comment UI.
|
||||
await db.schema
|
||||
.alterTable('comments')
|
||||
// The proposed replacement text (plain text). NULL for ordinary comments.
|
||||
.addColumn('suggested_text', 'text')
|
||||
// When the suggestion was applied (NULL until applied).
|
||||
.addColumn('suggestion_applied_at', 'timestamptz')
|
||||
// Who applied it (NULL until applied).
|
||||
.addColumn('suggestion_applied_by_id', 'uuid', (col) =>
|
||||
col.references('users.id').onDelete('set null'),
|
||||
)
|
||||
.execute();
|
||||
}
|
||||
|
||||
export async function down(db: Kysely<any>): Promise<void> {
|
||||
await db.schema
|
||||
.alterTable('comments')
|
||||
.dropColumn('suggested_text')
|
||||
.dropColumn('suggestion_applied_at')
|
||||
.dropColumn('suggestion_applied_by_id')
|
||||
.execute();
|
||||
}
|
||||
+3
@@ -173,6 +173,9 @@ export interface Comments {
|
||||
resolvedSource: string | null;
|
||||
selection: string | null;
|
||||
spaceId: string;
|
||||
suggestedText: string | null;
|
||||
suggestionAppliedAt: Timestamp | null;
|
||||
suggestionAppliedById: string | null;
|
||||
type: string | null;
|
||||
updatedAt: Generated<Timestamp>;
|
||||
workspaceId: string;
|
||||
|
||||
Reference in New Issue
Block a user