generator client { provider = "prisma-client-js" } datasource db { provider = "sqlite" url = "file:../../../data/core.db" } // // Namespace: System // model SystemSetting { hashKey String @id hashValue String } model SystemPostMigration { name String @id createdAt DateTime @default(now()) } // // Namespace: Identity // model IdentityGroup { id Int @id @default(autoincrement()) isAdmin Boolean @default(false) name String? users IdentityGroupToIdentityUser[] davResources CloudDavResource[] } model IdentityGroupToIdentityUser { groupId Int group IdentityGroup @relation(fields: [groupId], references: [id]) userId Int user IdentityUser @relation(fields: [userId], references: [id]) @@id([groupId, userId]) } model IdentityUser { id Int @id @default(autoincrement()) externalId String @unique @default(uuid()) username String @unique groups IdentityGroupToIdentityUser[] profileHashMapPairs IdentityProfileNonNormalized[] emails IdentityUserEmails[] authDevices IdentityAuthDevice[] } model IdentityProfileNonNormalized { userId Int user IdentityUser @relation(fields: [userId], references: [id]) hashKey String hashValue String createdAt DateTime @default(now()) @@id([userId, hashKey]) } model IdentityUserEmails { email String @id userId Int user IdentityUser @relation(fields: [userId], references: [id]) verified Boolean @default(false) default Boolean @default(false) } model EnumIdentityAuthDeviceType { enumValue String @id authDevices IdentityAuthDevice[] } model IdentityAuthDevice { id Int @id @default(autoincrement()) userId Int user IdentityUser @relation(fields: [userId], references: [id]) deviceType String deviceTypeRelation EnumIdentityAuthDeviceType @relation(fields: [deviceType], references: [enumValue]) createdAt DateTime @default(now()) hashMapPairs IdentityAuthDeviceNonNormalized[] @@index([userId]) @@index([userId, deviceType]) } model IdentityAuthDeviceNonNormalized { authDeviceId Int davResource IdentityAuthDevice @relation(fields: [authDeviceId], references: [id]) hashKey String hashValue String createdAt DateTime @default(now()) @@id([authDeviceId, hashKey]) } // // Namespace: cloud-dav // model EnumCloudDavResourceType { enumValue String @id davResources CloudDavResource[] } model CloudDavResource { id String @id @default(uuid()) identityGroupId Int IdentityGroup IdentityGroup @relation(fields: [identityGroupId], references: [id]) resourceType String resourceTypeRelation EnumCloudDavResourceType @relation(fields: [resourceType], references: [enumValue]) hashMapPairs CloudDavResourceNonNormalized[] @@index([identityGroupId]) } model CloudDavResourceNonNormalized { davResourceId String davResource CloudDavResource @relation(fields: [davResourceId], references: [id]) hashKey String hashValue String createdAt DateTime @default(now()) @@id([davResourceId, hashKey]) }