diff options
Diffstat (limited to 'db/schema.sql')
| -rw-r--r-- | db/schema.sql | 200 |
1 files changed, 149 insertions, 51 deletions
diff --git a/db/schema.sql b/db/schema.sql index 58b56e65..07b216e7 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -1,13 +1,13 @@ --- MySQL dump 10.14 Distrib 5.5.65-MariaDB, for Linux (x86_64) +-- MySQL dump 10.19 Distrib 10.3.30-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: localhost Database: coinos +-- Host: 0.0.0.0 Database: coinos -- ------------------------------------------------------ --- Server version 5.5.65-MariaDB +-- Server version 10.6.1-MariaDB-1:10.6.1+maria~focal /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -16,6 +16,16 @@ /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- +-- Current Database: `coinos` +-- + +/*!40000 DROP DATABASE IF EXISTS `coinos`*/; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `coinos` /*!40100 DEFAULT CHARACTER SET utf8mb4 */; + +USE `coinos`; + +-- -- Table structure for table `SequelizeMeta` -- @@ -23,11 +33,11 @@ DROP TABLE IF EXISTS `SequelizeMeta`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `SequelizeMeta` ( - `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(255) COLLATE utf8mb3_unicode_ci NOT NULL, PRIMARY KEY (`name`), UNIQUE KEY `name` (`name`), UNIQUE KEY `SequelizeMeta_name_unique` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -49,17 +59,16 @@ CREATE TABLE `accounts` ( `ticker` varchar(255) DEFAULT NULL, `precision` int(11) DEFAULT NULL, `domain` varchar(255) DEFAULT NULL, - `contract` text, - `index` int(11) NOT NULL DEFAULT '0', + `contract` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, `pubkey` varchar(255) DEFAULT NULL, + `index` int(11) NOT NULL DEFAULT 0, `hide` tinyint(1) DEFAULT NULL, `seed` varchar(255) DEFAULT NULL, `path` varchar(255) DEFAULT NULL, `network` varchar(255) DEFAULT NULL, `privkey` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `asset` (`asset`) -) ENGINE=InnoDB AUTO_INCREMENT=14770 DEFAULT CHARSET=latin1; + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4197 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -70,10 +79,10 @@ DROP TABLE IF EXISTS `codes`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `codes` ( - `code` varchar(255) NOT NULL DEFAULT '', - `text` text, + `code` varchar(255) NOT NULL, + `text` text DEFAULT NULL, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -92,7 +101,7 @@ CREATE TABLE `deposits` ( `credited` tinyint(1) DEFAULT NULL, `code` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4212 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=4122 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -105,7 +114,7 @@ DROP TABLE IF EXISTS `invoices`; CREATE TABLE `invoices` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) DEFAULT NULL, - `text` text, + `text` text DEFAULT NULL, `createdAt` datetime NOT NULL, `updatedAt` datetime NOT NULL, `rate` double DEFAULT NULL, @@ -113,19 +122,16 @@ CREATE TABLE `invoices` ( `address` varchar(255) DEFAULT NULL, `received` double DEFAULT NULL, `amount` double DEFAULT NULL, - `tip` double DEFAULT NULL, + `tip` double NOT NULL DEFAULT 0, `network` varchar(255) DEFAULT NULL, `unconfidential` varchar(255) DEFAULT NULL, `uuid` varchar(255) DEFAULT NULL, - `memo` text, + `memo` text DEFAULT NULL, `account_id` int(11) DEFAULT NULL, `path` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `part_of_unconfidential` (`unconfidential`(10)), - KEY `text_index` (`text`(100)), - KEY `unconfidential_index` (`unconfidential`(100)), - KEY `address_index` (`address`(100)) -) ENGINE=InnoDB AUTO_INCREMENT=13613 DEFAULT CHARSET=latin1; + `webhook` text DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=7965 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -142,7 +148,37 @@ CREATE TABLE `linkingkeys` ( `createdAt` datetime NOT NULL, `updatedAt` datetime NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=7396 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=4671 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `migrations` +-- + +DROP TABLE IF EXISTS `migrations`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `migrations` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) DEFAULT NULL, + `batch` int(11) DEFAULT NULL, + `migration_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `migrations_lock` +-- + +DROP TABLE IF EXISTS `migrations_lock`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `migrations_lock` ( + `index` int(10) unsigned NOT NULL AUTO_INCREMENT, + `is_locked` int(11) DEFAULT NULL, + PRIMARY KEY (`index`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -154,20 +190,18 @@ DROP TABLE IF EXISTS `orders`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `orders` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `a1` varchar(255) DEFAULT NULL, - `a2` varchar(255) DEFAULT NULL, `v1` double DEFAULT NULL, `v2` double DEFAULT NULL, `user_id` int(11) DEFAULT NULL, `createdAt` datetime NOT NULL, `updatedAt` datetime NOT NULL, - `accepted` tinyint(1) NOT NULL DEFAULT '0', + `accepted` tinyint(1) NOT NULL DEFAULT 0, + `rate` double GENERATED ALWAYS AS (`v2` / `v1`) VIRTUAL, + `completedAt` datetime DEFAULT NULL, `a1_id` int(11) DEFAULT NULL, `a2_id` int(11) DEFAULT NULL, - `rate` double AS (v2/v1) VIRTUAL, - `completedAt` datetime DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=239 DEFAULT CHARSET=utf8mb4; +) ENGINE=InnoDB AUTO_INCREMENT=9316 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -180,7 +214,7 @@ DROP TABLE IF EXISTS `payments`; CREATE TABLE `payments` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) DEFAULT NULL, - `hash` text, + `hash` text DEFAULT NULL, `createdAt` datetime NOT NULL, `updatedAt` datetime NOT NULL, `rate` double DEFAULT NULL, @@ -188,19 +222,58 @@ CREATE TABLE `payments` ( `address` varchar(255) DEFAULT NULL, `received` tinyint(1) DEFAULT NULL, `amount` double DEFAULT NULL, - `tip` double NOT NULL DEFAULT '0', + `tip` double NOT NULL DEFAULT 0, `confirmed` tinyint(1) NOT NULL, - `fee` double NOT NULL DEFAULT '0', + `fee` double NOT NULL DEFAULT 0, `network` varchar(255) DEFAULT NULL, `account_id` int(11) DEFAULT NULL, `preimage` varchar(255) DEFAULT NULL, - `memo` text, - `redeemed` tinyint(1) NOT NULL DEFAULT '0', + `memo` text DEFAULT NULL, `redeemcode` varchar(255) DEFAULT NULL, + `redeemed` tinyint(1) NOT NULL DEFAULT 0, `path` varchar(255) DEFAULT NULL, + `invoice_id` int(11) DEFAULT NULL, PRIMARY KEY (`id`), - KEY `idx_redeemcode` (`redeemcode`) -) ENGINE=InnoDB AUTO_INCREMENT=12982 DEFAULT CHARSET=latin1; + KEY `payments_invoice_id_foreign` (`invoice_id`), + CONSTRAINT `payments_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=40344 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `referrals` +-- + +DROP TABLE IF EXISTS `referrals`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `referrals` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `token` varchar(255) DEFAULT NULL, + `expiry` date DEFAULT NULL, + `status` enum('pending','active','expired','cancelled') DEFAULT NULL, + `sponsor_id` int(11) NOT NULL, + `user_id` int(11) DEFAULT NULL, + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + UNIQUE KEY `token` (`token`), + KEY `sponsor_id` (`sponsor_id`), + KEY `user_id` (`user_id`) +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `urls` +-- + +DROP TABLE IF EXISTS `urls`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `urls` ( + `hash` varchar(255) DEFAULT NULL, + `data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + UNIQUE KEY `urls_hash_unique` (`hash`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -214,26 +287,51 @@ CREATE TABLE `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(255) DEFAULT NULL, `password` varchar(255) DEFAULT NULL, - `unit` varchar(255) DEFAULT 'SAT', - `symbol` varchar(255) DEFAULT NULL, + `unit` varchar(255) DEFAULT NULL, + `account_id` int(11) DEFAULT NULL, `currency` varchar(255) DEFAULT NULL, `createdAt` datetime NOT NULL, `updatedAt` datetime NOT NULL, `twofa` tinyint(1) DEFAULT NULL, + `authyId` varchar(255) DEFAULT NULL, `pin` varchar(255) DEFAULT NULL, - `currencies` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin, + `currencies` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, `otpsecret` varchar(255) DEFAULT NULL, - `account_id` int(11) DEFAULT NULL, `ip` int(10) unsigned DEFAULT NULL, - `subscriptions` text, + `subscriptions` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, `seed` varchar(255) DEFAULT NULL, - `fiat` tinyint(1) NOT NULL DEFAULT '0', - `index` int(11) NOT NULL DEFAULT '0', + `linkingKeys` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + `fiat` tinyint(1) NOT NULL DEFAULT 0, + `index` int(11) NOT NULL DEFAULT 0, `verified` varchar(255) DEFAULT NULL, + `locked` tinyint(1) DEFAULT 0, + `email` varchar(255) DEFAULT NULL, + `phone` varchar(255) DEFAULT NULL, + `admin` tinyint(1) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `ip` (`ip`) +) ENGINE=InnoDB AUTO_INCREMENT=797 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `waiting_list` +-- + +DROP TABLE IF EXISTS `waiting_list`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `waiting_list` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `email` varchar(255) DEFAULT NULL, + `sms` varchar(255) DEFAULT NULL, + `user_id` int(11) DEFAULT NULL, + `status` enum('pending','contacted','registered','cancelled') DEFAULT 'pending', + `notes` text DEFAULT NULL, + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`), - KEY `ip` (`ip`), - KEY `username` (`username`) -) ENGINE=InnoDB AUTO_INCREMENT=10009 DEFAULT CHARSET=latin1; + UNIQUE KEY `email` (`email`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -253,10 +351,10 @@ CREATE TABLE `withdrawals` ( `transit` varchar(255) DEFAULT NULL, `account` varchar(255) DEFAULT NULL, `institution` varchar(255) DEFAULT NULL, - `notes` text, + `notes` text DEFAULT NULL, `email` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4115 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=4113 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -268,4 +366,4 @@ CREATE TABLE `withdrawals` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-12-16 19:23:42 +-- Dump completed on 2021-07-13 14:05:34 |
