Database Migrations
All migrations are in apps/api/prisma/migrations/. Run with pnpm db:migrate. Never use prisma db push in production.
Migration History (75 migrations)
Newest last. Generated from ls apps/api/prisma/migrations/; descriptions inferred from each migration.sql.
| # | Migration | Description |
|---|---|---|
| 1 | 20260520173158_init | Initial schema: users, invite_codes |
| 2 | 20260520184824_add_password_hash | Add password_hash to users |
| 3 | 20260520200000_interests_hierarchy | interests_catalog, user_interests with level hierarchy |
| 4 | 20260520210000_invite_tree | invite_tree_nodes with ltree-style path + depth |
| 5 | 20260520220000_social_circles | circles, circle_members |
| 6 | 20260520230000_reputation | reputation_events, reputation_snapshots |
| 7 | 20260520240000_messaging | conversations, conversation_members, messages |
| 8 | 20260520250000_ai_assistant | assistant_sessions, assistant_turns |
| 9 | 20260520260000_notifications | notifications, notification_preferences |
| 10 | 20260520270000_posts | posts, post_reactions, post_bookmarks |
| 11 | 20260521120000_media_assets | media_assets with presigned upload pattern |
| 12 | 20260522180000_admin_layer | audit_log, reports, admin-facing columns |
| 13 | 20260523100000_discovery_and_interest_meta | connection_intents, interest accent_color/path |
| 14 | 20260523120000_audit_log | Audit log performance indexes |
| 15 | 20260523140000_post_replies | post_replies table |
| 16 | 20260523150000_post_repost | quoted_post_id on posts; repost + quote formats |
| 17 | 20260523160000_post_mutes | post_mutes table |
| 18 | 20260523170000_message_reactions | message_reactions table |
| 19 | 20260523180000_convo_mute | muted_at on conversation_members |
| 20 | 20260523190000_user_mute_and_post_lifecycle | user_mutes, hidden_at/deleted_at on posts |
| 21 | 20260523200000_post_schedule_emit_and_mentions | publish_at, scheduled_emitted_at on posts |
| 22 | 20260523210000_blocks_and_reports | user_blocks, reports table |
| 23 | 20260523220000_password_reset | password_resets table |
| 24 | 20260523230000_muted_keywords | muted_keywords table |
| 25 | 20260524100000_push_tokens | push_tokens table |
| 26 | 20260526000000_audit_perf_indexes | Composite indexes on audit_log |
| 27 | 20260526200000_post_reply_kind | kind on post_replies (reaction/criticism/contribution) |
| 28 | 20260526210000_circle_invitations | circle_invitations (bidirectional consent) |
| 29 | 20260526220000_reputation_votes | reputation_votes (peer ±1 voting) |
| 30 | 20260526260000_feature_flags | feature_flags with known flag seeds |
| 31 | 20260526270000_personas | personas (max 5 per user) |
| 32 | 20260526280000_assistant_suggestions | assistant_suggestions + map-interests flow |
| 33 | 20260526290000_emoji_economy | emoji_wallets, emoji_payments (EmojiPay) |
| 34 | 20260526300000_post_depth | depth on posts (0..5 content depth) |
| 35 | 20260526310000_post_interests | post_interests junction (multi-interest tagging) |
| 36 | 20260526320000_contribution_score | contribution_events, contribution_snapshots |
| 37 | 20260526330000_post_boost | post_boosts + boost_score/boost_expires_at |
| 38 | 20260527000000_wiki | wiki_entries, wiki_proposals, wiki_votes |
| 39 | 20260527010000_post_views | views counter on posts |
| 40 | 20260527020000_user_follows | user_follows (follow graph) |
| 41 | 20260527030000_post_pinned | pinned_at on posts (max 3 per author) |
| 42 | 20260527040000_post_series | post_series, post_series_items |
| 43 | 20260527050000_post_journalism | is_journalism flag on posts + rep gate |
| 44 | 20260527050100_series_follows | series_follows table |
| 45 | 20260527060000_reputation_appeals | reputation_appeals + partial unique index |
| 46 | 20260527070000_interest_depth_3 | Interest level extended to 3 (depth-3 catalog) |
| 47 | 20260527080000_post_co_authors | post_co_authors (co-authorship + mana split) |
| 48 | 20260528000000_wiki_proposal_status_index | Composite (interest_id, status) on wiki_proposals |
| 49 | 20260528173000_post_persona_fk | FK posts.persona_id → personas.id |
| 50 | 20260529100000_groups | Groups context (ADR-005): groups, members, join requests |
| 51 | 20260529110000_post_group_id | Optional group_id on posts (group-scoped) |
| 52 | 20260529120000_group_invites | group_invites (manager-initiated) |
| 53 | 20260529130000_guilds | Guilds context (ADR-006): merit-gated communities |
| 54 | 20260529190000_guilds_governance | guild_proposals + guild_votes |
| 55 | 20260529210000_guilds_weighted_votes | Rep-weighted guild voting |
| 56 | 20260529220000_pgvector | Enable pgvector extension |
| 57 | 20260529230000_posts_search_gin | Posts full-text tsvector + GIN index |
| 58 | 20260603000000_events | #Events context — gatherings + RSVP |
| 59 | 20260603010000_deliberation | Deliberation: #Debates + #Problem |
| 60 | 20260603020000_education | Education: courses → lessons + enrolment |
| 61 | 20260603030000_marketplace | Marketplace: offerings, market_orders, append-only ledger |
| 62 | 20260603040000_guild_treasury | guild_treasuries + append-only guild_ledger_entries |
| 63 | 20260603050000_post_translations | Cached on-demand post translations |
| 64 | 20260604000000_projects | #Projects — collaborative creation |
| 65 | 20260604010000_video_visits | #VideoVisit — 60s video cards |
| 66 | 20260604020000_user_emblem | #Art — symbolic profile emblem on users |
| 67 | 20260604030000_content_removed | Admin removed_at soft-remove for Wave 3–6 content |
| 68 | 20260604040000_flashcards | #Education lesson flashcards |
| 69 | 20260604050000_audio_posts | #AudioPost — voice/audio notes per interest |
| 70 | 20260606000000_activitypub_v1 | ActivityPub (ADR-008): user keypairs + remote followers |
| 71 | 20260606010000_activitypub_inbound | AP inbound: follow remote actors + cache their posts |
| 72 | 20260606020000_video_social | VideoVisit reactions, reposts, comments |
| 73 | 20260607000000_user_last_seen | Presence: last_seen_at for online/last-seen indicator |
| 74 | 20260607020000_polls | Single-choice poll attached to a post |
| 75 | 20260608000000_reputation_snapshot_interest_index | Covering (interest_id, value) index for the leaderboard (audit) |
Running Migrations
bash
# Run all pending migrations
pnpm db:migrate
# Generate a new migration (dev only)
cd apps/api && npx prisma migrate dev --name <name>
# Deploy to production
npx prisma migrate deployNever:
prisma db pushin production (skips migration history).- Hand-edit migration SQL after it's been committed.
- DELETE rows from
_prisma_migrations.