Ich habe bereits eine Migrationsdatei über bee generate migration create_users_table
erstellt. Dann hatte ich eine Datei in Ordner-Datenbank/Migration/20171205_154034_create_users_table.go Dies ist meine Datei:Datenbank mit Migration erstellen bego
package main
import (
"github.com/astaxie/beego/migration"
)
// DO NOT MODIFY
type CreateUsersTable_20171205_154034 struct {
migration.Migration
}
// DO NOT MODIFY
func init() {
m := &CreateUsersTable_20171205_154034{}
m.Created = "20171205_154034"
migration.Register("CreateUsersTable_20171205_154034", m)
}
// Run the migrations
func (m *CreateUsersTable_20171205_154034) Up() {
m.CreateTable("users","InnoDB","utf8")
m.PriCol("id").SetAuto(true).SetNullable(false).SetDataType("INT(10)").SetUnsigned(true)
}
// Reverse the migrations
func (m *CreateUsersTable_20171205_154034) Down() {
m.SQL("DROP TABLE users")
}
Schließlich i laufen bee migrate -conn="username:[email protected](127.0.0.1:3306)/mydb"
. Ich habe Migration successful!
kein Fehler. Aber ich hatte keine Benutzer-Tabelle in der Datenbank. Was ist los mit dir? Vielen Dank für das Lesen. Hoffe, jemand hilft mir