Rename the unified post date field.
CI / test (pull_request) Successful in 6m16s

Use post_date throughout the new schema while retaining hunt_date only as the legacy migration source.
This commit is contained in:
2026-08-27 00:03:10 -07:00
parent 007fcd0991
commit c6b5d6a456
4 changed files with 18 additions and 18 deletions
+5 -5
View File
@@ -117,9 +117,9 @@ VALUES ('homeowner', 'question-1', 1);`); err != nil {
}
var rootParent sql.NullString
var rootAuthor, title, rootBody, city, huntDate, rootCreated, rootUpdated string
var rootAuthor, title, rootBody, city, postDate, rootCreated, rootUpdated string
if err := conn.QueryRowContext(ctx, `
SELECT parent_id, author_id, title, body, city, hunt_date, created_at, updated_at
SELECT parent_id, author_id, title, body, city, post_date, created_at, updated_at
FROM posts
WHERE id = 'question-1'`).Scan(
&rootParent,
@@ -127,7 +127,7 @@ WHERE id = 'question-1'`).Scan(
&title,
&rootBody,
&city,
&huntDate,
&postDate,
&rootCreated,
&rootUpdated,
); err != nil {
@@ -138,7 +138,7 @@ WHERE id = 'question-1'`).Scan(
title != "Leaky sink" ||
rootBody != "It drips." ||
city != "Oakland" ||
huntDate != "2026-08-26" ||
postDate != "2026-08-26" ||
rootCreated != "2026-08-26T08:00:00Z" ||
rootUpdated != rootCreated {
t.Fatalf("unexpected root post")
@@ -177,7 +177,7 @@ WHERE user_id = 'homeowner' AND post_id = 'question-1'`).Scan(&voteValue); err !
if _, err := conn.ExecContext(ctx, `
INSERT INTO posts (
id, parent_id, author_id, title, body, city, hunt_date, hidden, created_at, updated_at
id, parent_id, author_id, title, body, city, post_date, hidden, created_at, updated_at
) VALUES (
'invalid-reply', 'question-1', 'homeowner', 'Replies cannot have titles', 'Body', '', '', 0, 'now', 'now'
)`); err == nil {