DROP TABLE IF EXISTS tgAccounts;

DO $$
    BEGIN
        IF EXISTS (SELECT 1 FROM pg_type WHERE typname = 'tgAccountStatus') THEN
            DROP TYPE TgAccountStatus;
        END IF;
    END $$;

DROP INDEX IF EXISTS idx_apiid_apihash;