feat(03-01): add shared postgres pool and plugin migrations

Open one pgx stdlib *sql.DB, hand it to GORM, and run per-plugin
gormigrate sets with isolated history tables after an ICU pl-PL check.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jakub Zych
2026-09-17 19:55:33 +02:00
parent 15a8389e46
commit d0d845052b
18 changed files with 700 additions and 22 deletions

View File

@@ -4,6 +4,7 @@ import (
"io/fs"
"git.golem15.com/golem15/summercms/bonfire"
"github.com/go-gormigrate/gormigrate/v2"
)
// HasCommands is implemented by plugins that register console commands.
@@ -18,19 +19,24 @@ type HasConfig interface {
ConfigFS() fs.FS
}
// HasMigrations is implemented by plugins that ship an ordered gormigrate
// set. The kernel runs each set in party.Activate order with a separate
// history table per plugin ID.
type HasMigrations interface {
Migrations() []*gormigrate.Migration
}
// OptionalMessage is a service an optional plugin may publish so other
// plugins can integrate without importing that plugin's package.
type OptionalMessage interface {
Message() string
}
// Future KERN-03 capability families are type-asserted when their first
// consumer packages exist. Method payloads are not declared here so pact
// does not import surf, lagoon, festival, or other packages that Phase 1
// does not yet ship:
// Future capability families are type-asserted when their first consumer
// packages exist. Method payloads for HTTP/model surfaces are declared in
// the phase that ships surf:
//
// HasModels
// HasMigrations
// HasRoutes
// HasMiddleware
// HasJobs
@@ -42,5 +48,5 @@ type OptionalMessage interface {
// HasMailTemplates
// HasLang
//
// Phase 1 type-asserts only HasConfig (party, before Register) and
// HasCommands (generated app main, after Boot).
// The kernel type-asserts HasConfig (party, before Register), HasCommands
// (generated app main, after Boot), and HasMigrations (lagoon migrate).