mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-23 05:16:14 -06:00
[bugfix] Fix app migration
This commit is contained in:
parent
24da574684
commit
9cefe85902
1 changed files with 15 additions and 1 deletions
|
|
@ -92,8 +92,22 @@ func init() {
|
|||
// Convert all the old model applications into new ones.
|
||||
newApps := make([]*newmodel.Application, 0, len(oldApps))
|
||||
for _, oldApp := range oldApps {
|
||||
newAppID := id.NewULIDFromTime(oldApp.CreatedAt)
|
||||
|
||||
// Update application ID on any
|
||||
// statuses that used this app.
|
||||
if _, err := tx.
|
||||
NewUpdate().
|
||||
Table("statuses").
|
||||
Set("? = ?", bun.Ident("created_with_application_id"), newAppID).
|
||||
Where("? = ?", bun.Ident("created_with_application_id"), oldApp.ID).
|
||||
Exec(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Add the new app to the slice for insertion.
|
||||
newApps = append(newApps, &newmodel.Application{
|
||||
ID: id.NewULIDFromTime(oldApp.CreatedAt),
|
||||
ID: newAppID,
|
||||
Name: oldApp.Name,
|
||||
Website: oldApp.Website,
|
||||
RedirectURIs: []string{oldApp.RedirectURI},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue