/* **********************************************************
 * Copyright 2020 VMware, Inc.  All rights reserved. -- VMware Confidential
 * **********************************************************/
DO
$$
BEGIN
    IF EXISTS (
        SELECT 1
        FROM   information_schema.tables
        WHERE  table_schema = lower('vlcm')
        AND    table_name = lower('upgradetracking')
    )
    THEN
        INSERT INTO VersionTracking
        SELECT ID, OPERATION FROM UpgradeTracking;
    END IF;
    DROP TABLE IF EXISTS UpgradeTracking;
END;
$$;
