Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package migratecmd adds a new "migrate" command support to a PocketBase instance.
It also comes with automigrations support and templates generation (both for JS and GO migration files).
Example usage:
migratecmd.MustRegister(app, app.RootCmd, &migratecmd.Options{
	TemplateLang: migratecmd.TemplateLangJS, // default to migratecmd.TemplateLangGo
	Automigrate:  true,
	Dir:          "migrations_dir_path", // optional template migrations path; default to "pb_migrations" (for JS) and "migrations" (for Go)
})
Note: To allow running JS migrations you'll need to enable first
[jsvm.MustRegisterMigrations].
Index ¶
Constants ¶
      View Source
      
  
const ( TemplateLangJS = "js" TemplateLangGo = "go" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
	// Dir specifies the directory with the user defined migrations.
	//
	// If not set it fallbacks to a relative "pb_data/../pb_migrations" (for js)
	// or "pb_data/../migrations" (for go) directory.
	Dir string
	// Automigrate specifies whether to enable automigrations.
	Automigrate bool
	// TemplateLang specifies the template language to use when
	// generating migrations - js or go (default).
	TemplateLang string
}
    Options defines optional struct to customize the default plugin behavior.
 Click to show internal directories. 
   Click to hide internal directories.