Signed-off-by: Anirudh Oppiliappan anirudh@tangled.org
+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,
···
1173
1174
return err
1174
1175
})
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
+
})
1183
+
1176
1184
return &DB{
1177
1185
db,
1178
1186
logger,
+10
-3
appview/db/profile.go
+10
-3
appview/db/profile.go
···
135
135
_, err = tx.Exec(
136
136
`insert or replace into profile (
137
137
did,
138
+
avatar,
138
139
description,
139
140
include_bluesky,
140
141
location,
141
142
pronouns
142
143
)
143
-
values (?, ?, ?, ?, ?)`,
144
+
values (?, ?, ?, ?, ?, ?)`,
144
145
profile.Did,
146
+
profile.Avatar,
145
147
profile.Description,
146
148
includeBskyValue,
147
149
profile.Location,
···
324
326
func GetProfile(e Execer, did string) (*models.Profile, error) {
325
327
var profile models.Profile
326
328
var pronouns sql.Null[string]
329
+
var avatar sql.Null[string]
327
330
328
331
profile.Did = did
329
332
330
333
includeBluesky := 0
331
334
332
335
err := e.QueryRow(
333
-
`select description, include_bluesky, location, pronouns from profile where did = ?`,
336
+
`select avatar, description, include_bluesky, location, pronouns from profile where did = ?`,
334
337
did,
335
-
).Scan(&profile.Description, &includeBluesky, &profile.Location, &pronouns)
338
+
).Scan(&avatar, &profile.Description, &includeBluesky, &profile.Location, &pronouns)
336
339
if err == sql.ErrNoRows {
337
340
profile := models.Profile{}
338
341
profile.Did = did
···
351
354
profile.Pronouns = pronouns.V
352
355
}
353
356
357
+
if avatar.Valid {
358
+
profile.Avatar = avatar.V
359
+
}
360
+
354
361
rows, err := e.Query(`select link from profile_links where did = ?`, did)
355
362
if err != nil {
356
363
return nil, err
History
7 rounds
0 comments
anirudh.fi
submitted
#6
1 commit
expand
collapse
appview/{db,models}: add avatar to profile
Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.org>
expand 0 comments
pull request successfully merged
anirudh.fi
submitted
#5
1 commit
expand
collapse
appview/{db,models}: add avatar to profile
Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.org>
expand 0 comments
anirudh.fi
submitted
#4
1 commit
expand
collapse
appview/{db,models}: add avatar to profile
Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.org>
expand 0 comments
anirudh.fi
submitted
#3
1 commit
expand
collapse
appview/{db,models}: add avatar to profile
Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.org>
expand 0 comments
anirudh.fi
submitted
#2
1 commit
expand
collapse
appview/{db,models}: add avatar to profile
Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.org>
expand 0 comments
anirudh.fi
submitted
#1
1 commit
expand
collapse
appview/{db,models}: add avatar to profile
Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.org>
expand 0 comments
anirudh.fi
submitted
#0
1 commit
expand
collapse
appview/{db,models}: add avatar to profile
Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.org>