func (m *Executor) Create(name string) (*Migration, error) {
	now := time.Now().UTC()
	id := now.Format(format)
	name = inflect.Underscore(strings.ToLower(name))
	name = fmt.Sprintf("%s_%s.sql", id, name)
	migration, _ := Parse(name)
	if migration != nil {
		migration.CreatedAt = now
	}
	if err := m.Generator.Create(migration); err != nil {
		return nil, err
	}
	return migration, nil
}
Create creates a migration script successfully if the project has already
been setup, otherwise returns an error.
package sqlmigr
import (
	"bytes"
	"fmt"
	"regexp"
	"strings"
	"time"
	"github.com/go-openapi/inflect"
	"github.com/phogolabs/log"
)
var migrationRgxp = regexp.MustCompile(`CREATE TABLE IF NOT EXISTS\s*([a-zA-Z0-9\.]+)\s*`)
type Executor struct {
	Logger log.Logger
	Provider MigrationProvider
	Runner MigrationRunner
	Generator MigrationGenerator
}
func (m *Executor) Setup() error {
	up := &bytes.Buffer{}
	fmt.Fprintln(up, "CREATE TABLE IF NOT EXISTS migrations (")
	fmt.Fprintln(up, " id          VARCHAR(14) NOT NULL PRIMARY KEY,")
	fmt.Fprintln(up, " description TEXT        NOT NULL,")
	fmt.Fprintln(up, " created_at  TIMESTAMP   NOT NULL")
	fmt.Fprintln(up, ");")
	fmt.Fprintln(up)
	down := bytes.NewBufferString("DROP TABLE IF EXISTS migrations;")
	fmt.Fprintln(down)
	content := &Content{
		UpCommand:   up,
		DownCommand: down,
	}
	return m.Generator.Write(setup, content)
}