Documentation
¶
Index ¶
Constants ¶
const HistoryTableName = "_auditLogMigrations"
HistoryTableName is the table tracking which migrations have been applied.
It is deliberately separate from PocketBase's own "_migrations" table: the host application's "migrate up/down/history-sync" commands operate on that one, and sharing it would let them revert or forget the plugin's migrations.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
Register adds a migration to the list applied by Run.
The id is stored as-is in the history table and defines the apply order, so it must keep the timestamp prefix and never change once the migration has shipped in a release. Passing it explicitly, instead of deriving it from the file name, means renaming the file cannot silently re-apply the migration.
Registering the same id twice panics, and down may be nil for migrations that cannot be reverted.
func Revert ¶
Revert rolls back the last count applied migrations, most recent first, and removes them from the history table.
It exists so the plugin can be uninstalled cleanly; nothing calls it during a normal boot.
Types ¶
This section is empty.