kaspad/apiserver/db/migrations/000005_create_transactions_table.up.sql
Ori Newman 4fcd705ae3 [NOD-290] Remove block_id from transactions table (#374)
* [NOD-290] Remove block_id from transactions table

* [NOD-290] Remove block_id foreign key from transactions table
2019-08-25 10:23:03 +03:00

19 lines
783 B
SQL

CREATE TABLE `transactions`
(
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`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_accepting_block_id`
FOREIGN KEY (`accepting_block_id`)
REFERENCES `blocks` (`id`)
);