feat: query -> exec

This commit is contained in:
Yanislav Igonin 2021-11-17 10:41:24 +02:00
parent 329c47ec2a
commit fd97ae01f6

View File

@ -45,8 +45,9 @@ func Migrate() {
// Get name without extension
name := strings.Split(splitted[1], ".")[0]
if _, ok := dbMigrations[id]; !ok {
_, err = Pool.Query(context.TODO(), Files.ReadFileText(m))
_, isMigrationInDb := dbMigrations[id]
if !isMigrationInDb {
_, err := Pool.Exec(context.TODO(), Files.ReadFileText(m))
if err != nil {
log.Panicln(err)
}
@ -56,6 +57,7 @@ func Migrate() {
if err != nil {
log.Panicln(err)
}
log.Println("database migration - " + name + " - online")
}
}