package generate

import (
	"gadmin/internal/gorm/model"
	"os"

	"github.com/sirupsen/logrus"
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

func GenDbTable() {
	logrus.Info("genDefaultSql start")
	db, _ := gorm.Open(mysql.Open(os.Getenv("MYSQL_DSN")))
	err := db.AutoMigrate(
		model.AdminEmail{},
		model.AdminLog{},
		model.AdminNotice{},
		model.AdminRole{},
		model.AdminUser{},
	)
	if err != nil {
		logrus.Error("genSql error:%v\n", err)
	}
}
