diff

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrColumnOrderingChanged = fmt.Errorf("column ordering changed: %w", ErrNotImplemented)
)
View Source
var ErrNotImplemented = fmt.Errorf("not implemented")

Functions

This section is empty.

Types

type MigrationHazard

type MigrationHazard struct {
	Type    MigrationHazardType
	Message string
}

func (MigrationHazard) String

func (p MigrationHazard) String() string

type MigrationHazardType

type MigrationHazardType = string
const (
	MigrationHazardTypeAcquiresAccessExclusiveLock MigrationHazardType = "ACQUIRES_ACCESS_EXCLUSIVE_LOCK"
	MigrationHazardTypeAcquiresShareLock           MigrationHazardType = "ACQUIRES_SHARE_LOCK"
	MigrationHazardTypeDeletesData                 MigrationHazardType = "DELETES_DATA"
	MigrationHazardTypeHasUntrackableDependencies  MigrationHazardType = "HAS_UNTRACKABLE_DEPENDENCIES"
	MigrationHazardTypeIndexBuild                  MigrationHazardType = "INDEX_BUILD"
	MigrationHazardTypeIndexDropped                MigrationHazardType = "INDEX_DROPPED"
	MigrationHazardTypeImpactsDatabasePerformance  MigrationHazardType = "IMPACTS_DATABASE_PERFORMANCE"
	MigrationHazardTypeIsUserGenerated             MigrationHazardType = "IS_USER_GENERATED"
)

type Plan

type Plan struct {
	Statements        []Statement
	CurrentSchemaHash string
}

func GeneratePlan

func GeneratePlan(ctx context.Context, conn *sql.Conn, tempDbFactory tempdb.Factory, newDDL []string, opts ...PlanOpt) (Plan, error)

func (Plan) ApplyStatementTimeoutModifier

func (p Plan) ApplyStatementTimeoutModifier(regex *regexp.Regexp, timeout time.Duration) Plan

func (Plan) InsertStatement

func (p Plan) InsertStatement(index int, statement Statement) (Plan, error)

type PlanOpt

type PlanOpt func(opts *planOptions)

func WithDataPackNewTables

func WithDataPackNewTables() PlanOpt

WithDataPackNewTables configures the plan generation such that it packs the columns in the new tables to minimize padding. It will help minimize the storage used by the tables

func WithDoNotValidatePlan

func WithDoNotValidatePlan() PlanOpt

func WithIgnoreChangesToColOrder

func WithIgnoreChangesToColOrder() PlanOpt

WithIgnoreChangesToColOrder configures the plan generation to ignore any changes to the ordering of columns in existing tables. You will most likely want this enabled

func WithLogger

func WithLogger(logger log.Logger) PlanOpt

type Statement

type Statement struct {
	DDL     string
	Timeout time.Duration
	Hazards []MigrationHazard
}

func (Statement) ToSQL

func (s Statement) ToSQL() string

Jump to

Keyboard shortcuts

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