view PostgreSQL/Plugins/SQL/Upgrades/UnknownToV6.1.sql @ 448:f2427f94d879 pg-transactions

added downgrade script + renames version
author Alain Mazy <am@osimis.io>
date Wed, 17 Jan 2024 16:22:08 +0100
parents PostgreSQL/Plugins/SQL/Upgrades/UnknownToV1.sql@d979f25e60cf
children
line wrap: on
line source

-- add the revision columns if not yet done

DO $body$
BEGIN
	IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE table_schema='public' AND table_name='metadata' AND column_name='revision') THEN
		ALTER TABLE Metadata ADD COLUMN revision INTEGER;
	ELSE
		raise notice 'the metadata.revision column already exists';
	END IF;

	IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE table_schema='public' AND table_name='attachedfiles' AND column_name='revision') THEN
		ALTER TABLE AttachedFiles ADD COLUMN revision INTEGER;
	ELSE
		raise notice 'the attachedfiles.revision column already exists';
	END IF;

END $body$;