22 KiB
v0.23.0-rc15 (WIP)
Caution
This is a prerelease intended for test and experimental purposes only!
-
Fixed rate limiter rules matching to acount for the
Audiencefield. -
Minor UI fixes (fixed duplicate record control, removed duplicated id field in the record preview, hide Impersonate button for non-auth records, auto sort rate limit rules, etc.).
v0.23.0-rc14
Caution
This is a prerelease intended for test and experimental purposes only!
-
Allow changing collate, sort and partial constraints for indexes on system fields.
-
Added system cron to run once a day
PRAGMA wal_checkpoint(TRUNCATE)as a fallback to assist in high traffic applications where the autocheckpoint may not be able to take its turn. Similar to thePRAGMA optimize, its execution is optional and even if it is not supported by a custom driver it will result only in a WARN app log.
Unless something else show up, this is expected to be the last release candidate before the final v0.23.0, planned to be released in the next 1-2 weeks. Because there were several experiments and changes in the rc versions regarding the migrations, if you had a v0.22.x app that you've migrated already to some of the other rc versions and have a full collections snapshot generated for it, note that you may have to regenerate the snapshot again (hopefully this would be the last time).
v0.23.0-rc13
Caution
This is a prerelease intended for test and experimental purposes only!
-
Added WakaTime OAuth2 provider (#5829; thanks @tigawanna).
-
Added
superuser otp EMAILcommand as fallback for generating superuser OTPs from the command line in case OTP has been enabled for the_superusersbut the SMTP server has deliverability issues. -
⚠️ Changed
OnRecordRequestOTPRequesthook to be triggered even if there is no record matching the email (aka.e.Recordcould benil), allowing you to manually create a new user with the OTP request and assigning it toe.Record. -
Added new
sentTosystem field to the_otpscollection (it is managed programmatically or by superusers; it could be anything - email, phone, messanger app id, etc.). By default when the OTP is submitted via email it is automatically populated with the user email address (via theOnMailerRecordOTPSendhook's finalizer). This allow us on validauth-with-otprequest to automatically mark the user email as verified. -
Added
RateLimitRule.Audienceoptional field for restricting a rate limit rule for"@guest"-only,"@auth"-only,""-any (default). -
Added default max limits for the expressions count and length of the search filter and sort params. This is just an extra measure mostly for the case when the filter and sort parameters are resolved outside of the request context since the request size limits won't apply.
-
Other minor changes (better error in case of duplicated rate limit rule, fixed typos, changed field id and name length validator to max 100, updated Go deps, etc.).
v0.23.0-rc12
Caution
This is a prerelease intended for test and experimental purposes only!
- Fixed validation error caused by the id change in v0.23.0-rc10 migration (#5820).
v0.23.0-rc11
Caution
This is a prerelease intended for test and experimental purposes only!
-
Fixed JSVM types errors (#5797).
-
Skip the default
loadAuthTokenmiddleware ife.Authis already loaded (#5800). -
Restored the API rules for the default initial "users" collection migration to be the same as in <= v0.22.x.
-
⚠️ Replaced the old Instagram provider with a new one that is compatible with the new Instagram Login APIs (#5588; thanks @pnmcosta). The provider key is
instagram2to prevent conflicts with existing linked users. -
⚠️ Changes regarding the first superuser creation based on #5814.
-
⚠️ Removed
apis.RequireSuperuserAuthOnlyIfAny()middleware. -
⚠️ Removed
RequestEvent.UnsafeRealIP()to prevent misuse and confusion withRequestEvent.RealIP()(the latter is considered safer because it checks the trusted proxy headers settings).
v0.23.0-rc10
Caution
This is a prerelease intended for test and experimental purposes only!
-
Restore the CRC32 checksum autogeneration for the collection/field ids in order to maintain deterministic default identifier value and minimize conflicts between custom migrations and full collections snapshots. There is a system migration that will attempt to normalize existing system collections ids, but if you already migrated to v0.23.0-rc and have generated a full collections snapshot migration, you have to delete it and regenerate a new one.
-
Change the behavior of the default generated collections snapshot migration to act as "extend" instead of "replace" to prevent accidental data deletion. I think this would be rare but if you want the old behaviour you can edit the generated snapshot file and replace the second argument (
deleteMissing) ofApp.ImportCollection/App.ImportCollectionsByMarshaledJSONfromfalsetotrue. -
Added
app.SubscriptionsBroker().TotalClients()helper method to return the total registered realtime clients (#5793).
v0.23.0-rc9
Caution
This is a prerelease intended for test and experimental purposes only!
-
Fixed auto
www.redirect due to missing URI schema. -
Fixed collection and field renaming when reusing an old collection/field name (#5741).
-
Update the "API preview" section to include information about the batch api.
-
Exported
core.DefaultDBConnectfunction that could be used as a fallback when initializing custom SQLite drivers and builds. -
⚠️ No longer loads the
mattn/go-sqlite3driver by default when building withCGO_ENABLED=1to avoidmultiple definition ...linker errors in case different CGO SQLite drivers or builds are used. This means that no matter of theCGO_ENABLEDvalue, now out of the box PocketBase will always use only the pure Go driver (modernc.org/sqlite). This will be documented properly in the new website but if you want to continue usingmattn/go-sqlite3(e.g. because of the icu or other builtin extension) you could register it as follow:package main import ( "database/sql" "log" "github.com/mattn/go-sqlite3" "github.com/pocketbase/dbx" "github.com/pocketbase/pocketbase" ) func init() { // initialize default PRAGMAs for each new connection sql.Register("pb_sqlite3", &sqlite3.SQLiteDriver{ ConnectHook: func(conn *sqlite3.SQLiteConn) error { _, err := conn.Exec(` PRAGMA busy_timeout = 10000; PRAGMA journal_mode = WAL; PRAGMA journal_size_limit = 200000000; PRAGMA synchronous = NORMAL; PRAGMA foreign_keys = ON; PRAGMA temp_store = MEMORY; PRAGMA cache_size = -16000; `, nil) return err }, }, ) dbx.BuilderFuncMap["pb_sqlite3"] = dbx.BuilderFuncMap["sqlite3"] } func main() { app := pocketbase.NewWithConfig(pocketbase.Config{ DBConnect: func(dbPath string) (*dbx.DB, error) { return dbx.Open("pb_sqlite3", dbPath) }, }) // custom hooks and plugins... if err := app.Start(); err != nil { log.Fatal(err) } }Also note that if you are not planning to use the
core.DefaultDBConnectfallback as part of your custom driver registration you can exclude the default pure Go driver from the build with the build tag-tags no_default_driverto reduce the binary size a little. -
⚠️ Removed JSVM
BaseCollection(),AuthCollection(),ViewCollection()class aliases for simplicity and to avoid confusion with the accepted constructor arguments (you can simply use as beforenew Collection({ type: "base", ... }); this will also initialize the default type specific options). -
Other minor improvements (added validator for duplicated index definitions, updated the impersonate popup styles, added query param support for loading a collection based on its name, etc.).
v0.23.0-rc8
Caution
This is a prerelease intended for test and experimental purposes only!
-
Lock the
_otpsand_mfassystem collections Delete API rule for superusers only. -
Reassign in the JSVM executors the global
$appvariable with the hook scopede.appvalue to minimize the risk of a deadlock when a hook or middleware is wrapped in a transaction. -
Reuse the OAuth2 created user record pointer to ensure that all its following hooks operate on the same record instance.
-
Added tags support for the
OnFileTokenRequesthook. -
Other minor changes (added index for the
_collectionstype column, added more detailed godoc for the collection fields andcore.Appmethods, fixed flaky record enrich tests, etc.).
v0.23.0-rc7
Caution
This is a prerelease intended for test and experimental purposes only!
-
Register the default panic-recover middleware after the activity logger so that we can log the error.
-
Updated the
RequestEvent.BindBodyFormData type inferring rules to convert numeric strings into float64 only if the resulting minimal number string representation matches the initial FormData string value (#5687). -
Fixed the JSVM types to include properly generated function declarations when the related Go functions have shortened/combined return values.
-
Reorganized the record table fields<->columns syncing to remove the
PRAGMA writable_schemausage.
v0.23.0-rc6
Caution
This is a prerelease intended for test and experimental purposes only!
-
Fixed realtime 403 API error on resubscribe (#5674).
-
Fixed the auto OAuth2 avatar mapped field assignment when the OAuth2 provider doesn't return an avatar URL (#5673). In case the avatar retrieval fails and the mapped record field "Required" option is not set, the error is silenced and only logged with WARN level.
-
Added
Router.SEARCH(path, action)helper method for registeringSEARCHendpoints. -
Changed all builtin middlewares to return
*hook.Handler[*core.RequestEvent]with a default middleware id for consistency and to allow removal. Or in other words, replace.BindFunc(apis.Gzip())with.Bind(apis.Gzip()). -
Updated the JSVM types to reflect the recent changes.
v0.23.0-rc5
Caution
This is a prerelease intended for test and experimental purposes only!
-
Added Notion OAuth2 provider (#4999; thanks @s-li1).
-
Added monday.com OAuth2 provider (#5346; thanks @Jaytpa01).
-
Added option to retrieve the OIDC OAuth2 user info from the
id_tokenpayload for the cases when the provider doesn't have a dedicated user info endpoint. -
Fixed the relation record picker to sort by default by
@rowidinstead of thecreatedfield as the latter is optional (#5641). -
Fixed the UI "Set Superusers only" button click not properly resetting the input state.
-
Fixed the OAuth2 providers logo path shown in the "Authorized providers" UI.
-
Fixed the single value UI for the
select,fileandrelationfields (#5646)
v0.23.0-rc4
Caution
This is a prerelease intended for test and experimental purposes only!
-
Fixed the UI settings update form to prevent sending empty string for the mail password or the S3 secret options on resave of the form.
-
⚠️ Added an exception for the
OAuth2field in the GO->JSVM name mapping rules:// old -> new collection.oAuth2.* -> collection.oauth2.* -
Added more user friendly view collection truncate error message.
-
Added an extra suffix character to the name of autogenerated template migration file for
*testsuffixed collections to prevent acidentally resulting in_test.gomigration files. -
Added
FieldsList.AddMarshaledJSON([]byte)helper method to load a serialized json array of objects or a single json object into an existing collection fields list. -
Fixed the autogenerated Go migration template when updating a collection (#5631).
⚠️ If you have already used a previous prerelease and have autogenerated Go migration files, please check the migration files named
{timestamp}_updated_{collection}.goand manually change:
To test that your Go migration files work correctly you can try to start PocketBase with a new temp pb_data, e.g.:Old (broken) New // add field / update field if err := json.Unmarshal([]byte(`[{ ... }]`), &collection.Fields); err != nil { return err }// add field / update field if err := collection.Fields.AddMarshaledJSON([]byte(`{ ... }`)); err != nil { return err }go run . serve --dir="pb_data_temp"
v0.23.0-rc3
Caution
This is a prerelease intended for test and experimental purposes only!
-
Make
PRAGMA optimizestatement optional in case it is not supported by the driver (#5611). -
Reapply the minimum required
pb_data/auxiliary.dbmigrations if the db file was manually deleted (#5618). -
To avoid confusion and unnecessary casting, the
hook.HandlerFunc[T]type has been removed and instead everywhere we now use directly the underlying function definition, aka.:func(T) error -
Fixed the UI input field type of the OTP.length field (#5617).
-
Other minor fixes (fixed API preview and examples error message typos, better hint for combined/multi-spaced view query columns, fixed the path for the HTTPS green favicon path, etc.).
v0.23.0-rc2
Caution
This is a prerelease intended for test and experimental purposes only!
- Small update to the earlier v0.23.0-rc that uses
pb_data/auxiliary.dbinstead ofpb_data/aux.dbbecause it seems that on Windowsauxis disallowed as file name (#5607). If you have already upgraded to v0.23.0-rc please rename manually yourpb_data/aux.dbfile topb_data/auxiliary.db.
v0.23.0-rc
Caution
This is a prerelease intended for test and experimental purposes only!
It introduces many Go/JSVM breaking changes and requires manual migration steps.
All new features will be reflected in the new website documentation with the final v0.23.0 release.
Note
Please note that you don't have to upgrade to PocketBase v0.23.0 if you are not planning further developing your existing app and/or are satisfied with the v0.22.x features set. There are no identified critical issues with PocketBase v0.22.x yet and in the case of critical bugs and security vulnerabilities, the fixes will be backported for at least until Q1 of 2025 (if not longer).
If you don't plan upgrading just make sure to pin the SDKs version to their latest PocketBase v0.22.x compatible:
- JS SDK:
<0.22.0- Dart SDK:
<0.19.0
PocketBase v0.23.0-rc is a major refactor of the internals with the overall goal of making PocketBase an easier to use Go framework.
There are many changes but to highlight some of the most notable ones:
- Replaced
echowith a new router built on top of the Go 1.22net/httpmux enhancements. - Merged
daospackages incore.Appto simplify the DB operations (themodelspackage structs are also migrated incore). - Option to specify custom
DBConnectfunction as part of the app configuration to allow differentdatabase/sqlSQLite drivers (turso/libsql, sqlcipher, etc.) and custom builds. - New hooks allowing better control over the execution chain and error handling (including wrapping an entire hook chain in a single DB transaction).
- Various
Recordmodel improvements (support for get/set modifiers, simplfied file upload by treating the file(s) as regular field value likerecord.Set("document", file), etc.). - Dedicated fields structs with safer defaults to make it easier creating/updating collections programmatically.
- Option to mark field as Private/Hidden, disallowing regular users to read or modify it (there is also a dedicated Record hook to hide/unhide Record fields programmatically from a single place).
- Option to customize the default system collection fields (
id,email,password, etc.). - Admins are now system
_superusersauth records. - Builtin rate limiter (supports tags, wildcards and exact routes matching).
- Batch/transactional Web API endpoint.
- Impersonate Web API endpoint (it could be also used for generating fixed/non-refreshable superuser tokens, aka. "API keys").
- Support for custom user request activity log attributes.
- One-Time Password (OTP) auth method (via email code).
- Multi-Factor Authentication (MFA) support (currently requires any 2 different auth methods to be used).
- Support for Record "proxy/projection" in preparation for the planned autogeneration of typed Go record models.
- Various minor UI improvements (recursive
Presentableview, slightly different collection options organization, zoom/pan for the logs chart, etc.) - and many more...
In terms of performance, the Go standard router mux is known to be slightly slower compared to Gin, Echo, etc. implementations, but based on my local tests the difference is negliable. The benchmarks repo will be updated with the final v0.23.0 release (currently there seems to be ~10% memory consumption increase which I'll have to investigate to see whether it is from the router change or from the new hooks).
Go/JSVM APIs changes
For upgrading to PocketBase v0.23.0, please refer to:
SDKs changes
Web APIs changes
-
New
POST /api/batchendpoint. -
New
GET /api/collections/meta/scaffoldsendpoint. -
New
DELETE /api/collections/{collection}/truncateendpoint. -
New
POST /api/collections/{collection}/request-otpendpoint. -
New
POST /api/collections/{collection}/auth-with-otpendpoint. -
New
POST /api/collections/{collection}/impersonate/{id}endpoint. -
⚠️ Removed
/api/admins/*endpoints because admins are converted to_superusersauth collection records. -
⚠️ Previously when uploading new files to a multiple
filefield, new files were automatically appended to the existing field values. This behaviour has changed with v0.23+ and for consistency with the other multi-valued fields when uploading new files they will replace the old ones. If you want to prepend or append new files to an existing multiplefilefield value you can use the+prefix or suffix:"documents": [file1, file2] // => [file1_name, file2_name] "+documents": [file1, file2] // => [file1_name, file2_name, old1_name, old2_name] "documents+": [file1, file2] // => [old1_name, old2_name, file1_name, file2_name] -
⚠️ Removed
GET /records/{id}/external-authsandDELETE /records/{id}/external-auths/{provider}endpoints because this is now handled by sending list and delete requests to the_externalAuthscollection. -
⚠️ Changes to the app settings model fields and response (+new options such as
trustedProxy,rateLimits,batch, etc.). The app settings Web APIs are mostly used by the Dashboard UI and rarely by the end users, but if you want to check all settings changes please refer to the Settings Go struct. -
⚠️ New flatten Collection model and fields structure. The Collection model Web APIs are mostly used by the Dashboard UI and rarely by the end users, but if you want to check all changes please refer to the Collection Go struct.
-
⚠️ The top level error response
codekey was renamed tostatusfor consistency with the Go APIs. The error field key remainscode:{ "status": 400, // <-- old: "code" "message": "Failed to create record.", "data": { "title": { "code": "validation_required", "message": "Missing required value." } } } -
⚠️ New fields in the
GET /api/collections/{collection}/auth-methodsresponse. The oldauthProviders,usernamePassword,emailPasswordfields are still returned in the response but are considered deprecated and will be removed in the future.{ "mfa": { "duration": 100, "enabled": true }, "otp": { "duration": 0, "enabled": false }, "password": { "enabled": true, "identityFields": ["email", "username"] }, "oauth2": { "enabled": true, "providers": [{"name": "gitlab", ...}, {"name": "google", ...}] }, // old fields... } -
⚠️ Soft-deprecated the OAuth2 auth success
meta.avatarUrlfield in favour ofmeta.avatarURL.