Entity Reference

All entities use Lombok annotations (@Data, @Getter, @Setter) and are mapped to H2 tables via @MappedEntity.

Note

Entities with @Id that go through CrudRepository.update() must use explicit getters/setters instead of Lombok @Getter/@Setter. Lombok hides the @Id annotation from the Micronaut Data annotation processor, causing "No identity is present" errors. Currently, EventRelations and Room follow this pattern.

User

Table: users

FieldTypeDescription
idString (PK)User ID (@alice:localhost)
passwordHashStringPassword hash
displayNameStringDisplay name
avatarUrlStringAvatar MXC URI
createdAtLongCreation timestamp

UserAccessToken

Table: user_access_tokens

FieldTypeDescription
idString (PK)Token ID
userIdStringOwner user ID
deviceIdStringDevice identifier
tokenStringOpaque token string (syt_...)
createdAtLongCreation timestamp

Room

Table: rooms

FieldTypeDescription
idString (PK)Room ID (!room:localhost)
nameStringRoom name
topicStringRoom topic
creatorIdStringCreator user ID
roomTypeStringRoom type (m.space for spaces)
createdAtLongCreation timestamp

Event

Table: event

FieldTypeDescription
idString (PK)Event ID
roomIdStringRoom ID
typeStringEvent type
senderStringSender user ID
stateKeyStringState key (null for non-state events)
contentStringJSON content
streamOrderingLongStream position
originServerTsLongOrigin server timestamp
depthLongDAG depth

RoomMember

Table: room_user

FieldTypeDescription
idString (PK)Composite ID
roomIdStringRoom ID
userIdStringUser ID
membershipStringjoin/invite/leave/ban
eventMembershipStringMembership event ID

EventRelations

Table: event_relations

FieldTypeDescription
idLong (PK)Auto-increment ID
eventIdStringSource event ID
relatesToIdStringRelated event ID
relationTypeStringm.thread, m.annotation, m.replace, m.reference
eventTypeStringRelated event type
roomIdStringRoom ID

MediaMetadata

Table: media_metadata

FieldTypeDescription
idString (PK)Media ID
contentTypeStringMIME type
contentLengthLongFile size in bytes
fileNameStringOriginal filename
uploadNameStringUpload name

ServerSigningKey

Table: server_signing_key

FieldTypeDescription
idString (PK)Key record ID
serverNameStringServer name
keyIdStringKey identifier
publicKeyStringBase64 public key
privateKeyStringBase64 private key
algorithmStringSigning algorithm
createdAtLongCreation timestamp
expiresAtLongExpiration timestamp

UserPushRule

Table: user_push_rules

FieldTypeDescription
idString (PK)Rule ID
userIdStringOwner user ID
ruleIdStringRule identifier
kindStringoverride/room/sender/content/underride
enabledBooleanRule enabled
actionsStringJSON actions array
conditionsStringJSON conditions array

DeviceInbox

Table: device_inbox

FieldTypeDescription
idString (PK)Message ID
userIdStringTarget user ID
deviceIdStringTarget device ID
contentStringJSON message content
createdAtLongCreation timestamp