A vibe coded tangled fork which supports pijul.

appview/db: remove foreign key constraint between collections

Appview cannot modify the user-owned record on repository deletion

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

+23
+23
appview/db/db.go
··· 1242 1242 return err 1243 1243 }) 1244 1244 1245 + // we cannot modify user-owned record on repository delete 1246 + orm.RunMigration(conn, logger, "remove-foreign-key-profile_pinned_repositories-and-repos", func(tx *sql.Tx) error { 1247 + _, err := tx.Exec(` 1248 + create table profile_pinned_repositories_new ( 1249 + did text not null, 1250 + 1251 + -- data 1252 + at_uri text not null, 1253 + 1254 + -- constraints 1255 + unique(did, at_uri), 1256 + foreign key (did) references profile(did) on delete cascade 1257 + ); 1258 + 1259 + insert into profile_pinned_repositories_new (did, at_uri) 1260 + select did, at_uri from profile_pinned_repositories; 1261 + 1262 + drop table profile_pinned_repositories; 1263 + alter table profile_pinned_repositories_new rename to profile_pinned_repositories; 1264 + `) 1265 + return err 1266 + }) 1267 + 1245 1268 return &DB{ 1246 1269 db, 1247 1270 logger,