jdysya 2ef2f53ce6 feat(gateway): 更新数据库连接和模型
- 从 SQLite 切换到 MySQL 数据库
- 更新 Region 和 User 模型,增加字段和关联
- 添加数据库连接池配置
- 实现自动迁移表结构
2025-02-16 23:49:27 +08:00

15 lines
365 B
Go

package models
import (
"github.com/jinzhu/gorm"
)
type User struct {
gorm.Model
FullName string `gorm:"type:varchar(100);not null"`
RegionID uint `gorm:"not null;index"`
Mobile string `gorm:"type:varchar(20);unique;not null"`
Password string `gorm:"type:varchar(100);not null"`
Region Region `gorm:"foreignkey:RegionID;association_foreignkey:ID"`
}