14 lines
572 B
SQL
14 lines
572 B
SQL
CREATE TABLE kuknos_settlement_operator_audits (
|
|
id bigserial PRIMARY KEY,
|
|
settlement_id uuid NOT NULL REFERENCES kuknos_settlements(id),
|
|
actor_id text NOT NULL CHECK (actor_id <> ''),
|
|
action text NOT NULL CHECK (action IN ('RETRY')),
|
|
reason text NOT NULL CHECK (reason <> ''),
|
|
previous_status text NOT NULL,
|
|
resulting_status text NOT NULL,
|
|
created_at timestamptz NOT NULL DEFAULT clock_timestamp()
|
|
);
|
|
|
|
CREATE INDEX kuknos_settlement_operator_audits_settlement_idx
|
|
ON kuknos_settlement_operator_audits (settlement_id, created_at DESC);
|