Documentation
¶
Overview ¶
Package sqlserver plans SQL Server schema migrations without a database connection.
Index ¶
- Constants
- func Acknowledgements(artifact migrate.Artifact) []string
- func BuildArtifact(input migrate.ArtifactRequest) (migrate.Artifact, error)
- func CheckArtifact(artifact migrate.Artifact, actual migrate.Schema) (migrate.ArtifactState, error)
- func FromAtlas(input *schema.Realm) (migrate.Schema, error)
- func Plan(request migrate.Request) (migrate.Plan, error)
- func RenderScript(artifact migrate.Artifact, options ScriptOptions) (string, error)
- func ValidateAcknowledgements(artifact migrate.Artifact, acknowledgements []string) error
- func ValidateArtifact(artifact migrate.Artifact) error
- type DriftError
- type ScriptOptions
Constants ¶
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.
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
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 FromAtlas ¶ added in v1.0.5
FromAtlas projects supported declarative SQL Server tables and routines into the native model.
func Plan ¶
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
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
Types ¶
type DriftError ¶ added in v1.0.5
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
}