From cc566bf31f1ad438588b60e430ac84e5aab2c955 Mon Sep 17 00:00:00 2001 From: hsluoyz Date: Fri, 9 Jun 2023 09:36:20 +0800 Subject: [PATCH] Move DoMigration() after CreateTables() --- main.go | 4 ++-- object/adapter.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index ede864bc..b090dbad 100644 --- a/main.go +++ b/main.go @@ -31,12 +31,12 @@ import ( ) func main() { - createDatabase := flag.Bool("createDatabase", false, "true if you need Casdoor to create database") + createDatabase := *flag.Bool("createDatabase", false, "true if you need Casdoor to create database") flag.Parse() object.InitAdapter() + object.CreateTables(createDatabase) object.DoMigration() - object.CreateTables(*createDatabase) object.InitDb() object.InitFromFile() diff --git a/object/adapter.go b/object/adapter.go index 2057c9b4..494a7982 100644 --- a/object/adapter.go +++ b/object/adapter.go @@ -41,8 +41,8 @@ func InitConfig() { beego.BConfig.WebConfig.Session.SessionOn = true InitAdapter() - DoMigration() CreateTables(true) + DoMigration() } func InitAdapter() {