Documentation ¶
Overview ¶
Package dumper handles writing SQL statements, obtained from objects in a live schema, to files in a directory. It can be used to do an initial dump, to update a previous dump to reflect changes in a schema, or to reformat statements to match canonical formats.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddDelimiter ¶
AddDelimiter takes the supplied string and appends a delimiter to the end. If the supplied string is a multi-statement routine, delimiter commands will be prepended and appended to the string appropriately.
func DumpSchema ¶
DumpSchema updates the *.sql files in dir to match the creation statements in schema. Any preexisting creation statements in the dir will be updated to match the canonical format from the live schema. Objects that no longer exist in the live schema will have their statements removed. A count of modified files is returned, along with any fatal write error. If opts.CountOnly is true, no actual filesystem writes occur, but a file count is still returned.
Types ¶
type Options ¶
type Options struct { IncludeAutoInc bool // if false, strip AUTO_INCREMENT clauses from CREATE TABLE Partitioning tengo.PartitioningMode // PartitioningKeep: retain previous FS partitioning clause; PartitioningRemove: strip partitioning clause CountOnly bool // if true, skip writing files, just report count of rewrites IgnoreTable *regexp.Regexp // skip tables with names matching this regex // contains filtered or unexported fields }
Options controls dumper behavior.
func (*Options) IgnoreKeys ¶
IgnoreKeys specifies a list of tengo.ObjectKeys that the dump should ignore. Repeated calls to this method add to the existing list of ignored keys. If the same key was supplied to both OnlyKeys and IgnoreKeys, the latter takes precedence, meaning the object will be skipped.