graphql-engine/server/src-rsr/migrations/43_to_44.sql
kodiakhq[bot] a11b4135fc Use exceptions to handle compatibility with pg 9.6 in 2.0 upgrade migration
https://github.com/hasura/graphql-engine-mono/pull/1651

Co-authored-by: Rakesh Emmadi <12475069+rakeshkky@users.noreply.github.com>
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
GitOrigin-RevId: cdb4a33cbb1a136bc30e8f0dd59aaae584d3a636
2021-06-24 02:20:11 +00:00

14 lines
472 B
SQL

-- This migration adds versioning to metadata, used for optimistic locking in UIs.
-- TODO: Are there changes required in catalog_versions.txt
DO $$
BEGIN
BEGIN
ALTER TABLE hdb_catalog.hdb_metadata ADD COLUMN "resource_version" INTEGER NOT NULL DEFAULT 1 UNIQUE;
EXCEPTION
-- For pg 9.6 compatibility
WHEN duplicate_column THEN RAISE NOTICE 'column resource_version already exists in hdb_metadata';
END;
END;
$$