Skip to content

refactor(db): rename profiles entity to authors - #215

Merged
fennifith merged 1 commit into
playfulprogramming:mainfrom
bbornino:feature/210-standardize-author-naming
Sep 3, 2026
Merged

refactor(db): rename profiles entity to authors#215
fennifith merged 1 commit into
playfulprogramming:mainfrom
bbornino:feature/210-standardize-author-naming

Conversation

@bbornino

@bbornino bbornino commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Closes #210

What changed

Standardizes on "author" instead of "profiles" across the schema, relations, routes, and worker job payloads. The two names were being used interchangeably for the same entity — this makes author the single name everywhere.

  • DB schema (packages/db/src/schema/profiles.tsauthors.ts): profiles table → authors, profile_achievements table → author_achievements, profile_slug column → author_slug on both author_achievements and author_roles.
  • Relations (packages/db/src/relations.ts): all r.profiles/r.profileAchievements references renamed to match.
  • Routes: merged GET /content/profiles (list) and GET /content/authors/:slug (single) into one file, apps/api/src/routes/content/authors.ts, exposing both under /content/authors. profiles.ts is deleted; createApp.ts updated to register a single authorsRoutes.
  • Worker: sync-author, sync-post, sync-collection, and grant-author-achievements processors updated for the renamed tables/columns.
  • Job payload: GrantAuthorAchievementsInput.profileSlugauthorSlug (see Deploy note below).
  • Test fixtures: packages/test-fixtures/src/db-mock.ts updated to mock authors/authorAchievements.
  • Tests updated to match; profiles.test.ts merged into authors.test.ts alongside the list-route tests.

Migration

profiles and profile_achievements are live production tables, so this was not a drop-and-recreate. The generated migration (packages/db/drizzle/20260902153554_hot_leech/migration.sql) is four ALTER TABLE statements only, confirmed via drizzle-kit's interactive rename prompts (not a diff-and-guess):

ALTER TABLE "profile_achievements" RENAME TO "author_achievements";
ALTER TABLE "profiles" RENAME TO "authors";
ALTER TABLE "author_achievements" RENAME COLUMN "profile_slug" TO "author_slug";
ALTER TABLE "author_roles" RENAME COLUMN "profile_slug" TO "author_slug";

No data is dropped or recreated.

Explicitly out of scope

profileImage (DB column), profileImageUrl (API response field), and the author-image S3 key prefix (profiles/${authorId}.jpeg) are intentionally left unchanged. These describe the image itself, not the profiles-vs-authors entity naming this issue is about — renaming them would touch the public API response shape (client-facing, needs a coordinated frontend change) and raise an S3 key migration question that #210 doesn't cover. Flagging for a separate issue if the team wants that follow-up.

Deploy note: in-flight job payload change

The GRANT_AUTHOR_ACHIEVEMENTS job payload shape changed from { profileSlug } to { authorSlug }. Any jobs already sitting in the Redis queue at deploy time were enqueued with the old profileSlug key and won't have authorSlug populated — they'll fail (or silently no-op, depending on how the field is read) until the queue is drained past the deploy boundary. Worth either draining the GRANT_AUTHOR_ACHIEVEMENTS queue before deploying, or manually re-running any jobs still pending afterward.

Testing

- pnpm test:unit — clean
- pnpm run build:all (matches CI's unit-tests workflow build step) — clean
- pnpm prettier (check mode) — clean

Standardizes on "author" instead of "profiles" across the schema,
relations, routes, and worker job payloads (playfulprogramming#210). The profiles and
profile_achievements tables and their profile_slug columns are
renamed via ALTER TABLE, not dropped and recreated. Merges the
separate /content/profiles list route into /content/authors,
combining it with the existing single-author route in one file.
profileImage/profileImageUrl and the author-image S3 key prefix are
intentionally left unchanged, since they describe the image rather
than the profiles-vs-authors naming this issue is about.
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 8976e68e-a06e-4c9e-854b-77efe211f1c3


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@fennifith
fennifith added this pull request to the merge queue Sep 3, 2026
Merged via the queue into playfulprogramming:main with commit 7383f90 Sep 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standardize author endpoint/table/column names

2 participants