Esposter
    Preparing search index...

    Module @esposter/db-schema - v2.36.0

    @esposter/db-schema

    Apache-2.0 licensed

    Drizzle ORM schemas, relations, and migrations for Esposter's PostgreSQL database. The source of truth for all relational data — usable in both browser and server environments.


    We highly recommend you take a look at the documentation to level up.

    After editing a schema file, generate and apply the migration:

    # From packages/db-schema/
    pnpm db:gen # generate migration SQL from schema changes
    pnpm db:up # apply pending migrations to the database
    pnpm db:studio # open Drizzle Studio UI for visual inspection

    Migrations are output to packages/app/server/db/migrations/.

    Domain Tables Description
    Users users, sessions, accounts Authentication via better-auth
    Rooms rooms, roomMembers, roomRoles, roomInvites, roomBans Chat rooms + RBAC
    Messages messages (schema: message) Message metadata; content in Azure Table Storage
    Posts posts, postReactions Social feed posts
    Achievements achievements, userAchievements Gamification
    Push pushSubscriptions Web Push notification subscriptions
    Friends friendships, friendRequests Social graph
    • Use the pgTable wrapper (re-exported from this package), not raw drizzle pgTable — the wrapper adds standard metadata columns.
    • Columns use camelCase property names matching TypeScript properties.
    • All z.discriminatedUnion schemas must end with satisfies z.ZodType<UnionType>.
    • Each model file holds exactly one interface/class and one schema.

    Run from packages/db-schema/:

    pnpm db:gen       # generate migration
    pnpm db:up # apply migrations
    pnpm db:studio # Drizzle Studio
    pnpm build # compile to dist/
    pnpm test # vitest watch mode
    pnpm lint:fix # auto-fix lint
    pnpm typecheck # type check

    This project is licensed under the Apache-2.0 license.

    AdminActionType
    AzureContainer
    AzureEntityType
    AzureFunction
    AzureQueue
    AzureTable
    AzureWebPubSubHub
    BinaryOperator
    ClickerAchievementName
    DatabaseEntityType
    DerivedDatabaseEntityType
    DungeonsAchievementName
    EmailAchievementName
    FilterType
    FilterTypeHas
    FlowchartAchievementName
    LikeAchievementName
    MessageAchievementName
    MessageCreationRejectionType
    MessageMetadataType
    MessageType
    MimeCategory
    NoiseSuppressionMode
    NotificationType
    PostAchievementName
    ResourceActivityType
    ResourceType
    RoomAchievementName
    RoomType
    ScheduledMessageJobType
    SearchIndex
    SearchOperator
    SpecialAchievementName
    SurveyAchievementName
    SurveyResponseMode
    TableAchievementName
    UnaryOperator
    UserStatus
    VoiceInputMode
    WebpageAchievementName
    WordFilterAction
    AzureMetadataEntity
    BaseMessageEntity
    CompositeKey
    CompositeKeyEntity
    FileEntity
    MessageMetadataEntity
    ModerationLogEntity
    ModerationNoteEntity
    ProgramParticipantEntity
    ResourceActivityEntity
    ResourceViewEntity
    StandardMessageEntity
    SurveyResponseEntity
    WebhookMessageEntity
    AzureTableEntityMap
    BaseLinkPreviewResponse
    CompositeKeyEntityConstraint
    DefaultLinkPreviewResponse
    Embed
    EmbedAuthor
    EmbedField
    EmbedFooter
    FileSasEntity
    Filter
    FriendRequestNotificationEventGridData
    NotificationOptions
    PgTable
    PushNotificationEventGridData
    ReminderScheduledMessageJobPayload
    ScheduledMessageScheduledMessageJobPayload
    SearchIndexDocumentMap
    ThreadReplyNotificationEventGridData
    URLLinkPreviewResponse
    Video
    WebhookCreateMessageInput
    WebhookPayload
    Achievement
    AchievementName
    AppUserInMessage
    AzureEntity
    AzureUpdateEntity
    BanInMessage
    BanInMessageWithRelations
    BlobDeletionEventGridData
    Block
    CallSessionInMessage
    Clause
    CreateMessageInput
    CustomTableClient
    EntityTypeKey
    EventGridEventInput
    Friend
    FriendRequest
    FriendRequestWithRelations
    InviteInMessage
    Like
    LinkPreviewResponse
    MessageEntity
    MessageEntityMap
    Post
    PostWithRelations
    Resource
    ResourceFavorite
    ResourcePublication
    ResourceTags
    RoomCategoryInMessage
    RoomFilterInMessage
    RoomInMessage
    RoomPermission
    RoomRoleInMessage
    ScheduledMessageJobInMessage
    ScheduledMessageJobPayload
    ScheduledMessageJobQueueMessage
    SearchHistoryInMessage
    SerializableValue
    ServerCreateMessageInput
    StandardCreateMessageInput
    StandardMessageType
    ThreadFollowInMessage
    TodoReminderQueueMessage
    User
    UserAchievement
    UserAchievementWithRelations
    UserSettingsInMessage
    UserStatusInMessage
    UserToRoomInMessage
    UserToRoomInMessageWithRelations
    UserToRoomRoleInMessage
    UserToRoomRoleInMessageWithRelations
    WebhookInMessage
    accounts
    accountsRelation
    AchievementName
    achievementNameEnum
    AchievementNames
    achievements
    achievementsRelation
    AdminActionTypes
    adminActionTypeSchema
    APP_USER_NAME_MAX_LENGTH
    appUsersInMessage
    appUsersInMessageRelation
    AUTOMOD_USER_ID
    AZURE_FUNCTION_FAILED_LOG_MESSAGE_SUFFIX
    AZURE_MAX_BATCH_SIZE
    AZURE_MAX_PAGE_SIZE
    AZURE_SELF_DESTRUCT_TIMER
    AzureContainerPropertiesMap
    AzureEntity
    azureFunctionSchema
    bansInMessage
    bansInMessageRelation
    baseMessageEntitySchema
    BinaryOperators
    BLOB_SEGMENT_MAX_LENGTH
    BLOB_SEGMENT_REGEX
    blobDeletionEventGridDataSchema
    BlockRelations
    blocks
    blocksRelation
    CALL_ID_LENGTH
    CALL_ID_REGEX
    callSessionIdSchema
    callSessionsInMessage
    callSessionsInMessageRelation
    CompositeKeyPropertyNames
    dayjs
    DEAD_LETTER_ARCHIVED_PREFIX
    DEAD_LETTER_BLOB_SUBJECT_PREFIX
    DEAD_LETTER_QUARANTINE_PREFIX
    DEAD_LETTER_QUARANTINED_LOG_MESSAGE_SUFFIX
    DEFAULT_AUTO_IDLE_THRESHOLD_MS
    DEFAULT_INPUT_SENSITIVITY_DECIBELS
    DEFAULT_MICROPHONE_VOLUME_PERCENTAGE
    DEFAULT_PUSH_TO_TALK_RELEASE_DELAY_MS
    DEFAULT_SPEAKER_VOLUME_PERCENTAGE
    embedAuthorSchema
    embedFieldSchema
    embedFooterSchema
    embedSchema
    EVENT_GRID_DATA_VERSION
    FILE_MAX_LENGTH
    FileEntityPropertyNames
    fileEntitySchema
    FILENAME_MAX_LENGTH
    FILTER_KEY_MAX_LENGTH
    FILTER_WORDS_MAX_LENGTH
    filterSchema
    FilterTypeHases
    FilterTypes
    filterTypeSchema
    friendRequestNotificationEventGridDataSchema
    FriendRequestRelations
    friendRequests
    friendRequestsRelation
    friends
    friendsRelation
    INVITE_ID_LENGTH
    INVITE_ID_REGEX
    InviteInMessageRelations
    invitesInMessage
    invitesInMessageRelation
    IsIdempotentAzureFunctionMap
    likes
    likesRelation
    MAX_AUTO_IDLE_THRESHOLD_MS
    MAX_BLOB_BATCH_DELETIONS
    MAX_BLOB_DELETION_EVENT_BLOB_NAMES
    MAX_BLOB_DELETION_EVENT_DATA_BYTES
    MAX_CONCURRENT_BLOB_COPIES
    MAX_CONCURRENT_BLOB_DELETIONS
    MAX_EVENT_GRID_PUBLISH_BYTES
    MAX_EVENT_GRID_PUBLISH_EVENT_COUNT
    MAX_FOLLOWED_THREADS
    MAX_INPUT_SENSITIVITY_DECIBELS
    MAX_PUSH_TO_TALK_RELEASE_DELAY_MS
    MAX_TAG_NAME_LENGTH
    MAX_TAG_VALUE_LENGTH
    MAX_TAGS_COUNT
    MAX_TIMEOUT_DURATION_MS
    MAX_USER_VOLUME_PERCENTAGE
    MENTION_MAX_LENGTH
    MESSAGE_MAX_LENGTH
    MessageEntityMap
    messageSchema
    MessageTypes
    metadataSchema
    mimeCategoryEnum
    mimeCategorySchema
    MIN_AUTO_IDLE_THRESHOLD_MS
    MIN_INPUT_SENSITIVITY_DECIBELS
    MIN_PUSH_TO_TALK_RELEASE_DELAY_MS
    MODERATION_NOTE_MAX_LENGTH
    ModerationLogEntityPropertyNames
    moderationLogEntitySchema
    ModerationNoteEntityPropertyNames
    moderationNoteEntitySchema
    NICKNAME_MAX_LENGTH
    noiseSuppressionModeEnum
    notificationOptionsSchema
    notificationTypeEnum
    notificationTypeSchema
    pgTable
    POST_DESCRIPTION_MAX_LENGTH
    POST_TITLE_MAX_LENGTH
    PostRelations
    posts
    postsRelation
    programParticipantEntitySchema
    PUSH_NOTIFICATION_MESSAGE_MAX_LENGTH
    pushNotificationEventGridDataSchema
    pushSubscriptionsInMessage
    pushSubscriptionsInMessageRelation
    rateLimiterFlexible
    READ_SAS_DURATION_MS
    READ_SAS_REFRESH_INTERVAL_MS
    RECYCLE_BIN_RETENTION_DAYS
    RECYCLE_BIN_RETENTION_MS
    relations
    reminderScheduledMessageJobPayloadSchema
    RESOURCE_NAME_MAX_LENGTH
    ResourceActivityEntityPropertyNames
    resourceActivityEntitySchema
    resourceActivityTypeSchema
    resourceFavorites
    resourceFavoritesRelation
    ResourceOwnedTablesMap
    resourcePublications
    resourcePublicationsRelation
    resources
    resourcesRelation
    resourceTagsSchema
    resourceTypeEnum
    ResourceTypes
    resourceTypeSchema
    resourceViewEntitySchema
    ROOM_CATEGORY_NAME_MAX_LENGTH
    ROOM_NAME_MAX_LENGTH
    ROOM_ROLE_COLOR_MAX_LENGTH
    ROOM_ROLE_NAME_MAX_LENGTH
    ROOM_TOPIC_MAX_LENGTH
    roomCategoriesInMessage
    roomCategoriesInMessageRelation
    roomFiltersInMessage
    roomFiltersInMessageRelation
    roomIdSchema
    roomIdsSchema
    RoomPermission
    roomRolesInMessage
    roomRolesInMessageRelation
    roomsInMessage
    roomsInMessageRelation
    roomTypeEnum
    roomTypeSchema
    sanitizedMessageSchema
    scheduledMessageJobPayloadSchema
    scheduledMessageJobQueueMessageSchema
    scheduledMessageJobsInMessage
    scheduledMessageJobsInMessageRelation
    scheduledMessageScheduledMessageJobPayloadSchema
    schema
    searchHistoriesInMessage
    searchHistoriesInMessageRelation
    SearchIndexSearchableFieldsMap
    selectAppUserInMessageSchema
    selectBanInMessageSchema
    selectCallSessionInMessageSchema
    selectCommentSchema
    selectInviteInMessageSchema
    selectLikeSchema
    selectPostSchema
    selectResourceFavoriteSchema
    selectResourceSchema
    selectRoomCategoryInMessageSchema
    selectRoomFilterInMessageSchema
    selectRoomInMessageSchema
    selectRoomRoleInMessageSchema
    selectScheduledMessageJobInMessageSchema
    selectSearchHistoryInMessageSchema
    selectThreadFollowInMessageSchema
    selectUserSchema
    selectUserSettingsInMessageSchema
    selectUserStatusInMessageSchema
    selectUserToRoomInMessageSchema
    selectWebhookInMessageSchema
    SERIALIZABLE_VALUE_MAX_LENGTH
    serializableValueSchema
    sessions
    sessionsRelation
    standardCreateMessageInputSchema
    StandardMessageEntityPropertyNames
    standardMessageEntitySchema
    standardMessageTypeSchema
    STATUS_MESSAGE_MAX_LENGTH
    surveyResponseEntitySchema
    SurveyResponseModes
    surveyResponseModeSchema
    threadFollowsInMessage
    threadFollowsInMessageRelation
    threadReplyNotificationEventGridDataSchema
    THUMBNAIL_CONTENT_TYPE
    todoReminderQueueMessageSchema
    USER_BIOGRAPHY_MAX_LENGTH
    USER_NAME_MAX_LENGTH
    UserAchievementRelations
    userAchievements
    userAchievementsRelation
    userIdSchema
    userIdsSchema
    users
    userSettingsInMessage
    usersRelation
    userStatusEnum
    UserStatuses
    userStatusesInMessage
    userStatusesInMessageRelation
    usersToRoomRolesInMessage
    usersToRoomRolesInMessageRelation
    usersToRoomsInMessage
    usersToRoomsInMessageRelation
    UserToRoomInMessageRelations
    UserToRoomRoleInMessageRelations
    verifications
    voiceInputModeEnum
    VoiceInputModes
    WEBHOOK_NAME_MAX_LENGTH
    WebhookInMessageRelations
    webhookMessageEntitySchema
    webhookPayloadSchema
    webhooksInMessage
    webhooksInMessageRelation
    wordFilterActionEnum
    wordFilterActionSchema
    WRITE_SAS_DURATION_MS
    createAzureEntitySchema
    createAzureMetadataEntitySchema
    createCompositeKeyEntitySchema
    createEventGridEvent
    createEventGridEventSchema
    createMessageEntity
    createMessageMetadataEntitySchema
    createNameCheckSql
    createNameSchema
    escapeValue
    getMimeCategory
    getResourceOwnedTableNames
    getReverseTickedTimestamp
    refineMessageSchema
    refineRoomSchema
    serializeValue