-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
70 lines (55 loc) · 2.28 KB
/
schema.sql
File metadata and controls
70 lines (55 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
CREATE TABLE IF NOT EXISTS block (
hash BLOB PRIMARY KEY,
block_no UNSIGNED INTEGER NOT NULL,
slot_no UNSIGNED INTEGER NOT NULL
) WITHOUT ROWID;
CREATE TABLE IF NOT EXISTS execution_context (
context_id INTEGER PRIMARY KEY,
block_hash BLOB NOT NULL REFERENCES block (hash),
cost_model_params_id INTEGER NOT NULL REFERENCES cost_model_params (params_id),
transaction_hash BLOB NOT NULL,
target_script_hash BLOB NOT NULL,
target_script_name TEXT,
shadow_script_hash BLOB NOT NULL,
shadow_script_name TEXT,
ledger_language SMALLINT NOT NULL,
major_protocol_version SMALLINT NOT NULL,
datum BLOB,
redeemer BLOB,
script_context BLOB NOT NULL,
exec_budget_max_cpu INTEGER NOT NULL,
exec_budget_max_mem INTEGER NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX IF NOT EXISTS idx_execution_context_block_hash ON execution_context(block_hash);
CREATE INDEX IF NOT EXISTS idx_execution_context_created_at ON execution_context(created_at ASC);
CREATE TABLE IF NOT EXISTS cost_model_params (
params_id INTEGER PRIMARY KEY,
params BLOB NOT NULL,
UNIQUE (params)
);
CREATE TABLE IF NOT EXISTS execution_event (
event_id INTEGER PRIMARY KEY,
context_id INTEGER NOT NULL REFERENCES execution_context (context_id),
trace_logs TEXT NOT NULL,
eval_error TEXT,
exec_budget_cpu INTEGER NOT NULL,
exec_budget_mem INTEGER NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX IF NOT EXISTS idx_execution_event_created_at ON execution_event(created_at ASC);
CREATE TABLE IF NOT EXISTS cancellation_event (
event_id INTEGER PRIMARY KEY,
block_hash BLOB NOT NULL REFERENCES block (hash),
target_script_hash BLOB NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX IF NOT EXISTS idx_cancellation_event_block_hash ON cancellation_event(block_hash);
CREATE INDEX IF NOT EXISTS idx_cancellation_event_created_at ON cancellation_event(created_at ASC);
CREATE TABLE IF NOT EXISTS selection_event (
event_id INTEGER PRIMARY KEY,
block_hash BLOB NOT NULL REFERENCES block (hash),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX IF NOT EXISTS idx_selection_event_block_hash ON selection_event(block_hash);
CREATE INDEX IF NOT EXISTS idx_selection_event_created_at ON selection_event(created_at ASC)