Update migrator

This commit is contained in:
Lukas Schulte Pelkum 2021-07-22 22:21:18 +02:00
parent daa66e439c
commit 233fa23a78
No known key found for this signature in database
GPG Key ID: 408DA7CA81DB885C
2 changed files with 7 additions and 0 deletions

View File

@ -7,6 +7,8 @@ Pasty is a fast and lightweight code pasting server
> Instances using **PostgreSQL** are **not affected** as a corresponding SQL migration will run before the first startup.
> If you however use **another storage driver** you may have to **update the entries** by hand or using a simple query, depending on your driver as I don't plan to ship migrations for every single storage driver.
> It may be important to know that the **data migrator has been upgraded** too. This may serve as a **convenient workaround** (export data (field will be renamed) and import data with changed field names again).
>
> The old `deletionToken` field will be processed corresponding to these changes but I strongly recommend updating old pastes if possible.
> Additionally, I changed the three `DELETION_TOKEN*`environment variables to their corresponding `MODIFICATION_TOKEN*` ones:
> - `DELETION_TOKENS` -> `MODIFICATION_TOKENS`

View File

@ -65,6 +65,11 @@ func main() {
log.Println("[INFO] Paste " + id + " was a legacy one.")
}
// Initialize a new metadata map if the old one is null
if paste.Metadata == nil {
paste.Metadata = make(map[string]interface{})
}
// Save the paste
err = to.Save(paste)
if err != nil {