Guest User

Untitled

a guest
Jul 20th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. CREATE SCHEMA IF NOT EXISTS `EOSTransactions` DEFAULT CHARACTER SET utf8;
  2. USE `EOSTransactions` ;
  3.  
  4. CREATE TABLE IF NOT EXISTS `account` (
  5. `id` BIGINT(20) NOT NULL AUTO_INCREMENT,
  6. `name` VARCHAR(12),
  7. `created` DATETIME NOT NULL,
  8. `balance` BIGINT(20) NOT NULL DEFAULT 0,
  9. PRIMARY KEY (`id`),
  10. UNIQUE INDEX `name_UNIQUE` (`name` ASC)
  11. );
  12.  
  13. CREATE TABLE IF NOT EXISTS `transaction` (
  14. `id` BIGINT(20) NOT NULL AUTO_INCREMENT,
  15. `trx_id` CHAR(64) NOT NULL,
  16. `from_id` BIGINT(20) NOT NULL,
  17. `to_id` BIGINT(20) NOT NULL,
  18. `amount` BIGINT(20) NOT NULL,
  19. `created` DATETIME NOT NULL,
  20. PRIMARY KEY (`id`),
  21. INDEX `created_idx` (`created` ASC),
  22. INDEX `to_id_fk_idx` (`to_id` ASC),
  23. INDEX `from_id_fk_idx` (`from_id` ASC),
  24. CONSTRAINT `from_id_fk`
  25. FOREIGN KEY (`from_id`)
  26. REFERENCES `account` (`id`),
  27. CONSTRAINT `to_id_fk`
  28. FOREIGN KEY (`to_id`)
  29. REFERENCES `account` (`id`)
  30. );
Add Comment
Please, Sign In to add comment