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

34 lines
1.3 KiB
SQL

ALTER TABLE public."DescriptionTemplate" RENAME "ID" TO id;
ALTER TABLE public."DescriptionTemplate" RENAME "Label" TO label;
ALTER TABLE public."DescriptionTemplate" RENAME "Definition" TO definition;
ALTER TABLE public."DescriptionTemplate" RENAME "Status" TO status;
ALTER TABLE public."DescriptionTemplate" RENAME "Created" TO created_at;
ALTER TABLE public."DescriptionTemplate" RENAME "Modified" TO updated_at;
ALTER TABLE public."DescriptionTemplate" RENAME "Description" TO description;
ALTER TABLE public."DescriptionTemplate" RENAME "GroupId" TO group_id;
ALTER TABLE public."DescriptionTemplate" RENAME "Version" TO version;
ALTER TABLE public."DescriptionTemplate" RENAME "Language" TO "language";
ALTER TABLE public."DescriptionTemplate" RENAME "Type" TO "type";
ALTER TABLE public."DescriptionTemplate" ALTER COLUMN created_at TYPE timestamp without time zone ;
ALTER TABLE public."DescriptionTemplate" ALTER COLUMN updated_at TYPE timestamp without time zone ;
ALTER TABLE public."DescriptionTemplate" ADD COLUMN is_active smallint;
UPDATE public."DescriptionTemplate" SET is_active = 1;
UPDATE public."DescriptionTemplate" SET is_active = 0 where status = 99;
UPDATE public."DescriptionTemplate" SET status = 0 where is_active = 0;
ALTER TABLE public."DescriptionTemplate" ALTER COLUMN is_active SET NOT NULL;