fix: ignore when the same hostname is introduced twice

This commit is contained in:
Aravinth Manivannan 2023-03-04 18:52:21 +05:30
parent d3b59c0072
commit 649f319f9b
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88
2 changed files with 11 additions and 11 deletions

View file

@ -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": [

View file

@ -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,