initialize database if table doesn't exist
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
7
main.go
7
main.go
@@ -57,6 +57,13 @@ func init() {
|
||||
log.Fatalf("failed to connect to database: %v", err)
|
||||
}
|
||||
|
||||
// Check if database needs to be initialized (create tables)
|
||||
// does nothing if tables exist
|
||||
err = dbConn.InitializeDatabase()
|
||||
if err != nil {
|
||||
log.Fatalf("failed to initialize database: %v", err)
|
||||
}
|
||||
|
||||
uniqueVisits, err = dbConn.GetUniqueVisits()
|
||||
if err != nil {
|
||||
log.Fatalf("failed to get number of unique visits from database: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user