argos/dmp-db-scema/updates/00.01.001_Align_Description...

34 lines
1.1 KiB
SQL

ALTER TABLE public."DescriptionTemplateType"
RENAME "ID" TO id;
ALTER TABLE public."DescriptionTemplateType"
RENAME "Name" TO name;
ALTER TABLE public."DescriptionTemplateType"
RENAME "Status" TO status;
ALTER TABLE public."DescriptionTemplateType"
ADD COLUMN created_at timestamp without time zone;
ALTER TABLE public."DescriptionTemplateType"
ADD COLUMN updated_at timestamp without time zone;
UPDATE public."DescriptionTemplateType" SET created_at = now();
UPDATE public."DescriptionTemplateType" SET updated_at = now();
ALTER TABLE public."DescriptionTemplateType"
ALTER COLUMN created_at SET NOT NULL;
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;