From 649f319f9b1814a29cc838680ed6816161d1e24d Mon Sep 17 00:00:00 2001 From: Aravinth Manivannan Date: Sat, 4 Mar 2023 18:52:21 +0530 Subject: [PATCH] fix: ignore when the same hostname is introduced twice --- db/db-sqlx-sqlite/sqlx-data.json | 20 ++++++++++---------- db/db-sqlx-sqlite/src/lib.rs | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/db/db-sqlx-sqlite/sqlx-data.json b/db/db-sqlx-sqlite/sqlx-data.json index 883a4f2..d418694 100644 --- a/db/db-sqlx-sqlite/sqlx-data.json +++ b/db/db-sqlx-sqlite/sqlx-data.json @@ -370,16 +370,6 @@ }, "query": "INSERT OR IGNORE INTO fts_users ( username ) VALUES ( $1 );" }, - "9f95bbc36ece57546b81052765eaf0d6cec38f8cf19cda3d256ba21c46a7bd4f": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Right": 4 - } - }, - "query": "INSERT INTO starchart_forges\n (hostname, verified_on, forge_type, starchart_instance)\n VALUES (\n $1,\n $2,\n (SELECT ID FROM starchart_forge_type WHERE name = $3),\n (SELECT ID FROM starchart_introducer WHERE instance_url = $4)\n )" - }, "a60479593819cc7dc7ec87a2d7a25a8960dc2efa1f59c5187d2084c79e26e3f8": { "describe": { "columns": [ @@ -416,6 +406,16 @@ }, "query": "SELECT ID FROM starchart_users WHERE username = $1 AND \n hostname_id = (SELECT ID FROM starchart_forges WHERE hostname = $2)" }, + "a912406491a4e9ea1bbf8a3d0003e948a24df7f101c490aca395f5b86ec64d00": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Right": 4 + } + }, + "query": "INSERT OR IGNORE INTO starchart_forges\n (hostname, verified_on, forge_type, starchart_instance)\n VALUES (\n $1,\n $2,\n (SELECT ID FROM starchart_forge_type WHERE name = $3),\n (SELECT ID FROM starchart_introducer WHERE instance_url = $4)\n )" + }, "ae9295f46da1753fe91a633b5738533084005ad32915c19635f896c454284b6b": { "describe": { "columns": [ diff --git a/db/db-sqlx-sqlite/src/lib.rs b/db/db-sqlx-sqlite/src/lib.rs index a51ff8c..ec2ca06 100644 --- a/db/db-sqlx-sqlite/src/lib.rs +++ b/db/db-sqlx-sqlite/src/lib.rs @@ -313,7 +313,7 @@ impl SCDatabase for Database { let forge_type = f.forge_type.to_str(); if let Some(instance_url) = f.starchart_url { sqlx::query!( - "INSERT INTO starchart_forges + "INSERT OR IGNORE INTO starchart_forges (hostname, verified_on, forge_type, starchart_instance) VALUES ( $1,