Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
2.2 kB
1
Indexable
Never
-- Existing code...

create or replace view workflow_detail_view as
select 
    -- Existing columns...
    COALESCE(
        -- Existing subquery...
        (
            SELECT 
                CASE 
                    -- Existing cluster config logic...
                    WHEN describe_cluster_info -> 'DBClusters' -> 0 ->> 'StorageType' = 'aurora-iopt1' THEN 'enabled'
                    WHEN describe_cluster_info -> 'DBClusters' -> 0 ->> 'StorageType' <> 'aurora-iopt1' THEN 'disabled'
                    -- Existing logic...
                    ELSE NULL
                END
            FROM cluster_v2 cls 
            INNER JOIN child_workflow_v2 cw ON cls.child_workflow_id = cw.child_workflow_id AND cw.workflow_id = wv.workflow_id
            LIMIT 1
        ),
        -- Existing fallback to csd config...
        (
            SELECT 
                CASE
                    WHEN config_json->>'volume_storage_sku' = 'iopt1' THEN 'enabled'
                    WHEN config_json->>'volume_storage_sku' <> 'iopt1' THEN 'disabled'
                    ELSE NULL
                END AS "io_sku"
            FROM csd_config_v2 cc
            INNER JOIN child_workflow_v2 cw ON cc.child_workflow_id = cw.child_workflow_id AND cw.workflow_id = wv.workflow_id
            LIMIT 1
        ),
        -- Existing fallback to json config...
        CASE
            WHEN ((wv.benchmark_config_jsonb -> 'config') ->> 'storageType') = 'aurora-iopt1' THEN 'enabled'
            WHEN ((wv.benchmark_config_jsonb -> 'config') ->> 'storageType') <> 'aurora-iopt1' THEN 'disabled'
            -- Existing backward compatibility...
            WHEN ((wv.benchmark_config_jsonb -> 'testconfig'::text) -> 'execute_enable_io_sku'::text) IS NOT NULL THEN 'enabled'::text
            ELSE 'disabled'::text
        END
    ) as io_sku,
    -- Existing columns...

    -- Added functionality for instance_cores...
    (CASE 
        WHEN wdv.instance_family = 'serverless'::text THEN GREATEST(wdv.instance_size::integer / 16, 1)
        WHEN wdv.instance_size ~ '\d'::text THEN regexp_replace(wdv.instance_size, '[^\d]'::text, ''::text, 'g'::text)::integer
        ELSE 0 
     END) * 4 AS instance_cores
FROM public.workflow_detail_view wdv;
Leave a Comment