Skip to content

Commit b2fb131

Browse files
Drop the legacy comment tables and the backend module that served them
The submissions system (form_configs/submissions/submissions_content) and comments.district_notes replaced everything these did. - Alembic d8f1b52c96e3 drops comments.{document_comment, comment_tag, comment, tag, commenter}, the review_status_enum type, and the slugify_tag/normalize_email UDFs. Zone rows were copied into district_notes earlier (b3d9f47a25c1); form comments are dropped without migration by decision. Downgrade raises — restore from backup. - backend/app/comments is deleted: the piecemeal create endpoints, /submit, both admin lists, /admin/review, the review_tags enforcement, and /flag (replaced by /api/submissions/flag). The historical f57e30842bde migration inlines the enum values it used to import. - The gallery tag filter reads only comments.submissions now. - Tests: test_comments.py retired with the module; the auth contract pins the teams claim instead of review_tags; the connection-pool regression check moved to moderate_note_by_id; test_main's gallery test submits through /api/submissions. - Frontend: legacy comment/commenter wire types pruned. Deploy last, after confirming no traffic on the old endpoints. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent c0bb50f commit b2fb131

17 files changed

Lines changed: 111 additions & 3218 deletions

app/src/app/utils/api/apiHandlers/types.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -173,28 +173,11 @@ export type MapGroup = {
173173
slug: string;
174174
};
175175

176-
export interface CommentCreate {
177-
title: string;
178-
comment: string;
179-
commenter_id: number | null;
180-
document_id: string | null;
181-
}
182-
183176
export interface CommentPublic {
184177
created_at: string | null;
185178
updated_at: string | null;
186179
}
187180

188-
export interface CommenterCreate {
189-
first_name: string;
190-
email: string;
191-
salutation: string | null;
192-
last_name: string | null;
193-
place: string | null;
194-
state: string | null;
195-
zip_code: string | null;
196-
}
197-
198181
export interface CommenterPublic {
199182
created_at: string | null;
200183
updated_at: string | null;
@@ -208,19 +191,6 @@ export interface TagCreate {
208191
tag: string;
209192
}
210193

211-
export interface FullCommentForm {
212-
comment: CommentCreate;
213-
commenter: CommenterCreate;
214-
tags: TagCreate[];
215-
turnstile_token: string;
216-
}
217-
218-
export interface FullCommentFormResponse {
219-
comment: CommentPublic;
220-
commenter: CommenterPublic;
221-
tags: TagPublic[];
222-
}
223-
224194
export interface Overlay {
225195
overlay_id: string;
226196
name: string;

backend/app/alembic/env.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@
1818
DistrictUnions,
1919
)
2020
from app.save_share.models import MapDocumentToken
21-
from app.comments.models import (
22-
Comment,
23-
Commenter,
24-
Tag,
25-
CommentTag,
26-
DocumentComment,
27-
)
2821
from app.district_notes import DistrictNote
2922
from app.evaluation.models import Evaluation
3023
from app.submissions.models import FormConfig, Submission, SubmissionContent
@@ -48,11 +41,6 @@
4841
Document,
4942
MapDocumentUserSession,
5043
MapDocumentToken,
51-
Comment,
52-
Commenter,
53-
Tag,
54-
CommentTag,
55-
DocumentComment,
5644
DistrictNote,
5745
FormConfig,
5846
Submission,
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
"""Drop the legacy comment tables
2+
3+
The flexible submissions schema (c7e2a94d81f5) and district_notes
4+
(b3d9f47a25c1) replaced everything these tables did; the backend module that
5+
served them (app/comments) is deleted in the same change. Zone rows were
6+
copied into district_notes by b3d9f47a25c1; form comments/commenters/tags are
7+
dropped without migration by decision.
8+
9+
Irreversible: downgrade raises. Restore from a backup if this ever needs
10+
undoing.
11+
12+
Revision ID: d8f1b52c96e3
13+
Revises: c7e2a94d81f5
14+
Create Date: 2026-08-25
15+
16+
"""
17+
18+
from typing import Sequence, Union
19+
20+
from alembic import op
21+
import sqlalchemy as sa
22+
23+
# revision identifiers, used by Alembic.
24+
revision: str = "d8f1b52c96e3"
25+
down_revision: Union[str, None] = "c7e2a94d81f5"
26+
branch_labels: Union[str, Sequence[str], None] = None
27+
depends_on: Union[str, Sequence[str], None] = None
28+
29+
30+
def upgrade() -> None:
31+
op.drop_table("document_comment", schema="comments")
32+
op.drop_table("comment_tag", schema="comments")
33+
op.drop_table("comment", schema="comments")
34+
op.drop_table("tag", schema="comments")
35+
op.drop_table("commenter", schema="comments")
36+
op.execute(sa.text("DROP TYPE IF EXISTS comments.review_status_enum"))
37+
op.execute(sa.text("DROP FUNCTION IF EXISTS slugify_tag(TEXT)"))
38+
# normalize_email's trigger went down with the commenter table.
39+
op.execute(sa.text("DROP FUNCTION IF EXISTS normalize_email()"))
40+
41+
42+
def downgrade() -> None:
43+
raise NotImplementedError(
44+
"The legacy comment tables are gone for good — restore from a backup."
45+
)

backend/app/alembic/versions/f57e30842bde_comment_moderation.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,19 @@
1010

1111
from alembic import op
1212
import sqlalchemy as sa
13-
from app.comments.models import ReviewStatus
1413

1514
# revision identifiers, used by Alembic.
1615
revision: str = "f57e30842bde"
1716
down_revision: Union[str, None] = "55cc04197c66"
1817
branch_labels: Union[str, Sequence[str], None] = None
1918
depends_on: Union[str, Sequence[str], None] = None
2019

20+
# Inlined (the app-side ReviewStatus enum was deleted with the legacy
21+
# comment tables; this historical migration must stay runnable).
2122
review_status_enum = sa.Enum(
22-
ReviewStatus,
23+
"REVIEWED",
24+
"APPROVED",
25+
"REJECTED",
2326
name="review_status_enum",
2427
schema="comments",
2528
native_enum=True,

backend/app/comments/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)