···11811181 return err11821182 })1183118311841184+ orm.RunMigration(conn, logger, "remove-profile-stats-column-constraint", func(tx *sql.Tx) error {11851185+ _, err := tx.Exec(`11861186+ -- create new table without the check constraint11871187+ create table profile_stats_new (11881188+ id integer primary key autoincrement,11891189+ did text not null,11901190+ kind text not null, -- no constraint this time11911191+ foreign key (did) references profile(did) on delete cascade11921192+ );11931193+11941194+ -- copy data from old table11951195+ insert into profile_stats_new (id, did, kind)11961196+ select id, did, kind11971197+ from profile_stats;11981198+11991199+ -- drop old table12001200+ drop table profile_stats;12011201+12021202+ -- rename new table12031203+ alter table profile_stats_new rename to profile_stats;12041204+ `)12051205+ return err12061206+ })12071207+11841208 return &DB{11851209 db,11861210 logger,
+3-1
appview/db/profile.go
···451451 query = `select count(id) from repos where did = ?`452452 args = append(args, did)453453 case models.VanityStatStarCount:454454- query = `select count(id) from stars where did = ?`454454+ query = `select count(id) from stars where subject_at like 'at://' || ? || '%'`455455 args = append(args, did)456456+ default:457457+ return 0, fmt.Errorf("invalid vanity stat kind: %s", stat)456458 }457459458460 var result uint64
+1-1
appview/models/profile.go
···7777 case VanityStatRepositoryCount:7878 return "Repositories"7979 case VanityStatStarCount:8080- return "Stars"8080+ return "Stars Received"8181 }8282 return ""8383}