[#2570] fixed default PRAGMAs not being applied for new connections

This commit is contained in:
Gani Georgiev
2023-05-27 09:04:01 +03:00
parent 833a84b3d7
commit f6a616b7e8
36 changed files with 99 additions and 73 deletions
+20
View File
@@ -0,0 +1,20 @@
package migrations
import (
"github.com/pocketbase/dbx"
)
// Cleanup dangling deleted collections references
// (see https://github.com/pocketbase/pocketbase/discussions/2570).
func init() {
AppMigrations.Register(func(db dbx.Builder) error {
_, err := db.NewQuery(`
DELETE FROM {{_externalAuths}}
WHERE [[collectionId]] NOT IN (SELECT [[id]] FROM {{_collections}})
`).Execute()
return err
}, func(db dbx.Builder) error {
return nil
})
}