From 8ad466dbc82969f1a212d641014337ab05d8ebdf Mon Sep 17 00:00:00 2001 From: realaravinth Date: Wed, 18 May 2022 19:57:48 +0530 Subject: [PATCH] fix: rm unique constraint on profile photo link DESCRIPTION If user hasn't configured a profile photo on their forge instance, it would point to the default photo of the forge instance, which might be the same for all users without a profile photo on that forge instance. --- db/db-core/src/errors.rs | 4 ---- db/db-sqlx-sqlite/migrations/20220405113942_world_forges.sql | 2 +- db/db-sqlx-sqlite/src/errors.rs | 2 -- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/db/db-core/src/errors.rs b/db/db-core/src/errors.rs index 599d9fc..f06856b 100644 --- a/db/db-core/src/errors.rs +++ b/db/db-core/src/errors.rs @@ -44,10 +44,6 @@ pub enum DBError { #[error("User HTML link is already taken")] DuplicateUserLink, - /// User profile photo link Type is already taken - #[error("User profile photo link is already taken")] - DuplicateProfilePhotoLink, - /// Topic is already taken #[error("Topic is already taken")] DuplicateTopic, diff --git a/db/db-sqlx-sqlite/migrations/20220405113942_world_forges.sql b/db/db-sqlx-sqlite/migrations/20220405113942_world_forges.sql index 8a174c2..427c5a5 100644 --- a/db/db-sqlx-sqlite/migrations/20220405113942_world_forges.sql +++ b/db/db-sqlx-sqlite/migrations/20220405113942_world_forges.sql @@ -24,7 +24,7 @@ CREATE TABLE IF NOT EXISTS starchart_users ( hostname_id INTEGER NOT NULL REFERENCES starchart_forges(ID) ON DELETE CASCADE, username TEXT NOT NULL, html_url TEXT NOT NULL UNIQUE, - profile_photo_html_url TEXT DEFAULT NULL UNIQUE, + profile_photo_html_url TEXT DEFAULT NULL, added_on INTEGER NOT NULL, last_crawl_on INTEGER NOT NULL, ID INTEGER PRIMARY KEY NOT NULL diff --git a/db/db-sqlx-sqlite/src/errors.rs b/db/db-sqlx-sqlite/src/errors.rs index e6d8165..78e7607 100644 --- a/db/db-sqlx-sqlite/src/errors.rs +++ b/db/db-sqlx-sqlite/src/errors.rs @@ -40,8 +40,6 @@ pub fn map_register_err(e: Error) -> DBError { DBError::DuplicateForgeType } else if msg.contains("starchart_users.html_url") { DBError::DuplicateUserLink - } else if msg.contains("starchart_users.profile_photo_html_url") { - DBError::DuplicateProfilePhotoLink } else if msg.contains("starchart_project_topics.name") { DBError::DuplicateTopic } else if msg.contains("starchart_repositories.name") {