Ajouter dbschema.DBClient#CreateTablesIfNotExist()
This commit is contained in:
parent
20fa0e10d1
commit
c583220fd6
1 changed files with 6 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
|
Reference in a new issue