Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Artifact ¶ added in v1.0.5
type Artifact struct {
Version int `json:"version"`
Schemas []string `json:"schemas"`
Request Request `json:"request"`
Plan Plan `json:"plan"`
Hash string `json:"hash"`
}
Artifact binds reviewed SQL to complete baseline and desired snapshots.
type ArtifactRequest ¶ added in v1.0.5
type Change ¶
type Change struct {
ID string `json:"id"`
Action string `json:"action"`
Kind string `json:"kind"`
Object Name `json:"object"`
Member string `json:"member,omitempty"`
Destructive bool `json:"destructive"`
Reason string `json:"reason,omitempty"`
// RuntimeDependencies flags a module whose references bind only at runtime.
RuntimeDependencies []RuntimeDependency `json:"runtimeDependencies,omitempty"`
// Requires lists the change IDs that must be selected with this one.
Requires []string `json:"requires,omitempty"`
// Cause is the ID of the change that forced this rebuild.
Cause string `json:"cause,omitempty"`
}
type Default ¶
type Default struct {
Name string `json:"name"`
Expression string `json:"expression"`
// SystemNamed marks a constraint SQL Server named itself (DF__table__col__hex).
// Its name differs in every database, so it is never compared, and a new
// one is created unnamed; Name is still what a drop of the live one uses.
SystemNamed bool `json:"systemNamed,omitempty"`
}
type Definition ¶
type Definition struct {
Name Name `json:"name"`
Kind string `json:"kind"`
SQL string `json:"sql"`
Parent *Name `json:"parent,omitempty"`
Disabled bool `json:"disabled,omitempty"`
// QuotedIdentifierOff records a module created under SET QUOTED_IDENTIFIER
// OFF, where double quotes delimit strings rather than identifiers.
QuotedIdentifierOff bool `json:"quotedIdentifierOff,omitempty"`
Dependencies []Name `json:"dependencies,omitempty"`
// RuntimeDependencies are references the catalog could not bind to a local
// object: missing objects, cross-database or linked-server names, built-ins
// and method calls. They resolve when the module runs, so they never order DDL.
RuntimeDependencies []RuntimeDependency `json:"runtimeDependencies,omitempty"`
}
type ForeignKey ¶
type ForeignKey struct {
Name string `json:"name"`
Columns []string `json:"columns"`
References Name `json:"references"`
ReferencedColumns []string `json:"referencedColumns"`
OnDelete string `json:"onDelete,omitempty"`
OnUpdate string `json:"onUpdate,omitempty"`
// NotForReplication is read from a live key so a rebuild keeps it; the diff does not compare it.
NotForReplication bool `json:"notForReplication,omitempty"`
}
type Index ¶
type Index struct {
Name string `json:"name"`
Columns []IndexColumn `json:"columns"`
Included []string `json:"included,omitempty"`
Unique bool `json:"unique,omitempty"`
Primary bool `json:"primary,omitempty"`
Clustered bool `json:"clustered,omitempty"`
Constraint bool `json:"constraint,omitempty"`
Filter string `json:"filter,omitempty"`
// FillFactor is 1-99; 0 is the server default, which FILLFACTOR = 100 equals.
FillFactor int `json:"fillFactor,omitempty"`
// The options below are read from a live index so a rebuild re-creates it
// faithfully; the diff does not compare them.
PadIndex bool `json:"padIndex,omitempty"`
IgnoreDupKey bool `json:"ignoreDupKey,omitempty"`
NoRowLocks bool `json:"noRowLocks,omitempty"`
NoPageLocks bool `json:"noPageLocks,omitempty"`
NoRecompute bool `json:"noRecompute,omitempty"`
// Compression is ROW or PAGE; empty is none.
Compression string `json:"compression,omitempty"`
// Filegroup is set only when the index is not on the default filegroup.
Filegroup string `json:"filegroup,omitempty"`
}
type IndexColumn ¶
type Plan ¶
type Plan struct {
Steps []Step `json:"steps"`
// Changes lists every change between the snapshots, selected or not, and
// the rebuilds the selected ones force.
Changes []Change `json:"changes"`
// Warnings names each definition whose body is not understood. It is
// compared and created as written.
Warnings []string `json:"warnings,omitempty"`
}
type RuntimeDependency ¶ added in v1.1.0
type Schema ¶
type Schema struct {
Tables []Table `json:"tables"`
Definitions []Definition `json:"definitions"`
Sequences []Sequence `json:"sequences,omitempty"`
TableTypes []TableType `json:"tableTypes,omitempty"`
// Native is a dialect's own lossless description of the schema (Atlas HCL) when the fields above cannot hold it; the fields are then a projection of the same objects.
Native string `json:"native,omitempty"`
}
type Sequence ¶ added in v1.1.0
type Sequence struct {
Name Name `json:"name"`
Type string `json:"type"`
Start string `json:"start"`
Increment string `json:"increment"`
Minimum string `json:"minimum"`
Maximum string `json:"maximum"`
Cycle bool `json:"cycle,omitempty"`
NoCache bool `json:"noCache,omitempty"`
CacheSize int64 `json:"cacheSize,omitempty"`
}
Sequence is a CREATE SEQUENCE object. Numeric bounds are exact decimal strings so every integer and decimal sequence type round-trips. CacheSize 0 with NoCache false is the server's default cache.
type Table ¶
type Table struct {
Name Name `json:"name"`
Partial bool `json:"partial,omitempty"`
Columns []Column `json:"columns"`
Indexes []Index `json:"indexes,omitempty"`
ForeignKeys []ForeignKey `json:"foreignKeys,omitempty"`
Checks []Check `json:"checks,omitempty"`
}
Table is a table declaration. A declaration is complete: the columns, indexes, keys and checks it omits are dropped from a table that has them. Partial says it names only some of the table's members, so the plan leaves every other member of the live table alone and never creates the table. It is read from the desired declaration; an inspected table never sets it, and the diff does not compare it.
type TableType ¶ added in v1.1.0
type TableType struct {
Name Name `json:"name"`
Columns []Column `json:"columns"`
Keys []Index `json:"keys,omitempty"`
Checks []string `json:"checks,omitempty"`
}
TableType is a CREATE TYPE ... AS TABLE user-defined table type. SQL Server names a table type's constraints itself, so its defaults, keys and checks carry no names: Default.Name, Index.Name and Check.Name stay empty. Keys are the PRIMARY KEY and UNIQUE constraints; a table type cannot be altered.
Directories
¶
| Path | Synopsis |
|---|---|
|
atlas
|
|
|
Package changeset names atlas schema changes as selectable, typed migration changes and filters a diff down to a reviewed selection before planning.
|
Package changeset names atlas schema changes as selectable, typed migration changes and filters a diff down to a reviewed selection before planning. |
|
Package engine is the dialect-neutral schema planner and executor.
|
Package engine is the dialect-neutral schema planner and executor. |
|
internal
|
|
|
Package sqlserver is the pure half of the SQL Server dialect: it compares two schemas, lowers the changes to statements and renders reviewed artifacts as scripts, all without a database connection.
|
Package sqlserver is the pure half of the SQL Server dialect: it compares two schemas, lowers the changes to statements and renders reviewed artifacts as scripts, all without a database connection. |