From c583220fd66de0adc031a81c01ff9df527d5868b Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 17:13:51 -0400 Subject: [PATCH] Ajouter dbschema.DBClient#CreateTablesIfNotExist() --- dbclient/dbclient.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dbclient/dbclient.go b/dbclient/dbclient.go index 85049ea..5e763ea 100644 --- a/dbclient/dbclient.go +++ b/dbclient/dbclient.go @@ -4,6 +4,7 @@ package dbclient import ( "fmt" + "git.agecem.com/agecem/bottin-ag/dbschema" "github.com/jmoiron/sqlx" ) @@ -38,3 +39,8 @@ func New(host, database, user, password string, port int, useSSL bool) (*DBClien return &DBClient{DB: db}, nil } + +func (d *DBClient) CreateTablesIfNotExist() error { + _, err := d.DB.Exec(dbschema.Schema) + return err +}