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