func (mf *MigrationFiles) ToLastFrom(version uint64) (Files, error) {
	sort.Sort(mf)
	files := make(Files, 0)
	for _, migrationFile := range *mf {
		if migrationFile.Version > version && migrationFile.UpFile != nil {
			files = append(files, *migrationFile.UpFile)
		}
	}
	return files, nil
}
ToLastFrom fetches all (up) migration files to the most recent migration file.
The migration file of the current version is not included.
package file
import (
	"bytes"
	"errors"
	"fmt"
	"go/token"
	"io/ioutil"
	"path"
	"regexp"
	"sort"
	"strconv"
	"strings"
	"github.com/mattes/migrate/migrate/direction"
)
var filenameRegex = `^([0-9]+)_(.*)\.(up|down)\.%s$`
func FilenameRegex(filenameExtension string) *regexp.Regexp {
	return regexp.MustCompile(fmt.Sprintf(filenameRegex, filenameExtension))
}
type File struct {
	Path string
	FileName string
	Version uint64
	Name string
	Content []byte
	Direction direction.Direction
}
type Files []File
type MigrationFile struct {
	Version uint64
	UpFile *File
	DownFile *File
}
type MigrationFiles []MigrationFile
func (f *File) ReadContent() error {
	if len(f.Content) == 0 {
		content, err := ioutil.ReadFile(path.Join(f.Path, f.FileName))
		if err != nil {
			return err
		}
		f.Content = content
	}
	return nil
}
func (mf *MigrationFiles) ToFirstFrom(version uint64) (Files, error) {
	sort.Sort(sort.Reverse(mf))
	files := make(Files, 0)
	for _, migrationFile := range *mf {
		if migrationFile.Version <= version && migrationFile.DownFile != nil {
			files = append(files, *migrationFile.DownFile)
		}
	}
	return files, nil
}