1+ CREATE TABLE IF NOT EXISTS actions(
2+ -- The ID of the action.
3+ id INTEGER PRIMARY KEY ,
4+
5+ -- The session ID of the session that this action is associated with.
6+ -- This may be null for actions that are not coupled to a session.
7+ session_id BIGINT REFERENCES sessions(id) ON DELETE CASCADE ,
8+
9+ -- The account ID of the account that this action is associated with.
10+ -- This may be null for actions that are not coupled to an account.
11+ account_id BIGINT REFERENCES accounts(id) ON DELETE CASCADE ,
12+
13+ -- An ID derived from the macaroon used to perform the action. NOTE that
14+ -- this is only set if both session_id and account_id are null.
15+ macaroon_identifier BLOB,
16+
17+ -- The name of the entity who performed the action.
18+ actor_name TEXT ,
19+
20+ -- The name of the feature that the action is being performed by.
21+ feature_name TEXT ,
22+
23+ -- Meta info detailing what caused this action to be executed.
24+ trigger TEXT ,
25+
26+ -- Meta info detailing what the intended outcome of this action will be.
27+ intent TEXT ,
28+
29+ -- Extra structured JSON data that an actor can send along with the
30+ -- action as json.
31+ structured_json_data TEXT ,
32+
33+ -- The method URI that was called.
34+ rpc_method TEXT NOT NULL ,
35+
36+ -- The method parameters of the request in JSON form.
37+ rpc_params_json BLOB,
38+
39+ -- The time at which this action was created.
40+ created_at TIMESTAMP NOT NULL ,
41+
42+ -- The current state of the action.
43+ state SMALLINT NOT NULL ,
44+
45+ -- Human-readable reason for why the action failed.
46+ -- It will only be set if state is ActionStateError (3).
47+ error_reason TEXT
48+ );
49+
50+ CREATE INDEX IF NOT EXISTS actions_state_idx ON actions(state);
51+ CREATE INDEX IF NOT EXISTS actions_feature_name_idx ON actions(feature_name);
52+ CREATE INDEX IF NOT EXISTS actions_created_at_idx ON actions(created_at);
0 commit comments