migrations

package
v0.0.0-...-5d49e15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

*

  • Default Superuser Creation Migration *
  • This migration creates the initial administrator account in PocketBase.
  • It is assigned the priority 0 (filename starts with 0_) to ensure it runs before all
  • other migrations during application initialization. *
  • The migration performs the following steps:
  • 1. Finds the superusers collection in PocketBase
  • 2. Creates a new superuser with the predefined email address
  • 3. Generates a random password for this account
  • 4. Saves the newly created superuser to the database *
  • Note: For production environments, consider modifying this code to use specific
  • credentials rather than a random password for better security management.

*

  • Users Collection Modification Migration *
  • This migration modifies the security rules for the built-in users collection
  • in PocketBase. It sets the CreateRule to nil, which restricts user creation
  • to superusers only (removing the ability for public user registration). *
  • This is an important security measure for applications where user accounts
  • should only be created by administrators. *
  • The migration includes:
  • 1. Finding the existing users collection
  • 2. Setting its CreateRule to nil (superuser only)
  • 3. Saving the modified collection back to the database

*

  • Default Application Settings Migration *
  • This migration configures the default application settings for the ResMon application.
  • It is assigned a high priority number (1000) to ensure it runs after core system
  • migrations but before application-specific data migrations. *
  • The migration sets various PocketBase configuration parameters, including:
  • 1. Meta settings: Application name, URL, email sender information
  • 2. Log settings: Retention period and privacy options
  • 3. Backup settings: Scheduled backups and retention policy
  • 4. Security settings: Rate limiting for API endpoints *
  • Note: The migration does not include a "down" function (second parameter is nil)
  • which means these settings cannot be automatically reverted.

Index

Constants

View Source
const InitialAdminEmail = "__initial_superuser@example.com"

InitialAdminEmail defines the email address used for the default superuser account

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL