123456789101112131415161718192021222324252627282930313233 |
- package db
- import (
- "go.uber.org/zap"
- "cold-logistics/app/admin/model"
- )
- // 执行数据迁移
- func AutoMigrateDB() {
- //自动迁移模式
- err := DB.Set("gorm:table_options", "charset=utf8mb4").
- AutoMigrate(
- &model.SysUser{},
- //&model.SysRole{},
- //&model.SysRoleMenu{},
- //&model.SysMenu{},
- &model.SysDept{},
- &model.SysLoginLog{},
- &model.SysOperaLog{},
- &model.Warehouse{},
- &model.Address{},
- &model.AddressDefault{},
- &model.Car{},
- &model.Waybill{},
- &model.WaybillLogistics{},
- &model.WaybillTask{},
- &model.CoolerBox{},
- )
- if err != nil {
- zap.L().Panic("migrate db fail", zap.Error(err))
- }
- }
|