Web Interfaces of PROSUME

prosume.sql 6.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. -- MySQL dump 10.17 Distrib 10.3.16-MariaDB, for debian-linux-gnu (x86_64)
  2. /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  3. /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  4. /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  5. /*!40101 SET NAMES utf8mb4 */;
  6. /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
  7. /*!40103 SET TIME_ZONE='+00:00' */;
  8. /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
  9. /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
  10. /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
  11. /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
  12. --
  13. -- Table structure for table `balances`
  14. --
  15. DROP TABLE IF EXISTS `balances`;
  16. /*!40101 SET @saved_cs_client = @@character_set_client */;
  17. /*!40101 SET character_set_client = utf8 */;
  18. CREATE TABLE `balances` (
  19. `meter_id` int(11) NOT NULL,
  20. `prs` double DEFAULT NULL,
  21. `tft` double DEFAULT NULL,
  22. `timestamp` datetime NOT NULL,
  23. KEY `meter_id` (`meter_id`)
  24. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  25. /*!40101 SET character_set_client = @saved_cs_client */;
  26. --
  27. -- Table structure for table `blocks`
  28. --
  29. CREATE TABLE `blocks` (
  30. `id` int(11) NOT NULL AUTO_INCREMENT,
  31. `blocknumber` int(11) DEFAULT NULL,
  32. `wallet_type` varchar(50) DEFAULT NULL,
  33. `wallet_from` varchar(50) DEFAULT NULL,
  34. `wallet_to` varchar(50) DEFAULT NULL,
  35. `asset` varchar(50) DEFAULT NULL,
  36. `amount` decimal(15,8) DEFAULT NULL,
  37. `timestamp` datetime DEFAULT NULL,
  38. `memo_hash` char(32) DEFAULT NULL,
  39. `tx_id` char(32) DEFAULT NULL,
  40. `type` enum('measure','payment','transfer','update_price') DEFAULT NULL,
  41. `purchased_sold` double DEFAULT NULL,
  42. `buy_price` double DEFAULT NULL,
  43. `sell_price` double DEFAULT NULL,
  44. `day` date GENERATED ALWAYS AS (cast(`timestamp` as date)) STORED,
  45. `mon` tinyint(4) unsigned GENERATED ALWAYS AS (month(`timestamp`)) STORED,
  46. `yea` smallint(5) unsigned GENERATED ALWAYS AS (year(`timestamp`)) STORED,
  47. PRIMARY KEY (`id`),
  48. KEY `ts` (`timestamp`),
  49. KEY `txid` (`tx_id`),
  50. KEY `day` (`day`),
  51. KEY `idx1` (`day`,`wallet_from`,`wallet_to`,`asset`,`type`),
  52. KEY `mon` (`mon`),
  53. KEY `yea` (`yea`),
  54. KEY `idx2` (`yea`,`mon`,`wallet_from`,`wallet_to`,`asset`,`type`),
  55. KEY `idx3` (`type`),
  56. KEY `idx4` (`wallet_from`,`wallet_to`)
  57. ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
  58. --
  59. -- Table structure for table `conf`
  60. --
  61. DROP TABLE IF EXISTS `conf`;
  62. /*!40101 SET @saved_cs_client = @@character_set_client */;
  63. /*!40101 SET character_set_client = utf8 */;
  64. CREATE TABLE `conf` (
  65. `conf_key` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  66. `conf_value` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL
  67. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  68. /*!40101 SET character_set_client = @saved_cs_client */;
  69. INSERT INTO `conf` VALUES
  70. ('utility_account','name_of_utility_account'),
  71. ('topup_prs_limit','100'),
  72. ('topup_tft_limit','100'),
  73. ('topup_prs_transfer','100'),
  74. ('topup_tft_transfer','100'),
  75. ('topup_prs_memo','Automatic PRS top up'),
  76. ('topup_tft_memo','Automatic TFT top up');
  77. --
  78. -- Table structure for table `meter`
  79. --
  80. DROP TABLE IF EXISTS `meter`;
  81. /*!40101 SET @saved_cs_client = @@character_set_client */;
  82. /*!40101 SET character_set_client = utf8 */;
  83. CREATE TABLE `meter` (
  84. `id` int(11) NOT NULL AUTO_INCREMENT,
  85. `name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  86. `location` varchar(255) COLLATE utf8mb4_unicode_ci NULL,
  87. `status` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'ACTIVE' COMMENT 'Possible status are ACTIVE HIDDEN DELETED SUSPENDED',
  88. `subid` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  89. `buy` double DEFAULT 0.1,
  90. `sell` double DEFAULT 0.1,
  91. `prs` double DEFAULT NULL,
  92. `tft` double DEFAULT NULL,
  93. `timestamp` datetime DEFAULT current_timestamp(),
  94. PRIMARY KEY (`id`),
  95. UNIQUE KEY `name` (`name`)
  96. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  97. /*!40101 SET character_set_client = @saved_cs_client */;
  98. --
  99. -- Table structure for table `memo`
  100. --
  101. DROP TABLE IF EXISTS `memo`;
  102. /*!40101 SET @saved_cs_client = @@character_set_client */;
  103. /*!40101 SET character_set_client = utf8 */;
  104. CREATE TABLE `memo` (
  105. `id` int(11) NOT NULL AUTO_INCREMENT,
  106. `block_id` int(11) DEFAULT NULL,
  107. `memo_key` varchar(255) DEFAULT NULL,
  108. `memo_value` varchar(512) DEFAULT NULL,
  109. PRIMARY KEY (`id`),
  110. KEY `block_id` (`block_id`),
  111. KEY `memo_key` (`memo_key`),
  112. KEY `memo_value` (`memo_value`)
  113. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
  114. /*!40101 SET character_set_client = @saved_cs_client */;
  115. --
  116. -- Table structure for table `pending_payments`
  117. --
  118. DROP TABLE IF EXISTS `pending_payments`;
  119. /*!40101 SET @saved_cs_client = @@character_set_client */;
  120. /*!40101 SET character_set_client = utf8 */;
  121. CREATE TABLE `pending_payments` (
  122. `tx_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL
  123. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  124. /*!40101 SET character_set_client = @saved_cs_client */;
  125. --
  126. -- Table structure for table `users`
  127. --
  128. DROP TABLE IF EXISTS `users`;
  129. /*!40101 SET @saved_cs_client = @@character_set_client */;
  130. /*!40101 SET character_set_client = utf8 */;
  131. CREATE TABLE `users` (
  132. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  133. `username` varchar(255) NOT NULL,
  134. `password` varchar(255) NOT NULL,
  135. `emailaddress` varchar(255) DEFAULT NULL,
  136. `role` varchar(20) DEFAULT NULL,
  137. `created` datetime DEFAULT NULL,
  138. `modified` datetime DEFAULT NULL,
  139. `meter_id` int(11) DEFAULT NULL,
  140. PRIMARY KEY (`id`)
  141. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  142. INSERT INTO `users` VALUES (1,'admin','$2y$10$012BWTuRtKQEwpM/lWA1FumB6rITsjgnOGWj1zveBZTEVseWWuQze','admin_email@example.com','admin', NOW(), NOW(), NULL);
  143. /*!40101 SET character_set_client = @saved_cs_client */;
  144. /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
  145. /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
  146. /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
  147. /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
  148. /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  149. /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  150. /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  151. /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
  152. -- Dump completed on 2020-02-07 16:57:30