migrate

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package migrate owns the forward-only SQLite migration registry and runner. Version numbers are never reused. History edits fail startup loudly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, database *gorm.DB, registry []Migration) error

Run applies pending migrations in registry order. Each migration runs in one transaction together with its history row.

Types

type Migration

type Migration struct {
	Version int64
	Name    string
	Up      func(transaction *gorm.DB) error
}

Migration is one numbered schema change.

type SchemaMigration

type SchemaMigration struct {
	Version   int64     `gorm:"primaryKey"`
	Name      string    `gorm:"not null"`
	AppliedAt time.Time `gorm:"not null"`
}

SchemaMigration records one applied migration.

func (SchemaMigration) TableName

func (SchemaMigration) TableName() string

TableName pins the migrations table name.

Jump to

Keyboard shortcuts

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