From 430be8c3baad5acd99e8229523a42567260f6ff4 Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Fri, 15 Nov 2024 11:22:32 +0500 Subject: [PATCH] Change tx schema (#7179) Signed-off-by: Denis Bykhov --- server/postgres/migrations/txSchema.sql | 11 +++++++---- server/postgres/src/schemas.ts | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/server/postgres/migrations/txSchema.sql b/server/postgres/migrations/txSchema.sql index 8c93d6f35d..8818157fa8 100644 --- a/server/postgres/migrations/txSchema.sql +++ b/server/postgres/migrations/txSchema.sql @@ -2,9 +2,6 @@ ALTER TABLE tx ADD "objectSpace" text, ADD "objectId" text; -ALTER TABLE tx -DROP COLUMN "attachedTo"; - UPDATE tx SET "objectId" = (data->>'objectId'); @@ -12,4 +9,10 @@ UPDATE tx SET "objectSpace" = (data->>'objectSpace'); ALTER TABLE tx -ALTER COLUMN "objectSpace" SET NOT NULL; \ No newline at end of file +ALTER COLUMN "objectSpace" SET NOT NULL; + +ALTER TABLE tx +ADD "attachedTo" text; + +UPDATE tx +SET "attachedTo" = (data->>'attachedTo'); \ No newline at end of file diff --git a/server/postgres/src/schemas.ts b/server/postgres/src/schemas.ts index 0a3e482db0..65086348d0 100644 --- a/server/postgres/src/schemas.ts +++ b/server/postgres/src/schemas.ts @@ -86,7 +86,7 @@ const spaceSchema: Schema = { } const txSchema: Schema = { - ...baseSchema, + ...defaultSchema, objectSpace: { type: 'text', notNull: true,