forked from smdoh/pipebird
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
194 lines (171 loc) · 4.73 KB
/
schema.prisma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
generator client {
provider = "prisma-client-js"
previewFeatures = ["interactiveTransactions"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
enum ConnectorStatus {
REACHABLE
UNREACHABLE
}
enum SourceType {
MYSQL
MARIADB
POSTGRES
COCKROACHDB
REDSHIFT
SNOWFLAKE
MSSQL
}
model Webhook {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
url String
secretKey String @unique
}
model Source {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
nickname String?
status ConnectorStatus
sourceType SourceType
host String
port Int
schema String?
database String
username String
password String?
views View[]
}
model View {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
tableName String
source Source @relation(fields: [sourceId], references: [id], onDelete: Cascade)
sourceId Int
columns ViewColumn[]
configurations Configuration[]
}
model ViewColumn {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String
dataType String
isPrimaryKey Boolean
isLastModified Boolean
isTenantColumn Boolean
resultColumns ColumnTransformation[]
view View @relation(fields: [viewId], references: [id])
viewId Int
}
enum DestinationType {
POSTGRES
PROVISIONED_S3
SNOWFLAKE
REDSHIFT
BIGQUERY
}
model Destination {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
nickname String
status ConnectorStatus
destinationType DestinationType
warehouse String?
host String?
port Int?
database String?
schema String?
username String?
password String?
configurations Configuration[]
// BQ specific
serviceAccountJson String?
stagingBucket StagingBucket?
}
model StagingBucket {
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
bucketName String
bucketRegion String?
destination Destination @relation(fields: [destinationId], references: [id])
destinationId Int @unique
}
model Configuration {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
nickname String?
warehouseId String?
tenantId String
lastModifiedAt DateTime @default("1970-01-01T00:00:00-00:00")
destination Destination @relation(fields: [destinationId], references: [id])
destinationId Int
view View @relation(fields: [viewId], references: [id], onDelete: Cascade)
viewId Int
columns ColumnTransformation[]
transfers Transfer[]
}
model ColumnTransformation {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
nameInSource String
nameInDestination String
configuration Configuration @relation(fields: [configurationId], references: [id], onDelete: Cascade)
configurationId Int
viewColumn ViewColumn @relation(fields: [viewColumnId], references: [id])
viewColumnId Int
@@unique([configurationId, nameInDestination]) // no duplicate configuration columns
}
enum TransferStatus {
STARTED
PENDING
COMPLETE
FAILED
CANCELLED
}
model Transfer {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
status TransferStatus
result TransferResult?
configuration Configuration @relation(fields: [configurationId], references: [id])
configurationId Int
}
model TransferResult {
finalizedAt DateTime
objectUrl String?
transfer Transfer @relation(fields: [transferId], references: [id], onDelete: Cascade)
transferId Int @unique
@@id([transferId, finalizedAt])
}
enum LogDomain {
SOURCE
VIEW
CONFIGURATION
DESTINATION
TRANSFER
}
enum LogAction {
CREATE
UPDATE
DELETE
}
model Log {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
domain LogDomain
action LogAction
domainId String
meta Json
}