You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mysql.sql 2.0 kB

4 years ago
4 years ago
4 years ago
4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. -- -------------------------------- The script used when storeMode is 'db' --------------------------------
  2. CREATE database if NOT EXISTS `seata` default character set utf8mb4 collate utf8mb4_unicode_ci;
  3. USE `seata`;
  4. SET NAMES utf8mb4;
  5. SET FOREIGN_KEY_CHECKS = 0;
  6. -- the table to store GlobalSession data
  7. CREATE TABLE IF NOT EXISTS `global_table`
  8. (
  9. `addressing` varchar(128) NOT NULL,
  10. `xid` varchar(128) NOT NULL,
  11. `transaction_id` bigint DEFAULT NULL,
  12. `transaction_name` varchar(128) DEFAULT NULL,
  13. `timeout` int DEFAULT NULL,
  14. `begin_time` bigint DEFAULT NULL,
  15. `status` tinyint NOT NULL,
  16. `active` bit(1) NOT NULL,
  17. `gmt_create` datetime DEFAULT NULL,
  18. `gmt_modified` datetime DEFAULT NULL,
  19. PRIMARY KEY (`xid`),
  20. KEY `idx_gmt_modified_status` (`gmt_modified`,`status`),
  21. KEY `idx_transaction_id` (`transaction_id`)
  22. ) ENGINE = InnoDB
  23. DEFAULT CHARSET = utf8;
  24. -- the table to store BranchSession data
  25. CREATE TABLE IF NOT EXISTS `branch_table`
  26. (
  27. `addressing` varchar(128) NOT NULL,
  28. `xid` varchar(128) NOT NULL,
  29. `branch_id` bigint NOT NULL,
  30. `transaction_id` bigint DEFAULT NULL,
  31. `resource_id` varchar(256) DEFAULT NULL,
  32. `lock_key` VARCHAR(1000),
  33. `branch_type` varchar(8) DEFAULT NULL,
  34. `status` tinyint DEFAULT NULL,
  35. `application_data` varchar(2000) DEFAULT NULL,
  36. `async_commit` tinyint NOT NULL DEFAULT 1,
  37. `gmt_create` datetime(6) DEFAULT NULL,
  38. `gmt_modified` datetime(6) DEFAULT NULL,
  39. PRIMARY KEY (`branch_id`),
  40. KEY `idx_xid` (`xid`)
  41. ) ENGINE = InnoDB
  42. DEFAULT CHARSET = utf8;
  43. -- the table to store lock data
  44. CREATE TABLE IF NOT EXISTS `lock_table`
  45. (
  46. `row_key` VARCHAR(256) NOT NULL,
  47. `xid` VARCHAR(128) NOT NULL,
  48. `transaction_id` BIGINT,
  49. `branch_id` BIGINT NOT NULL,
  50. `resource_id` VARCHAR(256),
  51. `table_name` VARCHAR(64),
  52. `pk` VARCHAR(36),
  53. `gmt_create` DATETIME,
  54. `gmt_modified` DATETIME,
  55. PRIMARY KEY (`row_key`),
  56. KEY `idx_branch_id` (`branch_id`)
  57. ) ENGINE = InnoDB
  58. DEFAULT CHARSET = utf8;