func (m *Migration) String() string {
	return fmt.Sprintf("%v [%v=>%v]", m.Identifier, m.Version, m.TargetVersion)
}
String implements string.Stringer and is used in tests.
package migrate
import (
	"bufio"
	"fmt"
	"io"
	"time"
)
var DefaultBufferSize = uint(100000)
type Migration struct {
	Identifier string
	Version uint
	TargetVersion int
	Body io.ReadCloser
	BufferedBody io.Reader
	BufferSize uint
	bufferWriter io.WriteCloser
	Scheduled time.Time
	StartedBuffering time.Time
	FinishedBuffering time.Time
	FinishedReading time.Time
	BytesRead int64
}
func NewMigration(body io.ReadCloser, identifier string,
	version uint, targetVersion int) (*Migration, error) {
	tnow := time.Now()
	m := &Migration{
		Identifier:    identifier,
		Version:       version,
		TargetVersion: targetVersion,
		Scheduled:     tnow,
	}
	if body == nil {
		if len(identifier) == 0 {
			m.Identifier = "<empty>"
		}
		m.StartedBuffering = tnow
		m.FinishedBuffering = tnow
		m.FinishedReading = tnow
		return m, nil
	}
	br, bw := io.Pipe()
	m.Body = body  
	m.BufferSize = DefaultBufferSize
	m.BufferedBody = br
	m.bufferWriter = bw
	return m, nil
}