db

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package db opens the configured database (SQLite or Postgres) through GORM and runs migrations. SQLite uses the pure-Go glebarez driver so the final binary needs no cgo.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(gdb *gorm.DB, extraModels ...any) error

Migrate auto-migrates the core schema plus any extra (plugin) models, then runs one-off data migrations. Call this once, after every plugin has been registered, before serving traffic.

func Open

func Open(cfg *config.Config) (*gorm.DB, error)

Open connects to the database WITHOUT migrating. Migration is deferred to Migrate so that plugin-contributed models (registered after Open) are migrated together with the core schema in a single pass — see the plugin package for why AutoMigrate must not run at open time.

Types

This section is empty.

Jump to

Keyboard shortcuts

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