Эх сурвалжийг харах

Do not overwrite idx when setting metadata

Since the index in the table is 1-based and the index we were setting is
0-based, this would write the wrong index. Also, we should not adjust the
position (and as such the index) when updating the metadata column.
Mark Rousskov 5 жил өмнө
parent
commit
a95aa98b6d

+ 2 - 2
src/db/notifications.rs

@@ -234,9 +234,9 @@ pub async fn add_metadata(
             ),
             ),
             Some(id) => {
             Some(id) => {
                 t.execute(
                 t.execute(
-                    "update notifications SET idx = $2, metadata = $3
+                    "update notifications SET metadata = $3
                  where notification_id = $1",
                  where notification_id = $1",
-                    &[&id, &(idx as i32), &metadata],
+                    &[&id, &metadata],
                 )
                 )
                 .await
                 .await
                 .context("update notification id")?;
                 .context("update notification id")?;