diff --git a/src/infra/flow-system/postgres/.sqlx/query-64a9ac2778c308d8108b1dc92f41a9f7f6f77ab14fd0d5a0870213f2b1f8d0ad.json b/src/infra/flow-system/postgres/.sqlx/query-64a9ac2778c308d8108b1dc92f41a9f7f6f77ab14fd0d5a0870213f2b1f8d0ad.json new file mode 100644 index 0000000000..bfd6790811 --- /dev/null +++ b/src/infra/flow-system/postgres/.sqlx/query-64a9ac2778c308d8108b1dc92f41a9f7f6f77ab14fd0d5a0870213f2b1f8d0ad.json @@ -0,0 +1,50 @@ +{ + "db_name": "PostgreSQL", + "query": "\n WITH unsorted_flows AS\n (SELECT\n f.flow_id,\n f.flow_status,\n MAX(e.event_time) as last_event_time,\n (CASE\n WHEN f.flow_status = 'waiting' THEN 1\n WHEN f.flow_status = 'running' THEN 2\n ELSE 3\n END) AS ord_status\n FROM flows f\n LEFT JOIN flow_events e USING(flow_id)\n WHERE\n f.dataset_id = ANY($1)\n AND (cast($2 as dataset_flow_type) IS NULL OR f.dataset_flow_type = $2)\n AND (cast($3 as flow_status_type) IS NULL OR f.flow_status = $3)\n AND (cast($4 as TEXT[]) IS NULL OR f.initiator = ANY($4))\n GROUP BY f.flow_id, f.flow_status)\n SELECT flow_id FROM unsorted_flows\n ORDER BY ord_status, last_event_time DESC\n LIMIT $5 OFFSET $6\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "flow_id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "TextArray", + { + "Custom": { + "name": "dataset_flow_type", + "kind": { + "Enum": [ + "ingest", + "execute_transform", + "hard_compaction", + "reset" + ] + } + } + }, + { + "Custom": { + "name": "flow_status_type", + "kind": { + "Enum": [ + "waiting", + "running", + "finished" + ] + } + } + }, + "TextArray", + "Int8", + "Int8" + ] + }, + "nullable": [ + false + ] + }, + "hash": "64a9ac2778c308d8108b1dc92f41a9f7f6f77ab14fd0d5a0870213f2b1f8d0ad" +} diff --git a/src/infra/flow-system/postgres/.sqlx/query-849e4e06bc203af6f1b895b839dc64fb200f2a9b93a80a5cc9ab8f7471047639.json b/src/infra/flow-system/postgres/.sqlx/query-849e4e06bc203af6f1b895b839dc64fb200f2a9b93a80a5cc9ab8f7471047639.json deleted file mode 100644 index e77580e5dd..0000000000 --- a/src/infra/flow-system/postgres/.sqlx/query-849e4e06bc203af6f1b895b839dc64fb200f2a9b93a80a5cc9ab8f7471047639.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT flow_id FROM flows\n WHERE dataset_id = ANY($1)\n AND (cast($2 as dataset_flow_type) IS NULL OR dataset_flow_type = $2)\n AND (cast($3 as flow_status_type) IS NULL OR flow_status = $3)\n AND (cast($4 as TEXT[]) IS NULL OR initiator = ANY($4))\n ORDER BY flow_id DESC\n LIMIT $5 OFFSET $6\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "flow_id", - "type_info": "Int8" - } - ], - "parameters": { - "Left": [ - "TextArray", - { - "Custom": { - "name": "dataset_flow_type", - "kind": { - "Enum": [ - "ingest", - "execute_transform", - "hard_compaction", - "reset" - ] - } - } - }, - { - "Custom": { - "name": "flow_status_type", - "kind": { - "Enum": [ - "waiting", - "running", - "finished" - ] - } - } - }, - "TextArray", - "Int8", - "Int8" - ] - }, - "nullable": [ - false - ] - }, - "hash": "849e4e06bc203af6f1b895b839dc64fb200f2a9b93a80a5cc9ab8f7471047639" -}