2
0

♻️ Re-organize workspace folders

This commit is contained in:
Baptiste Arnaud
2023-03-15 08:35:16 +01:00
parent 25c367901f
commit cbc8194f19
987 changed files with 2716 additions and 2770 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");