argos/dmp-db-scema/updates/00.01.003_Align_Dmp_bluepri...

26 lines
945 B
SQL

ALTER TABLE public."DMPProfile" RENAME TO "DmpBlueprint";
ALTER TABLE public."DmpBlueprint" RENAME "ID" TO id;
ALTER TABLE public."DmpBlueprint" RENAME "Label" TO label;
ALTER TABLE public."DmpBlueprint" RENAME "Definition" TO definition;
ALTER TABLE public."DmpBlueprint" RENAME "Status" TO status;
ALTER TABLE public."DmpBlueprint" RENAME "Created" TO created_at;
ALTER TABLE public."DmpBlueprint" ALTER COLUMN created_at TYPE timestamp without time zone ;
ALTER TABLE public."DmpBlueprint" RENAME "Modified" TO updated_at;
ALTER TABLE public."DmpBlueprint" ALTER COLUMN updated_at TYPE timestamp without time zone ;
ALTER TABLE public."DmpBlueprint" ADD COLUMN is_active smallint;
UPDATE public."DmpBlueprint" SET is_active = 1;
UPDATE public."DmpBlueprint" SET is_active = 0 where status = 99;
UPDATE public."DmpBlueprint" SET status = 0 where is_active = 0;
ALTER TABLE public."DmpBlueprint" ALTER COLUMN is_active SET NOT NULL;