row:=db.QueryRowx(`select exists(select 1 from "information_schema"."tables" where "table_schema" = $1 and "table_name" = $2) as exists`,"public","version_ctrl")
err=row.Scan(&vcExists)
iferr!=nil&&err!=sql.ErrNoRows{
log.Fatal(err)
}
// read max version
ifvcExists{
row:=db.QueryRowx(`select max(version) as version from "public"."version_ctrl"`)
err:=row.Scan(&version)
iferr!=nil&&err!=sql.ErrNoRows{
log.Fatal(err)
}
}
fmt.Println("Database Schema Version is ",version)