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
··· 1287 1287 return err 1288 1288 }) 1289 1289 1290 + // we cannot modify user-owned record on repository delete 1291 + orm.RunMigration(conn, logger, "remove-foreign-key-profile_pinned_repositories-and-repos", func(tx *sql.Tx) error { 1292 + _, err := tx.Exec(` 1293 + create table profile_pinned_repositories_new ( 1294 + did text not null, 1295 + 1296 + -- data 1297 + at_uri text not null, 1298 + 1299 + -- constraints 1300 + unique(did, at_uri), 1301 + foreign key (did) references profile(did) on delete cascade 1302 + ); 1303 + 1304 + insert into profile_pinned_repositories_new (did, at_uri) 1305 + select did, at_uri from profile_pinned_repositories; 1306 + 1307 + drop table profile_pinned_repositories; 1308 + alter table profile_pinned_repositories_new rename to profile_pinned_repositories; 1309 + `) 1310 + return err 1311 + }) 1312 + 1290 1313 return &DB{ 1291 1314 db, 1292 1315 logger,