Skip to content

Database Migrations

All migrations are in apps/api/prisma/migrations/. Run with pnpm db:migrate. Never use prisma db push in production.


Migration History (48 migrations)

#MigrationDateDescription
120260520173158_init2026-05-20Initial schema: users, invite_codes
220260520184824_add_password_hash2026-05-20Add password_hash column to users
320260520200000_interests_hierarchy2026-05-20interests_catalog, user_interests with hierarchy + level
420260520210000_invite_tree2026-05-20invite_tree_nodes with ltree-style path + depth
520260520220000_social_circles2026-05-20circles, circle_members
620260520230000_reputation2026-05-20reputation_events, reputation_snapshots
720260520240000_messaging2026-05-20conversations, conversation_members, messages
820260520250000_ai_assistant2026-05-20assistant_sessions, assistant_turns
920260520260000_notifications2026-05-20notifications, notification_preferences
1020260520270000_posts2026-05-20posts, post_reactions, post_bookmarks
1120260521120000_media_assets2026-05-21media_assets with presigned upload pattern
1220260522180000_admin_layer2026-05-22audit_log, reports, admin-facing columns
1320260523100000_discovery_and_interest_meta2026-05-23connection_intents, interest accentColor and path fields
1420260523120000_audit_log2026-05-23Audit log performance indexes
1520260523140000_post_replies2026-05-23post_replies table
1620260523150000_post_repost2026-05-23quoted_post_id on posts; repost + quote formats
1720260523160000_post_mutes2026-05-23post_mutes table
1820260523170000_message_reactions2026-05-23message_reactions table
1920260523180000_convo_mute2026-05-23mutedAt on conversation_members
2020260523190000_user_mute_and_post_lifecycle2026-05-23user_mutes, hidden_at/deleted_at on posts
2120260523200000_post_schedule_emit_and_mentions2026-05-23publish_at, scheduled_emitted_at on posts
2220260523210000_blocks_and_reports2026-05-23user_blocks, reports table
2320260523220000_password_reset2026-05-23password_resets table
2420260523230000_muted_keywords2026-05-23muted_keywords table
2520260524100000_push_tokens2026-05-24push_tokens table
2620260526000000_audit_perf_indexes2026-05-26Composite indexes on audit_log for fast admin queries
2720260526200000_post_reply_kind2026-05-26kind column on post_replies: reaction/criticism/contribution
2820260526210000_circle_invitations2026-05-26circle_invitations table (bidirectional consent flow)
2920260526220000_reputation_votes2026-05-26reputation_votes table (peer ±1 voting)
3020260526260000_feature_flags2026-05-26feature_flags table with known flag seeds
3120260526270000_personas2026-05-26personas table (user personas, max 5)
3220260526280000_assistant_suggestions2026-05-26assistant_suggestions table + map-interests flow
3320260526290000_emoji_economy2026-05-26emoji_wallets, emoji_payments (EmojiPay)
3420260526300000_post_depth2026-05-26depth column on posts (0..5 content depth)
3520260526310000_post_interests2026-05-26post_interests junction for multi-interest tagging
3620260526320000_contribution_score2026-05-26contribution_events, contribution_snapshots
3720260526330000_post_boost2026-05-26post_boosts table + boost_score/boost_expires_at on posts
3820260527000000_series_follows2026-05-27series_follows table
3920260527000000_wiki2026-05-27wiki_entries, wiki_proposals, wiki_votes
4020260527010000_post_views2026-05-27views counter on posts
4120260527020000_user_follows2026-05-27user_follows table (follow graph)
4220260527030000_post_pinned2026-05-27pinned_at on posts (max 3 per author)
4320260527040000_post_series2026-05-27post_series, post_series_items tables
4420260527050000_post_journalism2026-05-27is_journalism flag on posts + rep gate
4520260527060000_reputation_appeals2026-05-27reputation_appeals table + partial unique index
4620260527070000_interest_depth_32026-05-27Interest level extended to 3 (depth-3 catalog)
4720260527080000_post_co_authors2026-05-27post_co_authors table (co-authorship + mana split)
48(ongoing)Future migrations follow the same naming convention

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 deploy

Never:

  • prisma db push in production (skips migration history).
  • Hand-edit migration SQL after it's been committed.
  • DELETE rows from _prisma_migrations.

Regulus — invite-only social-knowledge platform