Ajouter dbschema.DBClient#CreateTablesIfNotExist()

This commit is contained in:
Victor Lacasse-Beaudoin 2023-09-16 17:13:51 -04:00
parent 20fa0e10d1
commit c583220fd6

View file

@ -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
}