mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
27 lines
485 B
Go
27 lines
485 B
Go
package seed
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
entity "gitlab.com/mbugroup/lti-api.git/internal/entities"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
func Run(db *gorm.DB) error {
|
|
return db.Transaction(func(tx *gorm.DB) error {
|
|
// ===== Users (user) =====
|
|
user := entity.User{
|
|
Email: "admin@mbugroup.id",
|
|
IdUser: 1,
|
|
Name: "Super Admin",
|
|
}
|
|
if err := tx.Where("email = ?", user.Email).FirstOrCreate(&user).Error; err != nil {
|
|
return err
|
|
}
|
|
|
|
fmt.Println("✅ Seeder successfully")
|
|
return nil
|
|
})
|
|
}
|