From 8574f33e561f8476f2aada31c2910791e3978b99 Mon Sep 17 00:00:00 2001 From: Diamantis Tziotzios Date: Wed, 18 Oct 2023 14:04:43 +0300 Subject: [PATCH] update script --- .../00.01.001_Align_Description_Template_Type.sql | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dmp-db-scema/updates/00.01.001_Align_Description_Template_Type.sql b/dmp-db-scema/updates/00.01.001_Align_Description_Template_Type.sql index f45526f8b..48bcce7e2 100644 --- a/dmp-db-scema/updates/00.01.001_Align_Description_Template_Type.sql +++ b/dmp-db-scema/updates/00.01.001_Align_Description_Template_Type.sql @@ -5,7 +5,7 @@ ALTER TABLE public."DescriptionTemplateType" RENAME "Name" TO name; ALTER TABLE public."DescriptionTemplateType" - RENAME "Status" TO is_active; + RENAME "Status" TO status; ALTER TABLE public."DescriptionTemplateType" ADD COLUMN created_at timestamp without time zone; @@ -21,3 +21,14 @@ ALTER TABLE public."DescriptionTemplateType" ALTER TABLE public."DescriptionTemplateType" ALTER COLUMN updated_at SET NOT NULL; + +ALTER TABLE public."DescriptionTemplateType" + ADD COLUMN is_active smallint; + +UPDATE public."DescriptionTemplateType" SET is_active = 1; + +UPDATE public."DescriptionTemplateType" SET is_active = 0 where status = 99; +UPDATE public."DescriptionTemplateType" SET status = 0 where is_active = 0; + +ALTER TABLE public."DescriptionTemplateType" + ALTER COLUMN is_active SET NOT NULL; \ No newline at end of file