This commit is contained in:
@@ -19,7 +19,24 @@ export default defineSchema({
|
||||
joinSoundStorageId: v.optional(v.id("_storage")),
|
||||
accentColor: v.optional(v.string()),
|
||||
bannerStorageId: v.optional(v.id("_storage")),
|
||||
}).index("by_username", ["username"]),
|
||||
// Discord backup import support. `discordId` lets us dedupe
|
||||
// ghost creation across re-runs and later "claim" an identity
|
||||
// by attaching the snowflake to a real user. `isGhost` marks a
|
||||
// placeholder profile created to attribute imported messages
|
||||
// when the original Discord user hasn't been mapped to a real
|
||||
// local user yet — ghosts can't log in (their auth material is
|
||||
// random junk) and are filtered out of member / presence /
|
||||
// mention lookups.
|
||||
discordId: v.optional(v.string()),
|
||||
isGhost: v.optional(v.boolean()),
|
||||
// URL-based avatar fallback for ghosts — we copy Discord's CDN
|
||||
// URL rather than re-hosting, since the ghost might never be
|
||||
// merged and uploading 35+ avatars-that-might-expire isn't
|
||||
// worth the storage churn. `null`/missing on real users, who
|
||||
// use `avatarStorageId` instead.
|
||||
ghostAvatarUrl: v.optional(v.string()),
|
||||
}).index("by_username", ["username"])
|
||||
.index("by_discord_id", ["discordId"]),
|
||||
|
||||
categories: defineTable({
|
||||
name: v.string(),
|
||||
@@ -45,9 +62,22 @@ export default defineSchema({
|
||||
replyTo: v.optional(v.id("messages")),
|
||||
editedAt: v.optional(v.number()),
|
||||
pinned: v.optional(v.boolean()),
|
||||
// Discord backup import fields. `importedCreatedAt` preserves
|
||||
// the original Discord timestamp so imports land in the right
|
||||
// place in channel history — the renderer prefers it over
|
||||
// `_creationTime` when present. `discordMessageId` is the
|
||||
// snowflake used for dedupe on re-runs + remapping Discord
|
||||
// reply-to IDs to Convex message IDs. `isImported` is a cheap
|
||||
// flag for UI badges and future filters.
|
||||
importedCreatedAt: v.optional(v.number()),
|
||||
discordMessageId: v.optional(v.string()),
|
||||
isImported: v.optional(v.boolean()),
|
||||
}).index("by_channel", ["channelId"])
|
||||
.index("by_channel_pinned", ["channelId", "pinned"])
|
||||
.index("by_sender", ["senderId"]),
|
||||
.index("by_sender", ["senderId"])
|
||||
.index("by_channel_imported_at", ["channelId", "importedCreatedAt"])
|
||||
.index("by_discord_message_id", ["discordMessageId"])
|
||||
.index("by_channel_discord_message_id", ["channelId", "discordMessageId"]),
|
||||
|
||||
messageReactions: defineTable({
|
||||
messageId: v.id("messages"),
|
||||
|
||||
Reference in New Issue
Block a user