refactor: ♻️ Rename step to block
This commit is contained in:
@ -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");
|
@ -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 {
|
||||
|
Reference in New Issue
Block a user