🗃️ Remove list types from db schema
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
ALTER TABLE
|
||||
"PublicTypebot"
|
||||
ALTER COLUMN
|
||||
variables TYPE JSONB USING array_to_json(variables);
|
||||
|
||||
ALTER TABLE
|
||||
"Result"
|
||||
ALTER COLUMN
|
||||
variables TYPE JSONB USING array_to_json(variables);
|
||||
|
||||
ALTER TABLE
|
||||
"Typebot"
|
||||
ALTER COLUMN
|
||||
variables TYPE JSONB USING array_to_json(variables);
|
||||
|
||||
ALTER TABLE
|
||||
"User"
|
||||
ALTER COLUMN
|
||||
"onboardingCategories" TYPE JSONB USING array_to_json("onboardingCategories");
|
||||
|
||||
ALTER TABLE
|
||||
"Webhook"
|
||||
ALTER COLUMN
|
||||
"queryParams" TYPE JSONB USING array_to_json("queryParams"),
|
||||
ALTER COLUMN
|
||||
"headers" TYPE JSONB USING array_to_json("headers");
|
||||
@@ -46,9 +46,9 @@ model User {
|
||||
emailVerified DateTime?
|
||||
image String?
|
||||
company String?
|
||||
onboardingCategories String[]
|
||||
onboardingCategories Json
|
||||
graphNavigation GraphNavigation?
|
||||
preferredAppAppearance String?
|
||||
preferredAppAppearance String?
|
||||
accounts Account[]
|
||||
apiTokens ApiToken[]
|
||||
CollaboratorsOnTypebots CollaboratorsOnTypebots[]
|
||||
@@ -157,7 +157,7 @@ model Typebot {
|
||||
name String
|
||||
folderId String?
|
||||
groups Json
|
||||
variables Json[]
|
||||
variables Json
|
||||
edges Json
|
||||
theme Json
|
||||
settings Json
|
||||
@@ -204,7 +204,7 @@ model PublicTypebot {
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
typebotId String @unique
|
||||
groups Json
|
||||
variables Json[]
|
||||
variables Json
|
||||
edges Json
|
||||
theme Json
|
||||
settings Json
|
||||
@@ -216,7 +216,7 @@ model Result {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
typebotId String
|
||||
variables Json[]
|
||||
variables Json
|
||||
isCompleted Boolean
|
||||
hasStarted Boolean?
|
||||
isArchived Boolean? @default(false)
|
||||
@@ -266,8 +266,8 @@ model Webhook {
|
||||
id String @id @default(cuid())
|
||||
url String?
|
||||
method String
|
||||
queryParams Json[]
|
||||
headers Json[]
|
||||
queryParams Json
|
||||
headers Json
|
||||
body String?
|
||||
typebotId String
|
||||
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@ -41,7 +41,8 @@ export const injectFakeResults = async ({
|
||||
: new Date(),
|
||||
isCompleted: rand > 0.5,
|
||||
hasStarted: true,
|
||||
}
|
||||
variables: [],
|
||||
} satisfies Prisma.ResultCreateManyInput
|
||||
}),
|
||||
],
|
||||
})
|
||||
@@ -135,7 +136,10 @@ export const createWorkspaces = async (workspaces: Partial<Workspace>[]) => {
|
||||
|
||||
export const updateUser = (data: Partial<User>) =>
|
||||
prisma.user.update({
|
||||
data,
|
||||
data: {
|
||||
...data,
|
||||
onboardingCategories: data.onboardingCategories ?? [],
|
||||
},
|
||||
where: {
|
||||
id: userId,
|
||||
},
|
||||
@@ -149,7 +153,14 @@ export const createWebhook = async (
|
||||
await prisma.webhook.delete({ where: { id: 'webhook1' } })
|
||||
} catch {}
|
||||
return prisma.webhook.create({
|
||||
data: { method: 'GET', typebotId, id: 'webhook1', ...webhookProps },
|
||||
data: {
|
||||
method: 'GET',
|
||||
typebotId,
|
||||
id: 'webhook1',
|
||||
...webhookProps,
|
||||
queryParams: webhookProps?.queryParams ?? [],
|
||||
headers: webhookProps?.headers ?? [],
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ export const setupUsers = async () => {
|
||||
email: 'user@email.com',
|
||||
name: 'John Doe',
|
||||
graphNavigation: GraphNavigation.TRACKPAD,
|
||||
onboardingCategories: [],
|
||||
apiTokens: {
|
||||
createMany: {
|
||||
data: [
|
||||
@@ -82,7 +83,12 @@ export const setupUsers = async () => {
|
||||
},
|
||||
})
|
||||
await prisma.user.create({
|
||||
data: { id: otherUserId, email: 'other-user@email.com', name: 'James Doe' },
|
||||
data: {
|
||||
id: otherUserId,
|
||||
email: 'other-user@email.com',
|
||||
name: 'James Doe',
|
||||
onboardingCategories: [],
|
||||
},
|
||||
})
|
||||
return prisma.memberInWorkspace.createMany({
|
||||
data: [
|
||||
|
||||
Reference in New Issue
Block a user