this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

do nothing on conflict inserts

+2 -2
+2 -2
database.go
··· 106 106 } 107 107 108 108 func addFeedItem(_ context.Context, db *sql.DB, feedItem feedItem) error { 109 - sql := `INSERT INTO feed (uri, userDID, parentURI) VALUES (?, ?, ?);` 109 + sql := `INSERT INTO feed (uri, userDID, parentURI) VALUES (?, ?, ?) ON CONFLICT(uri, userDID) DO NOTHING;` 110 110 _, err := db.Exec(sql, feedItem.URI, feedItem.UserDID, feedItem.parentURI) 111 111 if err != nil { 112 112 return fmt.Errorf("exec insert feed item: %w", err) ··· 161 161 } 162 162 163 163 func addSubscriptionForParent(db *sql.DB, parentURI, userDid string) error { 164 - sql := `INSERT INTO subscriptions (parentURI, userDID) VALUES (?, ?);` 164 + sql := `INSERT INTO subscriptions (parentURI, userDID) VALUES (?, ?) ON CONFLICT(parentURI, userDID) DO NOTHING;` 165 165 _, err := db.Exec(sql, parentURI, userDid) 166 166 if err != nil { 167 167 return fmt.Errorf("exec insert subscrptions: %w", err)