diff --git a/.sqlx/query-46a50e4bbfb5f7c57bb42fcfa17e3ffe3109b63b14aa746eacdb81288f919c16.json b/.sqlx/query-46a50e4bbfb5f7c57bb42fcfa17e3ffe3109b63b14aa746eacdb81288f919c16.json deleted file mode 100644 index a166ca8d..00000000 --- a/.sqlx/query-46a50e4bbfb5f7c57bb42fcfa17e3ffe3109b63b14aa746eacdb81288f919c16.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n WITH rav AS (\n SELECT \n rav -> 'message' ->> 'timestamp_ns' AS timestamp_ns \n FROM \n scalar_tap_ravs \n WHERE \n allocation_id = $1 \n AND sender_address = $2\n ) \n SELECT \n COUNT(*), \n MAX(id), \n SUM(value) \n FROM \n scalar_tap_receipts \n WHERE \n allocation_id = $1 \n AND sender_address = $2 \n AND CASE WHEN (\n SELECT \n timestamp_ns :: NUMERIC \n FROM \n rav\n ) IS NOT NULL THEN timestamp_ns > (\n SELECT \n timestamp_ns :: NUMERIC \n FROM \n rav\n ) ELSE TRUE END\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "count", - "type_info": "Int8" - }, - { - "ordinal": 1, - "name": "max", - "type_info": "Int8" - }, - { - "ordinal": 2, - "name": "sum", - "type_info": "Numeric" - } - ], - "parameters": { - "Left": [ - "Bpchar", - "Bpchar" - ] - }, - "nullable": [ - null, - null, - null - ] - }, - "hash": "46a50e4bbfb5f7c57bb42fcfa17e3ffe3109b63b14aa746eacdb81288f919c16" -} diff --git a/.sqlx/query-6d2f5eecfd846d8f1e2db87e1a79c73af715e64ea63132d4768731b222ad672b.json b/.sqlx/query-6d2f5eecfd846d8f1e2db87e1a79c73af715e64ea63132d4768731b222ad672b.json new file mode 100644 index 00000000..e878a43f --- /dev/null +++ b/.sqlx/query-6d2f5eecfd846d8f1e2db87e1a79c73af715e64ea63132d4768731b222ad672b.json @@ -0,0 +1,29 @@ +{ + "db_name": "PostgreSQL", + "query": "\n WITH rav AS (\n SELECT \n rav -> 'message' ->> 'timestamp_ns' AS timestamp_ns \n FROM \n scalar_tap_ravs \n WHERE \n allocation_id = $1 \n AND sender_address = $2\n ) \n SELECT \n MAX(id), \n SUM(value) \n FROM \n scalar_tap_receipts \n WHERE \n allocation_id = $1 \n AND sender_address = $2 \n AND CASE WHEN (\n SELECT \n timestamp_ns :: NUMERIC \n FROM \n rav\n ) IS NOT NULL THEN timestamp_ns > (\n SELECT \n timestamp_ns :: NUMERIC \n FROM \n rav\n ) ELSE TRUE END\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "max", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "sum", + "type_info": "Numeric" + } + ], + "parameters": { + "Left": [ + "Bpchar", + "Bpchar" + ] + }, + "nullable": [ + null, + null + ] + }, + "hash": "6d2f5eecfd846d8f1e2db87e1a79c73af715e64ea63132d4768731b222ad672b" +} diff --git a/.sqlx/query-d47a86f9686f9c72d2d5047d4c315adf6a3900d89553bdec541201fd3e282d83.json b/.sqlx/query-7a48651e528b87c6a618534806e70c2c494f3ba0774097652df984248869c20d.json similarity index 71% rename from .sqlx/query-d47a86f9686f9c72d2d5047d4c315adf6a3900d89553bdec541201fd3e282d83.json rename to .sqlx/query-7a48651e528b87c6a618534806e70c2c494f3ba0774097652df984248869c20d.json index a63ac2ab..3bfe8040 100644 --- a/.sqlx/query-d47a86f9686f9c72d2d5047d4c315adf6a3900d89553bdec541201fd3e282d83.json +++ b/.sqlx/query-7a48651e528b87c6a618534806e70c2c494f3ba0774097652df984248869c20d.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n UPDATE scalar_tap_ravs\n SET is_last = true\n WHERE allocation_id = $1 AND sender_address = $2\n RETURNING *\n ", + "query": "\n UPDATE scalar_tap_ravs\n SET final = true\n WHERE allocation_id = $1 AND sender_address = $2\n RETURNING *\n ", "describe": { "columns": [ { @@ -20,7 +20,7 @@ }, { "ordinal": 3, - "name": "is_last", + "name": "final", "type_info": "Bool" } ], @@ -37,5 +37,5 @@ false ] }, - "hash": "d47a86f9686f9c72d2d5047d4c315adf6a3900d89553bdec541201fd3e282d83" + "hash": "7a48651e528b87c6a618534806e70c2c494f3ba0774097652df984248869c20d" } diff --git a/migrations/20230915230734_tap_ravs.up.sql b/migrations/20230915230734_tap_ravs.up.sql index 9847d283..61ee9e86 100644 --- a/migrations/20230915230734_tap_ravs.up.sql +++ b/migrations/20230915230734_tap_ravs.up.sql @@ -2,6 +2,6 @@ CREATE TABLE IF NOT EXISTS scalar_tap_ravs ( allocation_id CHAR(40) NOT NULL, sender_address CHAR(40) NOT NULL, rav JSON NOT NULL, - is_last BOOLEAN DEFAULT FALSE NOT NULL, + final BOOLEAN DEFAULT FALSE NOT NULL, PRIMARY KEY (allocation_id, sender_address) ); diff --git a/tap-agent/src/tap/sender_allocation_relationship.rs b/tap-agent/src/tap/sender_allocation_relationship.rs index 10551c7e..ad940aa5 100644 --- a/tap-agent/src/tap/sender_allocation_relationship.rs +++ b/tap-agent/src/tap/sender_allocation_relationship.rs @@ -351,7 +351,7 @@ impl SenderAllocationRelationship { let updated_rows = sqlx::query!( r#" UPDATE scalar_tap_ravs - SET is_last = true + SET final = true WHERE allocation_id = $1 AND sender_address = $2 RETURNING * "#,