storage

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const InstallIDKey = "install_id"

InstallIDKey is the settings key holding this deployment's stable Install ID.

Variables

This section is empty.

Functions

func ConnectPostgres

func ConnectPostgres(dsn string) (*gorm.DB, error)

ConnectPostgres opens a GORM connection to PostgreSQL without running migrations.

func EnsureInstallID

func EnsureInstallID(db *gorm.DB) (string, error)

EnsureInstallID returns this instance's stable Install ID, generating and persisting one on first call. The ID is immutable for the life of the deployment: it uniquely identifies the instance to the license/customer portal (a customer copies it when purchasing a license), so it must survive restarts and never change. Idempotent and race-safe across concurrent boots (server + worker) via FirstOrCreate.

func NewRedis

func NewRedis(addr, password string, db int) (*redis.Client, error)

NewRedis creates and verifies a Redis client on the given database index.

func SeedAdmin

func SeedAdmin(db *gorm.DB, email, password string) (*models.User, error)

SeedAdmin ensures a platform admin exists: returns the existing admin if one is already present, otherwise creates one from the configured credentials. Idempotent — safe to run on every boot. (Mirrors the Posta admin seeder.)

func SeedDefaultOrganization

func SeedDefaultOrganization(db *gorm.DB) (*models.Organization, error)

SeedDefaultOrganization ensures exactly one default organization exists — the realm new workspaces and SSO providers attach to. Idempotent; safe on every boot. Returns the default org.

func SeedPlans

func SeedPlans(db *gorm.DB) error

SeedPlans creates the built-in plan catalog on first boot if no plans exist. Idempotent — a no-op once any plan is present (so admin edits are preserved). Limits use -1 for unlimited, 0 for none. "Free" is the default plan.

Types

This section is empty.

Directories

Path Synopsis
Package logbackfill migrates pre-existing large log rows out of Postgres into the shared log store (see plans/log-storage.md, sub-phase P6).
Package logbackfill migrates pre-existing large log rows out of Postgres into the shared log store (see plans/log-storage.md, sub-phase P6).
upgrade
Package upgrade runs ordered, versioned data-upgrade steps.
Package upgrade runs ordered, versioned data-upgrade steps.

Jump to

Keyboard shortcuts

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