37 lines
937 B
SQL
37 lines
937 B
SQL
DO $$DECLARE
|
|
this_version CONSTANT varchar := '00.01.002';
|
|
BEGIN
|
|
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
|
IF FOUND THEN RETURN; END IF;
|
|
|
|
ALTER TABLE public."EntityDoi"
|
|
RENAME "ID" TO id;
|
|
|
|
ALTER TABLE public."EntityDoi"
|
|
DROP COLUMN "EntityType";
|
|
|
|
ALTER TABLE public."EntityDoi"
|
|
RENAME "RepositoryId" TO repository_id;
|
|
|
|
ALTER TABLE public."EntityDoi"
|
|
RENAME "Doi" TO doi;
|
|
|
|
ALTER TABLE public."EntityDoi"
|
|
RENAME "CreatedAt" TO created_at;
|
|
|
|
ALTER TABLE public."EntityDoi"
|
|
RENAME "UpdatedAt" TO updated_at;
|
|
|
|
ALTER TABLE public."EntityDoi"
|
|
RENAME "EntityId" TO entity_id;
|
|
|
|
ALTER TABLE public."EntityDoi"
|
|
ADD COLUMN entity_type smallint NOT NULL DEFAULT 0;
|
|
|
|
ALTER TABLE public."EntityDoi"
|
|
ADD COLUMN is_active smallint NOT NULL DEFAULT 1;
|
|
|
|
|
|
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.002', '2023-10-19 12:00:00.000000+02', now(), 'Align Entity Doi table.');
|
|
|
|
END$$; |