dev.go 400 Bytes
Newer Older
Vladimir Barsukov's avatar
fix  
Vladimir Barsukov committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//go:build zmigrations_dev

package zmigrations

import (
	"fmt"
	"git.barsukov.pro/barsukov/zgo/zdb"
)

func reCreateSchemeDo(db *zdb.Pool, reCreateSchema ...string) {
	if len(reCreateSchema) > 0 && len(reCreateSchema[0]) > 0 {
		_ = db.WExec(fmt.Sprintf("DROP SCHEMA IF EXISTS %s CASCADE;", reCreateSchema[0]))
		_ = db.WExec(fmt.Sprintf("CREATE SCHEMA IF NOT EXISTS %s;", reCreateSchema[0]))
	}
}