mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-25 23:42:36 +00:00

* [NOD-280] Create database for API server * [NOD-280] Rename public_key_script to pk_script * [NOD-280] Change indexes names * [NOD-280] Add accepting block to blocks and transactions table and remove accepting_blocks table * [NOD-280] Add readme * [NOD-280] Change VARCHAR(32) to CHAR(64) * [NOD-280] Rename location_in_block to index
23 lines
947 B
SQL
23 lines
947 B
SQL
CREATE TABLE `transactions`
|
|
(
|
|
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
`block_id` BIGINT UNSIGNED NOT NULL,
|
|
`accepting_block_id` BIGINT UNSIGNED NULL,
|
|
`transaction_hash` CHAR(64) NOT NULL,
|
|
`transaction_id` CHAR(64) NOT NULL,
|
|
`lock_time` BIGINT UNSIGNED NOT NULL,
|
|
`subnetwork_id` BIGINT UNSIGNED NOT NULL,
|
|
`gas` BIGINT UNSIGNED NOT NULL,
|
|
`payload_hash` CHAR(64) NOT NULL,
|
|
`payload` BLOB NOT NULL,
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE INDEX `idx_transactions_transaction_hash` (`transaction_hash`),
|
|
INDEX `idx_transactions_transaction_id` (`transaction_id`),
|
|
CONSTRAINT `fk_transactions_block_id`
|
|
FOREIGN KEY (`block_id`)
|
|
REFERENCES `blocks` (`id`),
|
|
CONSTRAINT `fk_transactions_accepting_block_id`
|
|
FOREIGN KEY (`accepting_block_id`)
|
|
REFERENCES `blocks` (`id`)
|
|
);
|