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