aazavoykin
02/09/2023, 7:14 AM"limit" >= balance
):
CREATE TABLE IF NOT EXISTS account (
id uuid PRIMARY KEY,
balance DECIMAL(16,2) NOT NULL DEFAULT 0 CHECK (balance >= 0),
"limit" DECIMAL(16,2) NOT NULL DEFAULT 0 CHECK ("limit" >= balance)
);
How could I get the current value of column here?
object AccountTable : Table("account") {
...
val limit: Column<BigDecimal> = decimal("limit", 16, 2)
.default(BigDecimal.ZERO)
.check {it.greaterEq(??????)}
}
Sergey Shumov
02/09/2023, 8:08 AMobject AccountTable : UUIDTable("account") {
val balance = decimal("balance", 16, 2)
.default(BigDecimal.ZERO)
.check { it greaterEq BigDecimal.ZERO }
val limit = decimal("limit", 16, 2)
.default(BigDecimal.ZERO)
.check { GreaterEqOp(it, balance) }
}
aazavoykin
02/09/2023, 8:10 AM