forked from free-lancers/electricity_bill_calc_service
		
	feat(db):增加基础表的数据结构同步。
This commit is contained in:
		
							
								
								
									
										17
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								main.go
									
									
									
									
									
								
							| @@ -3,6 +3,7 @@ package main | ||||
| import ( | ||||
| 	"electricity_bill_calc/config" | ||||
| 	"electricity_bill_calc/global" | ||||
| 	"electricity_bill_calc/model" | ||||
| 	"electricity_bill_calc/router" | ||||
| 	"fmt" | ||||
| 	"log" | ||||
| @@ -24,6 +25,22 @@ func init() { | ||||
| 	} | ||||
| 	log.Println("Main Database connected!") | ||||
|  | ||||
| 	err = global.DBConn.Sync( | ||||
| 		&model.User{}, | ||||
| 		&model.UserDetail{}, | ||||
| 		&model.UserCharge{}, | ||||
| 		&model.Park{}, | ||||
| 		&model.Meter04KV{}, | ||||
| 		&model.MaintenanceFee{}, | ||||
| 		&model.Report{}, | ||||
| 		&model.ReportSummary{}, | ||||
| 		&model.WillDilutedFee{}, | ||||
| 		&model.EndUserDetail{}) | ||||
| 	if err != nil { | ||||
| 		log.Fatalf("Database structure synchronize failed: %v", err) | ||||
| 	} | ||||
| 	log.Println("Database structure synchronized.") | ||||
|  | ||||
| 	err = global.SetupRedisConnection() | ||||
| 	if err != nil { | ||||
| 		log.Fatalf("Main Cache Database connect failed: %v", err) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user