Files
formbricks/packages/database/prisma/dbml/schema.dbml
2022-11-29 18:12:37 +01:00

157 lines
3.4 KiB
Plaintext

//// ------------------------------------------------------
//// THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
//// ------------------------------------------------------
Table Pipeline {
id String [pk]
createdAt DateTime [default: `now()`, not null]
updatedAt DateTime [not null]
name String [not null]
type PipelineType [not null]
form Form [not null]
formId String [not null]
enabled Boolean [not null, default: false]
config Json [not null, default: '{}']
}
Table Customer {
id String [not null]
createdAt DateTime [default: `now()`, not null]
updatedAt DateTime [not null]
team Team [not null]
teamId String [not null]
submissions Submission [not null]
data Json [not null, default: '{}']
indexes {
(id, teamId) [pk]
}
}
Table Form {
id String [pk]
createdAt DateTime [default: `now()`, not null]
updatedAt DateTime [not null]
label String [not null]
team Team [not null]
teamId String [not null]
schema Json [not null, default: '{}']
submissions Submission [not null]
pipelines Pipeline [not null]
}
Table Submission {
id String [pk]
createdAt DateTime [default: `now()`, not null]
updatedAt DateTime [not null]
form Form [not null]
formId String [not null]
customer Customer
customerId String
teamId String
data Json [not null, default: '{}']
}
Table Team {
id String [pk]
createdAt DateTime [default: `now()`, not null]
updatedAt DateTime [not null]
name String [not null]
members Membership [not null]
forms Form [not null]
customers Customer [not null]
}
Table Membership {
team Team [not null]
teamId String [not null]
user User [not null]
userId String [not null]
accepted Boolean [not null, default: false]
role MembershipRole [not null]
indexes {
(userId, teamId) [pk]
}
}
Table ApiKey {
id String [pk, unique]
createdAt DateTime [default: `now()`, not null]
lastUsedAt DateTime
label String
hashedKey String [unique, not null]
user User [not null]
userId String [not null]
}
Table Account {
id String [pk]
createdAt DateTime [default: `now()`, not null]
updatedAt DateTime [not null]
user User
userId String [not null]
type String [not null]
provider String [not null]
providerAccountId String [not null]
access_token String
refresh_token String
expires_at Int
token_type String
scope String
id_token String
session_state String
indexes {
(provider, providerAccountId) [unique]
}
}
Table User {
id String [pk]
createdAt DateTime [default: `now()`, not null]
updatedAt DateTime [not null]
name String
email String [unique, not null]
emailVerified DateTime
password String
identityProvider IdentityProvider [not null, default: 'EMAIL']
identityProviderAccountId String
teams Membership [not null]
accounts Account [not null]
apiKeys ApiKey [not null]
}
Enum PipelineType {
WEBHOOK
EMAIL_NOTIFICATION
}
Enum MembershipRole {
MEMBER
ADMIN
OWNER
}
Enum IdentityProvider {
EMAIL
GITHUB
}
Ref: Pipeline.formId > Form.id [delete: Cascade]
Ref: Customer.teamId > Team.id [delete: Cascade]
Ref: Form.teamId > Team.id [delete: Cascade]
Ref: Submission.formId > Form.id [delete: Cascade]
Ref: Submission.(customerId, teamId) > Customer.(id, teamId)
Ref: Membership.teamId > Team.id [delete: Cascade]
Ref: Membership.userId > User.id [delete: Cascade]
Ref: ApiKey.userId > User.id [delete: Cascade]
Ref: Account.userId > User.id [delete: Cascade]