sqlitemigrate

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package sqlitemigrate provides a SQLite-specific migration executor for the Grove migration system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

Executor implements migrate.Executor for SQLite.

func New

func New(drv driver.Driver) *Executor

New creates a new SQLite migration executor.

func (*Executor) AcquireLock

func (e *Executor) AcquireLock(ctx context.Context, lockedBy string) error

AcquireLock attempts to acquire the migration lock using a table-based approach. SQLite is single-writer by nature, so this provides a simple cooperative lock via INSERT OR IGNORE + UPDATE.

func (*Executor) EnsureLockTable

func (e *Executor) EnsureLockTable(ctx context.Context) error

EnsureLockTable creates the grove_migration_locks table if it doesn't exist.

func (*Executor) EnsureMigrationTable

func (e *Executor) EnsureMigrationTable(ctx context.Context) error

EnsureMigrationTable creates the grove_migrations table if it doesn't exist.

func (*Executor) Exec

func (e *Executor) Exec(ctx context.Context, query string, args ...any) (driver.Result, error)

Exec executes a SQL statement that does not return rows.

func (*Executor) ListApplied

func (e *Executor) ListApplied(ctx context.Context) ([]*migrate.AppliedMigration, error)

ListApplied returns all migrations that have been applied, ordered by id ascending.

func (*Executor) Query

func (e *Executor) Query(ctx context.Context, query string, args ...any) (driver.Rows, error)

Query executes a SQL statement that returns rows.

func (*Executor) RecordApplied

func (e *Executor) RecordApplied(ctx context.Context, m *migrate.Migration) error

RecordApplied records that a migration was successfully applied.

func (*Executor) ReleaseLock

func (e *Executor) ReleaseLock(ctx context.Context) error

ReleaseLock releases the migration lock.

func (*Executor) RemoveApplied

func (e *Executor) RemoveApplied(ctx context.Context, m *migrate.Migration) error

RemoveApplied removes the record of an applied migration (for rollback).

Jump to

Keyboard shortcuts

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