fixed autogenerated go collection update migration template
This commit is contained in:
47
CHANGELOG.md
47
CHANGELOG.md
@@ -1,10 +1,55 @@
|
||||
## v0.23.0-rc4 (WIP)
|
||||
## v0.23.0-rc4
|
||||
|
||||
> [!CAUTION]
|
||||
> **This is a prerelease intended for test and experimental purposes only!**
|
||||
|
||||
- Added more user friendly view collection truncate error message.
|
||||
|
||||
- Added `FieldsList.AddMarshaledJSON(json)` helper method to load a serialized json array of objects or a single json object into an existing collection fields list.
|
||||
|
||||
- Added an extra suffix character to the name of autogenerated template migration file for `*test` suffixed collections to prevent acidentally resulting in `_test.go` migration files.
|
||||
|
||||
- Fixed the autogenerated Go migration template when updating a collection ([#5631](https://github.com/pocketbase/pocketbase/discussions/5631)).
|
||||
|
||||
⚠️ If you have already used a previous prerelease and have autogenerated Go migration files, please check the migration files **`{timestamp}_updated_{collection}.go`** and change manually:
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<th width="50%">Old (broken)</th>
|
||||
<th width="50%">New</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="50%">
|
||||
|
||||
```go
|
||||
// add field / update field
|
||||
if err := json.Unmarshal([]byte(`[{
|
||||
...
|
||||
}]`), &collection.Fields); err != nil {
|
||||
return err
|
||||
}
|
||||
```
|
||||
|
||||
</td>
|
||||
<td width="50%">
|
||||
|
||||
```go
|
||||
// add field / update field
|
||||
if err := collection.Fields.AddMarshaledJSON([]byte(`{
|
||||
...
|
||||
}`)); err != nil {
|
||||
return err
|
||||
}
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
To test that your Go migration files works correctly you can try to start PocketBase with a new temp pb_data, e.g.:
|
||||
|
||||
```go
|
||||
go run . serve --dir="pb_data_temp"
|
||||
```
|
||||
|
||||
## v0.23.0-rc3
|
||||
|
||||
|
||||
Reference in New Issue
Block a user