You've already forked pocketbase
mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-11-25 23:52:32 +02:00
added automigrate tests
This commit is contained in:
@@ -72,11 +72,19 @@ func Register(app core.App, rootCmd *cobra.Command, options *Options) error {
|
||||
|
||||
// watch for collection changes
|
||||
if p.options.Automigrate {
|
||||
// refresh the cache right after app bootstap
|
||||
p.app.OnAfterBootstrap().Add(func(e *core.BootstrapEvent) error {
|
||||
p.refreshCachedCollections()
|
||||
return nil
|
||||
})
|
||||
|
||||
// refresh the cache to ensure that it constains the latest changes
|
||||
// when migrations are applied on server start
|
||||
p.app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
||||
p.refreshCachedCollections()
|
||||
return nil
|
||||
})
|
||||
|
||||
p.app.OnModelAfterCreate().Add(p.afterCollectionChange())
|
||||
p.app.OnModelAfterUpdate().Add(p.afterCollectionChange())
|
||||
p.app.OnModelAfterDelete().Add(p.afterCollectionChange())
|
||||
|
||||
Reference in New Issue
Block a user