Monorepo for Tangled tangled.org

appview/db: remove foreign key constraint between collections #995

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

Appview cannot modify the user-owned record on repository deletion

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/3mcsfwwhtn622
+23
Diff #0
+23
appview/db/db.go
··· 1173 1173 return err 1174 1174 }) 1175 1175 1176 + // we cannot modify user-owned record on repository delete 1177 + orm.RunMigration(conn, logger, "remove-foreign-key-profile_pinned_repositories-and-repos", func(tx *sql.Tx) error { 1178 + _, err := tx.Exec(` 1179 + create table profile_pinned_repositories_new ( 1180 + did text not null, 1181 + 1182 + -- data 1183 + at_uri text not null, 1184 + 1185 + -- constraints 1186 + unique(did, at_uri), 1187 + foreign key (did) references profile(did) on delete cascade 1188 + ); 1189 + 1190 + insert into profile_pinned_repositories_new (did, at_uri) 1191 + select did, at_uri from profile_pinned_repositories; 1192 + 1193 + drop table profile_pinned_repositories; 1194 + alter table profile_pinned_repositories_new rename to profile_pinned_repositories; 1195 + `) 1196 + return err 1197 + }) 1198 + 1176 1199 return &DB{ 1177 1200 db, 1178 1201 logger,

Submissions

sign up or login to add to the discussion
boltless.me submitted #0
1 commit
expand
appview/db: remove foreign key constraint between collections
3/3 failed
expand
no conflicts, ready to merge