Skip to content

Commit

Permalink
fix: table name scalar_tap_ravs discrepancy
Browse files Browse the repository at this point in the history
Was `scalar_tap_latest_ravs` everywhere except in the down migration.
Opted for the shorter of the 2 everywhere.

Signed-off-by: Alexis Asseman <[email protected]>
  • Loading branch information
aasseman committed Nov 2, 2023
1 parent f7447f7 commit 1ce9244
Show file tree
Hide file tree
Showing 14 changed files with 85 additions and 83 deletions.

This file was deleted.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion migrations/20230915230734_tap_ravs.up.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE IF NOT EXISTS scalar_tap_latest_ravs (
CREATE TABLE IF NOT EXISTS scalar_tap_ravs (
allocation_id CHAR(40) NOT NULL,
sender_address CHAR(40) NOT NULL,
rav JSON NOT NULL,
Expand Down
8 changes: 4 additions & 4 deletions tap_agent/src/tap/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ impl Account {
SELECT
rav -> 'message' ->> 'timestamp_ns' AS timestamp_ns
FROM
scalar_tap_latest_ravs
scalar_tap_ravs
WHERE
allocation_id = $1
AND sender_address = $2
Expand Down Expand Up @@ -356,7 +356,7 @@ impl Account {
// Mark the last RAV as last in the DB as a cue for the indexer-agent.
let updated_rows = sqlx::query!(
r#"
UPDATE scalar_tap_latest_ravs
UPDATE scalar_tap_ravs
SET is_last = true
WHERE allocation_id = $1 AND sender_address = $2
RETURNING *
Expand Down Expand Up @@ -751,7 +751,7 @@ mod tests {
let latest_rav = sqlx::query!(
r#"
SELECT rav
FROM scalar_tap_latest_ravs
FROM scalar_tap_ravs
WHERE allocation_id = $1 AND sender_address = $2
"#,
ALLOCATION_ID
Expand Down Expand Up @@ -814,7 +814,7 @@ mod tests {
let latest_rav = sqlx::query!(
r#"
SELECT rav
FROM scalar_tap_latest_ravs
FROM scalar_tap_ravs
WHERE allocation_id = $1 AND sender_address = $2
"#,
ALLOCATION_ID
Expand Down
4 changes: 2 additions & 2 deletions tap_agent/src/tap/rav_storage_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl RAVStorageAdapterTrait for RAVStorageAdapter {
async fn update_last_rav(&self, rav: SignedRAV) -> Result<(), Self::AdapterError> {
let _fut = sqlx::query!(
r#"
INSERT INTO scalar_tap_latest_ravs (allocation_id, sender_address, rav)
INSERT INTO scalar_tap_ravs (allocation_id, sender_address, rav)
VALUES ($1, $2, $3)
ON CONFLICT (allocation_id, sender_address)
DO UPDATE SET rav = $3
Expand All @@ -55,7 +55,7 @@ impl RAVStorageAdapterTrait for RAVStorageAdapter {
let latest_rav = sqlx::query!(
r#"
SELECT rav
FROM scalar_tap_latest_ravs
FROM scalar_tap_ravs
WHERE allocation_id = $1 AND sender_address = $2
"#,
self.allocation_id
Expand Down
2 changes: 1 addition & 1 deletion tap_agent/src/tap/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub async fn store_receipt(pgpool: &PgPool, signed_receipt: SignedReceipt) -> Re
pub async fn store_rav(pgpool: &PgPool, signed_rav: SignedRAV, sender: Address) -> Result<()> {
sqlx::query!(
r#"
INSERT INTO scalar_tap_latest_ravs (
INSERT INTO scalar_tap_ravs (
allocation_id, sender_address, rav
)
VALUES ($1, $2, $3)
Expand Down

0 comments on commit 1ce9244

Please sign in to comment.