migrations

package
v0.0.0-...-36d6306 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package migrations registers all database migrations for the application. Migrations are executed in ULID order during application startup.

To add a new migration:

  1. Create a new file named `ULID_description.go` (e.g., `01JFGH12ABC_add_branch_table.go`)
  2. Generate a ULID using idwrap.NewNow().String()
  3. Implement the migration following the pattern in existing files
  4. Import the migration file in this package (side-effect import via init)

Migration checksums should be stable hashes of the migration logic. If you change migration code, you MUST change its checksum.

Index

Constants

View Source
const MigrationAddAITablesChecksum = "sha256:add-ai-tables-v1"

MigrationAddAITablesChecksum is a stable hash of this migration.

View Source
const MigrationAddAITablesID = "01KFF093T2EFF5NQH0GKHGP1QN"

MigrationAddAITablesID is the ULID for the AI tables migration.

View Source
const MigrationAddFlowErrorChecksum = "sha256:add-flow-error-and-node-id-mapping-v1"
View Source
const MigrationAddFlowErrorID = "01KJSYH5EHQ1MEG2R4H3N3WK71"
View Source
const MigrationAddFlowNodeWaitChecksum = "sha256:add-flow-node-wait-v1"
View Source
const MigrationAddFlowNodeWaitID = "01KJZMR5232X0983HYB7GS2WZ7"
View Source
const MigrationAddGraphQLDeltaFileKindChecksum = "sha256:add-graphql-delta-file-kind-v2"

MigrationAddGraphQLDeltaFileKindChecksum is a stable hash of this migration.

View Source
const MigrationAddGraphQLDeltaFileKindID = "01KK31SQD0GFP92RZ3XMN5V6BQ"

MigrationAddGraphQLDeltaFileKindID is the ULID for the GraphQL delta file kind migration.

View Source
const MigrationAddGraphQLTablesChecksum = "sha256:add-graphql-tables-v2"

MigrationAddGraphQLTablesChecksum is a stable hash of this migration.

View Source
const MigrationAddGraphQLTablesID = "01KHDYWX1KV5MX8H9MNTPCWDV9"

MigrationAddGraphQLTablesID is the ULID for the GraphQL tables migration.

View Source
const MigrationAddHttpIsSnapshotChecksum = "sha256:add-http-is-snapshot-v2"

MigrationAddHttpIsSnapshotChecksum is a stable hash of this migration.

View Source
const MigrationAddHttpIsSnapshotID = "01KGZC9EQCWJN09C2SJQBWRZQM"

MigrationAddHttpIsSnapshotID is the ULID for the http is_snapshot column migration.

View Source
const MigrationAddSubFlowTablesChecksum = "sha256:add-sub-flow-tables-v1"
View Source
const MigrationAddSubFlowTablesID = "01KK7EDJV31GSEJFTN11H5WGFH"
View Source
const MigrationAddUserAuthColumnsChecksum = "sha256:add-user-auth-columns-v2"

MigrationAddUserAuthColumnsChecksum is a stable hash of this migration.

View Source
const MigrationAddUserAuthColumnsID = "01KGTFDMC0A8NKA2ER2K6YFQCY"

MigrationAddUserAuthColumnsID is the ULID for the user auth columns migration.

View Source
const MigrationAddWebSocketTablesChecksum = "sha256:add-websocket-tables-v1"

MigrationAddWebSocketTablesChecksum is a stable hash of this migration.

View Source
const MigrationAddWebSocketTablesID = "01KKFQT81KV5MX8H9MNTPCWDV9"

MigrationAddWebSocketTablesID is the ULID for the WebSocket tables migration.

View Source
const MigrationEnforceDeltaSnapshotExclusivityChecksum = "sha256:enforce-delta-snapshot-exclusivity-v1"

MigrationEnforceDeltaSnapshotExclusivityChecksum is a stable hash of this migration.

View Source
const MigrationEnforceDeltaSnapshotExclusivityID = "01KH1AZ5P9V9SD3XTXM9W1RNK7"

MigrationEnforceDeltaSnapshotExclusivityID is the ULID for the delta/snapshot mutual exclusivity migration.

View Source
const MigrationRepackFileDisplayOrderChecksum = "sha256:repack-file-display-order-v1"

MigrationRepackFileDisplayOrderChecksum is a stable hash of this migration.

View Source
const MigrationRepackFileDisplayOrderID = "01KWRQ3ZC05MK9VPB0ZMQZCZ4G"

MigrationRepackFileDisplayOrderID is the ULID for the file display_order repack migration.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, db *sql.DB, cfg Config) error

Run executes all registered migrations against the database. This should be called early in application startup, before services access the DB.

func RunTo

func RunTo(ctx context.Context, db *sql.DB, cfg Config, targetID string) error

RunTo executes migrations up to and including the specified migration ID. Useful for testing specific migration states.

Types

type Config

type Config struct {
	// DatabasePath is the absolute path to the SQLite database file.
	DatabasePath string
	// DataDir is the base data directory (backups stored under DataDir/migrations/backups).
	DataDir string
	// Logger for migration events.
	Logger *slog.Logger
}

Config holds configuration for running migrations.

Jump to

Keyboard shortcuts

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