1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
| package initialize
|
| import (
| "os"
| "srm/model/purchase"
|
| "go.uber.org/zap"
| "gorm.io/gorm"
| "srm/global"
| "srm/model/test"
| )
|
| func Gorm() *gorm.DB {
| switch global.GVA_CONFIG.System.DbType {
| case "mysql":
| return GormMysql()
| case "pgsql":
| return GormPgSql()
| case "oracle":
| return GormOracle()
| case "mssql":
| return GormMssql()
| case "sqlite":
| return GormSqlite()
| default:
| return GormMysql()
| }
| }
|
| func RegisterTables() {
| db := global.GVA_DB
| err := db.AutoMigrate(
|
| //system.SysApi{},
| //system.SysUser{},
| //system.SysBaseMenu{},
| //system.JwtBlacklist{},
| //system.SysAuthority{},
| //system.SysDictionary{},
| //system.SysOperationRecord{},
| //system.SysAutoCodeHistory{},
| //system.SysDictionaryDetail{},
| //system.SysBaseMenuParameter{},
| //system.SysBaseMenuBtn{},
| //system.SysAuthorityBtn{},
| //system.SysAutoCode{},
| //system.SysChatGptOption{},
|
| //example.ExaFile{},
| //example.ExaCustomer{},
| //example.ExaFileChunk{},
| //example.ExaFileUploadAndDownload{},
| test.Industry{},
| test.SupplierType{},
| test.Supplier{},
| test.Contract{},
| test.Product{},
| //test.Member{},
| purchase.Purchase{}, purchase.PurchaseProducts{},
| )
| if err != nil {
| global.GVA_LOG.Error("register table failed", zap.Error(err))
| os.Exit(0)
| }
| global.GVA_LOG.Info("register table success")
| }
|
|