Documentation
¶
Overview ¶
Package migrationx provides Kernel's SQL migration integration layer.
It intentionally keeps SQL as the source of truth. Proto describes API and access contracts; database structure lives in migrations/ and is applied or validated by Kernel boot.
Index ¶
Constants ¶
View Source
const ( ModeDisabled = "disabled" ModeDevApply = "dev_apply" ModeApply = "apply" ModeValidate = "validate" ModeGORMDevAuto = "gorm_dev_auto" )
Variables ¶
This section is empty.
Functions ¶
func ApplyMigrations ¶
ApplyMigrations applies or validates a prepared migration set.
Types ¶
type Config ¶
type Config struct {
Enabled bool `json:"enabled" yaml:"enabled"`
Engine string `json:"engine" yaml:"engine"`
Dir string `json:"dir" yaml:"dir"`
Table string `json:"table" yaml:"table"`
Mode string `json:"mode" yaml:"mode"`
FailOnPending bool `json:"fail_on_pending" yaml:"fail_on_pending"`
// AllowConcurrent explicitly allows startup-time applying migrations while
// the deployment has more than one replica. Leave false for production unless
// an external migration job or database advisory lock strategy is in place.
AllowConcurrent bool `json:"allow_concurrent" yaml:"allow_concurrent"`
}
Config controls service startup migration behavior.
type Migration ¶
type Migration struct {
Version string
Name string
Path string
UpSQL string
DownSQL string
Checksum string
}
Migration is one discovered SQL migration.
Click to show internal directories.
Click to hide internal directories.