2
0

refactor: ♻️ Rename step to block

This commit is contained in:
Baptiste Arnaud
2022-06-11 07:27:38 +02:00
parent 8751766d0e
commit 2df8338505
297 changed files with 4292 additions and 3989 deletions

View File

@ -0,0 +1,33 @@
DROP INDEX "Answer_resultId_blockId_stepId_key";
ALTER TABLE "Answer"
RENAME COLUMN "stepId" TO "groupId";
ALTER TABLE "PublicTypebot"
RENAME COLUMN "blocks" TO "groups";
ALTER TABLE "PublicTypebot"
ALTER COLUMN groups TYPE JSONB USING to_json(groups);
ALTER TABLE "PublicTypebot"
ALTER COLUMN edges TYPE JSONB USING to_json(edges);
ALTER TABLE "Typebot"
RENAME COLUMN "blocks" TO "groups";
ALTER TABLE "Typebot"
ALTER COLUMN groups TYPE JSONB USING to_json(groups);
ALTER TABLE "Typebot"
ALTER COLUMN edges TYPE JSONB USING to_json(edges);
UPDATE "Typebot" t
SET groups = REPLACE(REPLACE(REPLACE(t.groups::text, '"blockId":', '"groupId":'), '"steps":', '"blocks":'), '"stepId":', '"blockId":')::jsonb,
edges = REPLACE(REPLACE(t.edges::text, '"blockId":', '"groupId":'), '"stepId":', '"blockId":')::jsonb;
UPDATE "PublicTypebot" t
SET groups = REPLACE(REPLACE(REPLACE(t.groups::text, '"blockId":', '"groupId":'), '"steps":', '"blocks":'), '"stepId":', '"blockId":')::jsonb,
edges = REPLACE(REPLACE(t.edges::text, '"blockId":', '"groupId":'), '"stepId":', '"blockId":')::jsonb;
-- CreateIndex
CREATE UNIQUE INDEX "Answer_resultId_blockId_groupId_key" ON "Answer"("resultId", "blockId", "groupId");

View File

@ -169,9 +169,9 @@ model Typebot {
results Result[]
folderId String?
folder DashboardFolder? @relation(fields: [folderId], references: [id])
blocks Json[]
groups Json
variables Json[]
edges Json[]
edges Json
theme Json
settings Json
publicId String? @unique
@ -215,9 +215,9 @@ model PublicTypebot {
updatedAt DateTime @default(now()) @updatedAt
typebotId String @unique
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
blocks Json[]
groups Json
variables Json[]
edges Json[]
edges Json
theme Json
settings Json
}
@ -248,12 +248,12 @@ model Answer {
createdAt DateTime @default(now())
resultId String
result Result @relation(fields: [resultId], references: [id], onDelete: Cascade)
stepId String
blockId String
blockId String
groupId String
variableId String?
content String
@@unique([resultId, blockId, stepId])
@@unique([resultId, blockId, groupId])
}
model Coupon {