sqlserver

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package sqlserver plans SQL Server schema migrations without a database connection.

Index

Constants

View Source
const LockResource = "commons-db/migrate/schema"

LockResource is the transaction-owned applock that serialises every migration of a database, applied directly or through a rendered script.

View Source
const SessionOptions = "" /* 185-byte string literal not displayed */

SessionOptions are the SET options every migration statement runs under, whether the executor applies an artifact or a rendered script does.

Variables

This section is empty.

Functions

func Acknowledgements added in v1.1.0

func Acknowledgements(artifact migrate.Artifact) []string

Acknowledgements lists the destructive change IDs an artifact plans, which applying it must acknowledge one by one.

func BuildArtifact added in v1.0.5

func BuildArtifact(input migrate.ArtifactRequest) (migrate.Artifact, error)

func CheckArtifact added in v1.0.5

func CheckArtifact(artifact migrate.Artifact, actual migrate.Schema) (migrate.ArtifactState, error)

func FromAtlas added in v1.0.5

func FromAtlas(input *schema.Realm) (migrate.Schema, error)

FromAtlas projects supported declarative SQL Server tables and routines into the native model.

func Plan

func Plan(request migrate.Request) (migrate.Plan, error)

Plan validates both snapshots and returns ordered SQL and typed change metadata. Names are exact catalog identifiers; callers must supply complete foreign-key targets.

func RenderScript added in v1.1.3

func RenderScript(artifact migrate.Artifact, options ScriptOptions) (string, error)

RenderScript renders a reviewed artifact as one re-runnable T-SQL batch: a single transaction under LockResource that evaluates every change's state guard against the database first, then runs each step whose change is still at its baseline. It has no GO separators, so a transaction never spans batches.

func ValidateAcknowledgements added in v1.1.3

func ValidateAcknowledgements(artifact migrate.Artifact, acknowledgements []string) error

ValidateAcknowledgements requires each destructive change of an artifact to be acknowledged exactly once and refuses unknown or repeated IDs.

func ValidateArtifact added in v1.0.5

func ValidateArtifact(artifact migrate.Artifact) error

Types

type DriftError added in v1.0.5

type DriftError struct{ Changes []migrate.Change }

func (*DriftError) Error added in v1.0.5

func (e *DriftError) Error() string

type ScriptOptions added in v1.1.3

type ScriptOptions struct {
	// Acknowledgements lists every destructive change ID exactly once.
	Acknowledgements []string
}

Jump to

Keyboard shortcuts

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