Monorepo for Tangled tangled.org

appview/db: more flexible tables #996

open opened by boltless.me targeting master from sl/sqkrqopzkvoo

migrate tables: stars, reactions, follows, public_keys

Two major changes:

  1. Remove autoincrement id for these tables.

AUTOINCREMENT primary key does not help much for these tables and only introduces slice performance overhead. Use default rowid with non-autoincrement integer instead.

  1. Remove unique constraints other than (did, rkey)

We cannot block users creating non-unique atproto records. Appview needs to handle those properly. For example, if user unstar a repo, appview should delete all existing star records pointing to that repo.

To allow this, remove all constraints other than (did, rkey).

Minor changes done while migrating tables:

  • rename thread_at in reactions to subject_at to match with other tables
  • follow common column names like did and created
  • allow self-follow (similar reason to 2nd major change. we should block it from service layer instead)

Signed-off-by: Seongmin Lee git@boltless.me

Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:xasnlahkri4ewmbuzly2rlc5/sh.tangled.repo.pull/3mcsfwwhtpn22
+8 -8
Interdiff #0 #1
+8 -8
appview/db/db.go
··· 1197 return err 1198 }) 1199 1200 // several changes here 1201 // 1. remove autoincrement id for these tables 1202 // 2. remove unique constraints other than (did, rkey) to handle non-unique atproto records ··· 1307 }) 1308 1309 return &DB{ 1310 - db, 1311 - logger, 1312 - 1313 - 1314 - return err 1315 - }) 1316 - 1317 - return &DB{ 1318 db, 1319 logger,
··· 1197 return err 1198 }) 1199 1200 + return &DB{ 1201 + db, 1202 + logger, 1203 + 1204 + 1205 + return err 1206 + }) 1207 + 1208 // several changes here 1209 // 1. remove autoincrement id for these tables 1210 // 2. remove unique constraints other than (did, rkey) to handle non-unique atproto records ··· 1315 }) 1316 1317 return &DB{ 1318 db, 1319 logger,
appview/db/follow.go

This file has not been changed.

appview/db/reaction.go

This file has not been changed.

appview/db/timeline.go

This file has not been changed.

History

2 rounds 0 comments
sign up or login to add to the discussion
1 commit
expand
appview/db: more flexible tables
2/3 failed, 1/3 success
expand
merge conflicts detected
expand
  • appview/pages/markup/markdown.go:47
  • appview/pages/pages.go:57
expand 0 comments
1 commit
expand
appview/db: more flexible tables
3/3 success
expand
expand 0 comments