VerifyVASP
Search…
Database

System Requirement

  • A separate database system is required in the use of enclave management
  • MySQL, PostgreSQL, MSSQL, and Oracle DBMS are supported.
  • MySQL is recommended.

Table Description

  • You need to create 5 tables in total.
    • verifications: A table to store the requests/responses of user verification API.
    • pre_screenings: A table to store the requests/responses of pre-screening API of the risk of the user account number.
    • counter_party_keys: A table to store the public key of the beneficiary VASP.
    • own_keys: A table to store the public key of the originating VASP.
    • commands : A table to store the intermediate requests of asynchronous APIs.

Backup, Restore, and Recover Policies

  • verifications table is recommended to be backed up every day as it manages the verification history of Travel Rules in it.
  • pre_screenings, own_keys are recommended to be backed up regularly.
  • counter_party_keys table is used for the caching purpose, thus it does not require to be restored.
  • commands table does not require to be backed up or restored as only intermediate processing data for temporary use are in it.

Storage Size Considerations

  • pre-screenings table: approximately 1 KB per request
  • verifications table: approximately 4-5 KB per request
  • counter_party_keys table: approximately 1 KB per beneficiary address
  • own_keys: approximately 1 KB per request if PerVerification key type is used
  • commands: approximately 1-5 KB per asynchronous request

Table Definition

verifications table

  • In withdrawal request processing, the pre-screening result from the Travle Rules is stored in this table.
  • When POST /verifications API is called, the request/response result will be recorded in the verifications table.
  • Following columns are encrypted.
    • ivms101_originator
    • ivms101_originating_vasp
    • ivms101_beneficiary
    • ivms101_beneficiary_vasp

Table Creation Query

