From 063e6fecb3772793eedb1e0b6e55acac2223c5d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Wed, 10 Aug 2022 15:52:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(db):=E5=A2=9E=E5=8A=A0=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E8=A1=A8=E7=9A=84=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/main.go b/main.go index 6eb7b8e..0cbe3cd 100644 --- a/main.go +++ b/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)