Skip to content

Commit

Permalink
init db schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew7234 committed Oct 6, 2023
1 parent 5881904 commit d113244
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions storage/migrations/02_runtimes.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ CREATE TABLE chain.runtime_transactions
"to" oasis_addr, -- Exact semantics depend on method. Extracted from body; for convenience only.
amount UINT_NUMERIC, -- Exact semantics depend on method. Extracted from body; for convenience only.

-- Added in 22_runtime_abi.up.sql
-- evm_fn_name TEXT,
-- evm_fn_params JSONB,
-- evm_tx_result JSONB,

-- Encrypted data in encrypted Ethereum-format transactions.
evm_encrypted_format call_format,
evm_encrypted_public_key BYTEA,
Expand All @@ -67,6 +72,10 @@ CREATE TABLE chain.runtime_transactions
error_module TEXT,
error_code UINT63,
error_message TEXT
-- Added in 19_runtime_tx_errors.up.sql
-- error_message_raw TEXT
-- Added in 22_runtime_abi.up.sql
-- error_params JSONB
);
CREATE INDEX ix_runtime_transactions_tx_hash ON chain.runtime_transactions USING hash (tx_hash);
CREATE INDEX ix_runtime_transactions_tx_eth_hash ON chain.runtime_transactions USING hash (tx_eth_hash);
Expand Down
18 changes: 18 additions & 0 deletions storage/migrations/22_runtime_abi.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
BEGIN;

ALTER TABLE chain.runtime_transactions
-- For evm.Call transactions, we store both the name of the function and
-- the function paramters.
ADD COLUMN evm_fn_name TEXT,
ADD COLUMN evm_fn_params JSONB,
-- The parsed result(s) return by the transaction.
ADD COLUMN evm_tx_result JSONB,
-- Custom errors may be arbitrarily defined by the contract abi. This field
-- stores the full abi-decoded error object. Note that the error name is
-- stored separately in the existing error_message column. For example, if we
-- have an error like `InsufficientBalance{available: 4, required: 10}`.
-- the error_message column would hold `InsufficientBalance`, and
-- the error_params column would store `{available: 4, required: 10}`.
ADD COLUMN error_params JSONB;

COMMIT;

0 comments on commit d113244

Please sign in to comment.