示例#1
0
func init() {
	myconn, err := pop.Connect("mysql")
	if err != nil {
		panic(err.Error())
	}
	deets := myconn.Dialect.Details()
	myt = translators.NewMySQL(myconn.URL(), deets.Database)
}
示例#2
0
package translators_test

import (
	"github.com/markbates/pop"
	"github.com/markbates/pop/fizz"
	"github.com/markbates/pop/fizz/translators"
)

var _ fizz.Translator = (*translators.MySQL)(nil)
var myt = translators.NewMySQL("", "")

func init() {
	myconn, err := pop.Connect("mysql")
	if err != nil {
		panic(err.Error())
	}
	deets := myconn.Dialect.Details()
	myt = translators.NewMySQL(myconn.URL(), deets.Database)
}

func (p *MySQLSuite) Test_MySQL_SchemaMigration() {
	r := p.Require()
	ddl := `CREATE TABLE schema_migrations (
version VARCHAR (255) NOT NULL
) ENGINE=InnoDB;
CREATE UNIQUE INDEX version_idx ON schema_migrations (version);`

	res, err := myt.CreateTable(fizz.Table{
		Name: "schema_migrations",
		Columns: []fizz.Column{
			{Name: "version", ColType: "string"},
示例#3
0
文件: mysql.go 项目: markbates/pop
func (m *mysql) FizzTranslator() fizz.Translator {
	t := translators.NewMySQL(m.URL(), m.Details().Database)
	return t
}