MySQL
PostgreSQL
MSSQL
Oracle
1
CREATE TABLE `verifications` (
2
`verification_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Verification ID',
3
`verification_uuid` varchar(40) NOT NULL COMMENT 'Verification UUID',
4
`result` enum('WAIT', 'VERIFIED', 'UNKNOWN', 'DENIED', 'ERROR', 'PENDING', 'TRANSFER_ERROR') NOT NULL DEFAULT 'WAIT' COMMENT 'Verification Result',
5
`reason` varchar(256) DEFAULT NULL COMMENT 'Reason',
6
`message` varchar(1024) DEFAULT NULL COMMENT 'Additional information abount the reason',
7
`symbol` varchar(16) DEFAULT NULL COMMENT 'Symbol',
8
`amount` varchar(128) DEFAULT NULL COMMENT 'Amount',
9
`trade_price` varchar(128) DEFAULT NULL COMMENT 'Trading Price',
10
`trade_currency` varchar(128) DEFAULT NULL COMMENT 'Trading Currency',
11
`trade_iso_datetime` datetime DEFAULT NULL COMMENT 'Trading time',
12
`is_exceeding_threshold` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Whether the threshold has been exceeded',
13
`tx_hash` varchar(128) DEFAULT NULL COMMENT 'Tx hash',
14
`originating_vasp_id` bigint(20) unsigned DEFAULT NULL COMMENT 'Originating VASP ID',
15
`originator_account_number` varchar(256) DEFAULT NULL COMMENT 'Originator Account Address or ID',
16
`ivms101_originator` text(65535) DEFAULT NULL COMMENT 'Originator Information',
17
`ivms101_originating_vasp` text(65535) DEFAULT NULL COMMENT 'Originating VASP Information',
18
`beneficiary_vasp_id` bigint(20) unsigned DEFAULT NULL COMMENT 'Beneficiary VASP ID',
19
`beneficiary_account_number` varchar(256) DEFAULT NULL COMMENT 'Beneficiary Account Address or ID',
20
`ivms101_beneficiary` text(65535) DEFAULT NULL COMMENT 'Beneficiary Information',
21
`ivms101_beneficiary_vasp` text(65535) DEFAULT NULL COMMENT 'Beneficiary VASP Information',
22
`verified_at` datetime DEFAULT NULL COMMENT 'Verified at.',
23
`ordered_at` datetime DEFAULT NULL COMMENT 'Ordered at.',
24
`created_at` datetime DEFAULT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Created at.',
25
PRIMARY KEY (`verification_id`),
26
UNIQUE KEY `uk_verifications_verification_uuid` (`verification_uuid`),
27
INDEX `idx_verifications_originator_account` (`originator_account_number`),
28
INDEX `idx_verifications_beneficiary_account` (`beneficiary_account_number`)
29
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Copied!
1
CREATE TYPE enum_result AS ENUM ('WAIT', 'VERIFIED', 'UNKNOWN', 'DENIED', 'ERROR', 'PENDING', 'TRANSFER_ERROR');
2
3
CREATE TABLE verifications (
4
verification_id SERIAL NOT NULL PRIMARY KEY,
5
verification_uuid varchar(40) NOT NULL,
6
UNIQUE(verification_uuid),
7
result enum_result DEFAULT 'WAIT',
8
reason varchar(256) DEFAULT NULL,
9
message varchar(1024) DEFAULT NULL,
10
symbol varchar(16) DEFAULT NULL,
11
amount varchar(128) DEFAULT NULL,
12
trade_price varchar(128) DEFAULT NULL,
13
trade_currency varchar(128) DEFAULT NULL,
14
trade_iso_datetime timestamp DEFAULT NULL,
15
is_exceeding_threshold boolean DEFAULT true NOT NULL,
16
tx_hash varchar(128) DEFAULT NULL,
17
originating_vasp_id numeric(20) DEFAULT NULL,
18
originator_account_number varchar(256) DEFAULT NULL,
19
ivms101_originator varchar(65535) DEFAULT NULL,
20
ivms101_originating_vasp varchar(65535) DEFAULT NULL,
21
beneficiary_vasp_id numeric(20) DEFAULT NULL,
22
beneficiary_account_number varchar(256) DEFAULT NULL,
23
ivms101_beneficiary varchar(65535) DEFAULT NULL,
24
ivms101_beneficiary_vasp varchar(65535) DEFAULT NULL,
25
verified_at timestamp DEFAULT NULL,
26
ordered_at timestamp DEFAULT NULL,
27
created_at timestamp DEFAULT CURRENT_TIMESTAMP
28
);
29
30
CREATE INDEX idx_verifications_originator_account ON verifications(originator_account_number);
31
CREATE INDEX idx_verifications_beneficiary_account ON verifications(beneficiary_account_number);
Copied!
1
CREATE TABLE verifications (
2
verification_id bigint check (verification_id > 0) NOT NULL PRIMARY KEY,
3
verification_uuid nvarchar(40) NOT NULL UNIQUE,
4
result nvarchar(20) DEFAULT 'WAIT' NOT NULL check (result in ('WAIT', 'VERIFIED', 'UNKNOWN', 'DENIED', 'ERROR', 'PENDING', 'TRANSFER_ERROR')),
5
reason nvarchar(256) DEFAULT NULL,
6
message nvarchar(1024) DEFAULT NULL,
7
symbol nvarchar(16) DEFAULT NULL,
8
amount nvarchar(128) DEFAULT NULL,
9
trade_price nvarchar(128) DEFAULT NULL,
10
trade_currency nvarchar(128) DEFAULT NULL,
11
trade_iso_datetime datetime DEFAULT NULL,
12
is_exceeding_threshold BOOLEAN DEFAULT '1' NOT NULL,
13
tx_hash nvarchar(128) DEFAULT NULL,
14
originating_vasp_id bigint check (originating_vasp_id > 0) DEFAULT NULL,
15
originator_account_number nvarchar(256) DEFAULT NULL,
16
ivms101_originator nvarchar(MAX) DEFAULT NULL,
17
ivms101_originating_vasp nvarchar(MAX) DEFAULT NULL,
18
beneficiary_vasp_id bigint check (beneficiary_vasp_id > 0) DEFAULT NULL,
19
to_account_number nvarchar(256) DEFAULT NULL,
20
ivms101_beneficiary nvarchar(MAX) DEFAULT NULL,
21
ivms101_beneficiary_vasp nvarchar(MAX) DEFAULT NULL,
22
verified_at datetime DEFAULT NULL,
23
ordered_at datetime DEFAULT NULL,
24
created_at datetime DEFAULT CURRENT_TIMESTAMP
25
);
26
27
CREATE INDEX idx_verifications_originator_account ON verifications(originator_account_number);
28
CREATE INDEX idx_verifications_beneficiary_account ON verifications(beneficiary_account_number);
Copied!
1
CREATE TABLE "verifications" (
2
"verification_id" number(20) NOT NULL,
3
"verification_uuid" varchar2(40) NOT NULL,
4
"result" varchar2(20) DEFAULT 'WAIT' NOT NULL check ("result" in ('WAIT', 'VERIFIED', 'UNKNOWN', 'DENIED', 'ERROR', 'PENDING', 'TRANSFER_ERROR')),
5
"reason" varchar2(256) DEFAULT NULL,
6
"message" varchar2(1024) DEFAULT NULL,
7
"symbol" varchar2(16) DEFAULT NULL,
8
"amount" varchar2(128) DEFAULT NULL,
9
"trade_price" varchar2(128) DEFAULT NULL,
10
"trade_currency" varchar2(128) DEFAULT NULL,
11
"trade_iso_datetime" date DEFAULT NULL,
12
"is_exceeding_threshold" number(1) DEFAULT 1,
13
"tx_hash" varchar2(128) DEFAULT NULL,
14
"originating_vasp_id" varchar2(20) DEFAULT NULL,
15
"originator_account_number" varchar2(256) DEFAULT NULL,
16
"ivms101_originator" clob DEFAULT NULL,
17
"ivms101_originating_vasp" clob DEFAULT NULL,
18
"beneficiary_vasp_id" varchar2(20) DEFAULT NULL,
19
"beneficiary_account_number" varchar2(256) DEFAULT NULL,
20
"ivms101_beneficiary" clob DEFAULT NULL,
21
"ivms101_beneficiary_vasp" clob DEFAULT NULL,
22
"verified_at" date DEFAULT NULL,
23
"ordered_at" date DEFAULT NULL,
24
"created_at" date DEFAULT CURRENT_TIMESTAMP,
25
CONSTRAINT "pk_verification_id" PRIMARY KEY ("verification_id"),
26
CONSTRAINT "uk_verification_uuid" UNIQUE("verification_uuid")
27
);
28
29
CREATE INDEX "idx_originator_account" ON "verifications"("originator_account_number");
30
CREATE INDEX "idx_beneficiary_account" ON "verifications"("beneficiary_account_number");
31
32
CREATE SEQUENCE "verifications_id_seq";
33
34
CREATE OR REPLACE TRIGGER verifications_trigger
35
BEFORE INSERT ON "verifications"
36
FOR EACH ROW
37
BEGIN
38
SELECT "verifications_id_seq".nextval
39
INTO :new."verification_id"
40
FROM dual;
41
END;
42
/
Copied!

pre_screenings table

  • When withdrawal is requested, the result of the risk level estimated with virtual asset account numbers of both beneficiary and originator is recorded.
  • When POST /pre-screening API is called, the request/response will be recorded in the pre_screenings table.

Table Creation Query

MySQL
PostgreSQL
MSSQL
Oracle
1
CREATE TABLE `pre_screenings` (
2
`pre_screening_id` bigint(20) unsigned NOT NULL COMMENT 'Pre-Screening request ID',
3
`pre_screening_asset` varchar(256) DEFAULT NULL COMMENT 'The asset associated with the address',
4
`pre_screening_address` varchar(256) DEFAULT NULL COMMENT 'Address',
5
`cluster_name` varchar(256) DEFAULT NULL COMMENT 'The name of the named cluster',
6
`cluster_category` varchar(256) DEFAULT NULL COMMENT 'The category of the named cluster',
7
`rating` enum('UNKNOWN', 'HIGH', 'MEDIUM', 'LOW') DEFAULT NULL COMMENT 'The risk rating of the known recipient address',
8
`created_at` datetime DEFAULT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Created at.',
9
PRIMARY KEY (`pre_screening_id`),
10
INDEX `idx_pre_screenings_address` (`pre_screening_address`),
11
INDEX `idx_pre_screenings_asset` (`pre_screening_asset`)
12
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Copied!
1
CREATE TYPE enum_rating AS ENUM ('UNKNOWN', 'HIGH', 'MEDIUM', 'LOW');
2
3
CREATE TABLE pre_screenings (
4
pre_screening_id numeric(20) NOT NULL PRIMARY KEY,
5
pre_screening_asset varchar(256) DEFAULT NULL,
6
pre_screening_address varchar(256) DEFAULT NULL,
7
cluster_name varchar(256) DEFAULT NULL,
8
cluster_category varchar(256) DEFAULT NULL,
9
rating enum_rating DEFAULT NULL,
10
created_at timestamp DEFAULT CURRENT_TIMESTAMP
11
);
12
13
CREATE INDEX idx_pre_screenings_address ON pre_screenings(pre_screening_address);
14
CREATE INDEX idx_pre_screenings_asset ON pre_screenings(pre_screening_asset);
Copied!
1
CREATE TYPE enum_rating AS ENUM ('UNKNOWN', 'HIGH', 'MEDIUM', 'LOW');
2
3
CREATE TABLE pre_screenings (
4
pre_screening_id numeric(20) NOT NULL PRIMARY KEY,
5
pre_screening_asset varchar(256) DEFAULT NULL,
6
pre_screening_address varchar(256) DEFAULT NULL,
7
cluster_name varchar(256) DEFAULT NULL,
8
cluster_category varchar(256) DEFAULT NULL,
9
rating enum_rating DEFAULT NULL,
10
created_at timestamp DEFAULT CURRENT_TIMESTAMP
11
);
12
13
CREATE INDEX idx_pre_screenings_address ON pre_screenings(pre_screening_address);
14
CREATE INDEX idx_pre_screenings_asset ON pre_screenings(pre_screening_asset);
Copied!
1
CREATE TABLE "pre_screenings" (
2
"pre_screening_id" number(20) check ("pre_screening_id" > 0) NOT NULL,
3
"pre_screening_asset" varchar2(256) DEFAULT NULL,
4
"pre_screening_address" varchar2(256) DEFAULT NULL,
5
"cluster_name" varchar2(256) DEFAULT NULL,
6
"cluster_category" varchar2(256) DEFAULT NULL,
7
"rating" varchar2(20) DEFAULT NULL check ("rating" in ('UNKNOWN', 'HIGH', 'MEDIUM', 'LOW')),
8
"created_at" date DEFAULT CURRENT_TIMESTAMP,
9
CONSTRAINT "pre_screening_id" PRIMARY KEY ("pre_screening_id")
10
);
11
12
CREATE INDEX "idx_pre_screenings_address" ON "pre_screenings"("pre_screening_address");
13
CREATE INDEX "idx_pre_screenings_asset" ON "pre_screenings"("pre_screening_asset");
Copied!

counter_party_keys Table

  • The table stores the public key of the beneficiary VASP, which is used to encrypt personal information in the verification process.
  • According to the key type determined by the originating VASP, the public key of the beneficiary VASP is recorded.
  • When POST /verifications API is called, it is checked whether the public key of the beneficiary VASP is being cashed. If not, an automatic request to the beneficiary VASP is sent and saved in this table.

Table Creation Query

MySQL
PostgreSQL
MSSQL
Oracle
1
CREATE TABLE `counter_party_keys` (
2
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Key ID',
3
`type` enum('PerVasp', 'PerAddress', 'PerVerification') NOT NULL COMMENT 'Key types',
4
`vasp_id` bigint(20) unsigned NOT NULL COMMENT 'Counter party VASP ID',
5
`key_identifier` varchar(256) NOT NULL COMMENT 'Identifier of key (address or vaspid)',
6
`public_key` varchar(256) NOT NULL COMMENT 'Public Key of counter party',
7
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Created at.',
8
PRIMARY KEY (`id`),
9
UNIQUE KEY `key_uniqueness` (`vasp_id`, `key_identifier`, `type`)
10
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Copied!
1
CREATE TYPE enum_key_types AS ENUM ('PerVasp', 'PerAddress', 'PerVerification');
2
3
CREATE TABLE counter_party_keys (
4
id SERIAL NOT NULL PRIMARY KEY,
5
type enum_key_types NOT NULL,
6
vasp_id numeric(20) NOT NULL,
7
key_identifier varchar(256) NOT NULL,
8
UNIQUE(vasp_id, key_identifier, type),
9
public_key varchar(256) NOT NULL,
10
created_at timestamp DEFAULT CURRENT_TIMESTAMP
11
);
Copied!
1
CREATE TABLE counter_party_keys (
2
id bigint check (id > 0) NOT NULL PRIMARY KEY,
3
type nvarchar(10) NOT NULL check (type in ('PerVasp', 'PerAddress', 'PerVerification')),
4
vasp_id bigint check (vasp_id > 0) NOT NULL,
5
key_identifier nvarchar(256) NOT NULL,
6
public_key nvarchar(256) NOT NULL,
7
created_at datetime DEFAULT CURRENT_TIMESTAMP,
8
CONSTRAINT key_uniqueness UNIQUE(vasp_id, key_identifier, type)
9
);
Copied!
1
CREATE TABLE "counter_party_keys" (
2
"id" number(20) NOT NULL,
3
"type" varchar2(20) NOT NULL check ("type" in ('PerVasp', 'PerAddress', 'PerVerification')),
4
"vasp_id" varchar2(20) NOT NULL,
5
"key_identifier" varchar2(256) NOT NULL,
6
"public_key" varchar2(256) NOT NULL,
7
"created_at" date DEFAULT CURRENT_TIMESTAMP,
8
CONSTRAINT "key_uniq_counter_party_keys" UNIQUE ("vasp_id", "key_identifier", "type")
9
);
10
11
CREATE SEQUENCE "counter_party_keys_id_seq";
12
13
CREATE OR REPLACE TRIGGER counter_party_keys_trigger
14
BEFORE INSERT ON "counter_party_keys"
15
FOR EACH ROW
16
BEGIN
17
SELECT "counter_party_keys_id_seq".nextval
18
INTO :new."id"
19
FROM dual;
20
END;
21
/
Copied!

own_keys Table

  • The table stores the public key and private key of the Own VASP - the enclave VASP itself - both of which are used in personal information encryption during the verification process.
  • When the other VASP requests a public key inquiry, the requested type of public key can be returned by being fetched from this table.
  • The private key is saved as encrypted.
Table Creation Query
MySQL
PostgreSQL
MSSQL
Oracle
1
CREATE TABLE `own_keys` (
2
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Key ID',
3
`type` enum('PerVasp', 'PerAddress', 'PerVerification') NOT NULL COMMENT 'Key types',
4
`key_identifier` varchar(256) NOT NULL COMMENT 'Identifier of key (address or type or publickey)',
5
`public_key` varchar(256) NOT NULL COMMENT 'Public Key',
6
`private_key` varchar(256) NOT NULL COMMENT 'Private Key',
7
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Created at.',
8
PRIMARY KEY (`id`),
9
UNIQUE KEY `key_uniqueness` (`key_identifier`, `type`),
10
INDEX `public_key` (`public_key`, `private_key`)
11
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Copied!
1
CREATE TABLE own_keys (
2
id SERIAL NOT NULL PRIMARY KEY,
3
type enum_key_types NOT NULL,
4
key_identifier varchar(256) NOT NULL,
5
UNIQUE(key_identifier, type),
6
public_key varchar(256) NOT NULL,
7
private_key varchar(256) NOT NULL,
8
created_at timestamp DEFAULT CURRENT_TIMESTAMP
9
);
10
11
CREATE INDEX public_key ON own_keys(public_key, private_key);
Copied!
1
CREATE TABLE own_keys (
2
id bigint check (id > 0) NOT NULL PRIMARY KEY,
3
type nvarchar(10) NOT NULL check (type in ('PerVasp', 'PerAddress', 'PerVerification')),
4
key_identifier nvarchar(256) NOT NULL,
5
public_key nvarchar(256) NOT NULL,
6
private_key nvarchar(256) NOT NULL,
7
created_at datetime DEFAULT CURRENT_TIMESTAMP,
8
CONSTRAINT key_uniqueness UNIQUE(key_identifier, type)
9
);
10
11
CREATE INDEX public_key ON own_keys(public_key, private_key);
Copied!
1
CREATE TABLE "own_keys" (
2
"id" number(20) NOT NULL,
3
"type" varchar2(20) NOT NULL check ("type" in ('PerVasp', 'PerAddress', 'PerVerification')),
4
"key_identifier" varchar2(256) NOT NULL,
5
"public_key" varchar2(256) NOT NULL,
6
"private_key" varchar2(256) NOT NULL,
7
"created_at" date DEFAULT CURRENT_TIMESTAMP,
8
CONSTRAINT "key_uniq_own_keys" UNIQUE ("key_identifier", "type")
9
);
10
11
CREATE INDEX "idx_public_key" ON "own_keys"("public_key", "private_key");
12
CREATE SEQUENCE "own_keys_id_seq";
13
14
CREATE OR REPLACE TRIGGER own_keys_trigger
15
BEFORE INSERT ON "own_keys"
16
FOR EACH ROW
17
BEGIN
18
SELECT "own_keys_id_seq".nextval
19
INTO :new."id"
20
FROM dual;
21
END;
22
/
Copied!

commands Table

  • The intermediate requests in processing asynchronous API are stored in this table.
  • This table is only used inside the enclave, not by VASP.

Table Creation Query

MySQL
PostgreSQL
MSSQL
Oracle
1
CREATE TABLE `commands` (
2
`command_id` bigint(20) unsigned NOT NULL COMMENT 'Command ID',
3
`command_type` varchar(32) NOT NULL COMMENT 'Command type',
4
`command_body` text(65535) NOT NULL COMMENT 'Command body',
5
`status` enum('CREATED', 'PROCESSING', 'DONE', 'ERROR') NOT NULL DEFAULT 'CREATED' COMMENT 'Command status',
6
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Created at.',
7
`fetched_at` datetime DEFAULT NULL COMMENT 'Fetched at.',
8
`finished_at` datetime DEFAULT NULL COMMENT 'Finished at.',
9
PRIMARY KEY (`command_id`),
10
INDEX `status_id` (`status`, `command_id`),
11
INDEX `status_finished_at` (`status`, `finished_at`),
12
INDEX `status_fetched_at_created_at` (`status`, `fetched_at`, `created_at`)
13
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Copied!
1
CREATE type enum_status as ENUM('CREATED', 'PROCESSING', 'DONE', 'ERROR');
2
3
CREATE TABLE commands(
4
command_id numeric(20) NOT NULL PRIMARY KEY,
5
command_type varchar(32) NOT NULL,
6
command_body text NOT NULL,
7
status enum_status NOT NULL DEFAULT 'CREATED',
8
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
9
fetched_at timestamp DEFAULT NULL,
10
finished_at timestamp DEFAULT NULL
11
);
12
13
CREATE INDEX status_id ON commands(status, command_id);
14
CREATE INDEX status_finished_at ON commands(status, finished_at);
15
CREATE INDEX status_fetched_at_created_at ON commands(status, fetched_at, created_at);
Copied!
1
CREATE TABLE commands (
2
command_id BIGINT NOT NULL PRIMARY KEY,
3
command_type nvarchar(32) NOT NULL,
4
command_body nvarchar(MAX) NOT NULL,
5
status nvarchar(20) DEFAULT 'CREATED' NOT NULL check (status in ('CREATED', 'PROCESSING', 'DONE', 'ERROR')),
6
created_at datetime2 DEFAULT CURRENT_TIMESTAMP,
7
fetched_at datetime2 DEFAULT NULL,
8
finished_at datetime2 DEFAULT NULL
9
);
10
11
CREATE INDEX idx_status_id ON commands(status, command_id);
12
CREATE INDEX idx_status_finished_at ON commands(status, finished_at);
13
CREATE INDEX idx_status_fetched_at_created_at ON commands(status, fetched_at, created_at);
Copied!
1
CREATE TABLE "commands" (
2
"command_id" number(20) NOT NULL,
3
"command_type" varchar2(32) NOT NULL,
4
"command_body" clob NOT NULL,
5
"status" varchar2(20) DEFAULT 'CREATED' NOT NULL check ("status" in ('CREATED', 'PROCESSING', 'DONE', 'ERROR')),
6
"created_at" date DEFAULT CURRENT_TIMESTAMP,
7
"fetched_at" date DEFAULT NULL,
8
"finished_at" date DEFAULT NULL,
9
CONSTRAINT "command_id" PRIMARY KEY ("command_id")
10
);
11
12
CREATE INDEX "idx_status_id" ON "commands"("status", "command_id");
13
CREATE INDEX "idx_status_finished_at" ON "commands"("status", "finished_at");
14
CREATE INDEX "idx_status_fetched_at_created_at" ON "commands"("status", "fetched_at", "created_at");
Copied!