Release v0.8.0 notes
May 5, 2023 by qbart ‐ 1 min read
Newest release brings small addition to how actions are run. Consider following scenario when you want to create database and assign owner. Normally action is defined as follows:
action "db" "create" {
arguments {
arg "name" {
description = "Database name"
}
arg "user" {
description = "Database user"
}
}
sql = "CREATE DATABASE {{ .Args.name }} OWNER {{ .Args.user }}"
}
Run action:
krab action db create -name animals -user api
This will fail with CREATE DATABASE cannot run inside a transaction block SQL state: 25001
.
Actions can accept transaction attribute that determines how action is run. New action would take the following form:
action "db" "create" {
arguments {
arg "name" {
description = "Database name"
}
arg "user" {
description = "Database user"
}
}
transaction = false
sql = "CREATE DATABASE {{ .Args.name }} OWNER {{ .Args.user }}"
}
transaction = false
will disable transaction (similiary how migrations can be run) and action should run without an error.
release
krab
actions