func (p *Printer) printDDL(ddl *DDLStatement) {
	p.Lock()
	defer p.Unlock()
	instString := ddl.instance.String()
	if p.briefOutput {
		if _, already := p.seenInstance[instString]; !already {
			fmt.Printf("%s\n", instString)
			p.seenInstance[instString] = true
		}
		return
	}
	if instString != p.lastStdoutInstance {
		fmt.Printf("-- instance: %s\n", instString)
		p.lastStdoutInstance = instString
		p.lastStdoutSchema = ""
	}
	if ddl.schemaName != p.lastStdoutSchema && ddl.schemaName != "" {
		fmt.Printf("USE %s;\n", tengo.EscapeIdentifier(ddl.schemaName))
		p.lastStdoutSchema = ddl.schemaName
	}
	fmt.Print(ddl.String())
}
printDDL outputs DDLStatement values to STDOUT in a way that prevents
interleaving of output from multiple workers.
TODO: buffer output from external commands and also prevent interleaving there
package applier
import (
	"fmt"
	"sync"
	"github.com/skeema/tengo"
)
type Printer struct {
	briefOutput        bool
	lastStdoutInstance string
	lastStdoutSchema   string
	seenInstance       map[string]bool
	*sync.Mutex
}
func NewPrinter(briefMode bool) *Printer {
	return &Printer{
		briefOutput:  briefMode,
		seenInstance: make(map[string]bool),
		Mutex:        new(sync.Mutex),
	}
}