+9
-1
appview/db/db.go
+9
-1
appview/db/db.go
···
260
260
did text not null,
261
261
262
262
-- data
263
+
avatar text,
263
264
description text not null,
264
265
include_bluesky integer not null default 0,
265
266
location text,
···
1078
1079
// transfer data, constructing pull_at from pulls table
1079
1080
_, err = tx.Exec(`
1080
1081
insert into pull_submissions_new (id, pull_at, round_number, patch, created)
1081
-
select
1082
+
select
1082
1083
ps.id,
1083
1084
'at://' || p.owner_did || '/sh.tangled.repo.pull/' || p.rkey,
1084
1085
ps.round_number,
···
1169
1170
1170
1171
create index if not exists idx_stars_created on stars(created);
1171
1172
create index if not exists idx_stars_subject_at_created on stars(subject_at, created);
1173
+
`)
1174
+
return err
1175
+
})
1176
+
1177
+
orm.RunMigration(conn, logger, "add-avatar-to-profile", func(tx *sql.Tx) error {
1178
+
_, err := tx.Exec(`
1179
+
alter table profile add column avatar text;
1172
1180
`)
1173
1181
return err
1174
1182
})
+10
-3
appview/db/profile.go
+10
-3
appview/db/profile.go
···
128
128
_, err = tx.Exec(
129
129
`insert or replace into profile (
130
130
did,
131
+
avatar,
131
132
description,
132
133
include_bluesky,
133
134
location,
134
135
pronouns
135
136
)
136
-
values (?, ?, ?, ?, ?)`,
137
+
values (?, ?, ?, ?, ?, ?)`,
137
138
profile.Did,
139
+
profile.Avatar,
138
140
profile.Description,
139
141
includeBskyValue,
140
142
profile.Location,
···
312
314
func GetProfile(e Execer, did string) (*models.Profile, error) {
313
315
var profile models.Profile
314
316
var pronouns sql.Null[string]
317
+
var avatar sql.Null[string]
315
318
316
319
profile.Did = did
317
320
318
321
includeBluesky := 0
319
322
320
323
err := e.QueryRow(
321
-
`select description, include_bluesky, location, pronouns from profile where did = ?`,
324
+
`select avatar, description, include_bluesky, location, pronouns from profile where did = ?`,
322
325
did,
323
-
).Scan(&profile.Description, &includeBluesky, &profile.Location, &pronouns)
326
+
).Scan(&avatar, &profile.Description, &includeBluesky, &profile.Location, &pronouns)
324
327
if err == sql.ErrNoRows {
325
328
profile := models.Profile{}
326
329
profile.Did = did
···
337
340
338
341
if pronouns.Valid {
339
342
profile.Pronouns = pronouns.V
343
+
}
344
+
345
+
if avatar.Valid {
346
+
profile.Avatar = avatar.V
340
347
}
341
348
342
349
rows, err := e.Query(`select link from profile_links where did = ?`, did)