From c672221eea7993fe5e56d36609f20cdca74ccdb3 Mon Sep 17 00:00:00 2001 From: Karl Ludwig Weise Date: Fri, 26 Sep 2025 14:14:24 +0200 Subject: [PATCH] Fix sql migrations for description --- migrations/0004_robust_nextwave.sql | 9 ++++++++- tenant-migrations/0003_certain_grim_reaper.sql | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/migrations/0004_robust_nextwave.sql b/migrations/0004_robust_nextwave.sql index 7c79a9d..9917030 100644 --- a/migrations/0004_robust_nextwave.sql +++ b/migrations/0004_robust_nextwave.sql @@ -1,2 +1,9 @@ -ALTER TABLE "tenant" ALTER COLUMN "description" SET DATA TYPE json;--> statement-breakpoint +ALTER TABLE "tenant" +ALTER COLUMN "description" +SET DATA TYPE json +USING CASE + WHEN description IS NULL THEN NULL + WHEN description::text = '' THEN NULL + ELSE description::json +END;--> statement-breakpoint ALTER TABLE "tenant" ALTER COLUMN "description" SET NOT NULL; \ No newline at end of file diff --git a/tenant-migrations/0003_certain_grim_reaper.sql b/tenant-migrations/0003_certain_grim_reaper.sql index 629a503..9d9fffc 100644 --- a/tenant-migrations/0003_certain_grim_reaper.sql +++ b/tenant-migrations/0003_certain_grim_reaper.sql @@ -1,2 +1,9 @@ -ALTER TABLE "agent" ALTER COLUMN "description" SET DATA TYPE json;--> statement-breakpoint +ALTER TABLE "agent" +ALTER COLUMN "description" +SET DATA TYPE json +USING CASE + WHEN description IS NULL THEN NULL + WHEN description::text = '' THEN NULL + ELSE description::json +END;--> statement-breakpoint ALTER TABLE "agent" ADD COLUMN "languages" json NOT NULL; \ No newline at end of file