aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/db.js5
-rw-r--r--db/index.js157
-rw-r--r--db/init/prodschema.sql312
-rw-r--r--db/migrations/20210612181508_init_referrals.js24
-rw-r--r--db/migrations/20210612192804_init_waiting_list.js.js24
-rw-r--r--db/migrations/20210612203333_schema_diff_merges.js39
-rw-r--r--db/migrations/20210625232223_add_invoice_id_to_payments.js13
-rw-r--r--db/migrations/20210628221727_add_webhook_to_invoices.js11
-rw-r--r--db/migrations/20210713174217_add_admin_to_users.js16
-rw-r--r--db/migrations/20210714123455_data_fixes_merge.js22
-rw-r--r--db/migrations/20210714123456_add_fks_merge.js45
-rw-r--r--db/migrations/s2/user_adjustments.js67
-rw-r--r--db/models/accounts.js217
-rw-r--r--db/models/codes.js32
-rw-r--r--db/models/deposits.js76
-rw-r--r--db/models/invoices.js202
-rw-r--r--db/models/keys.js40
-rw-r--r--db/models/orders.js112
-rw-r--r--db/models/payments.js220
-rw-r--r--db/models/referrals.js90
-rw-r--r--db/models/requests.js67
-rw-r--r--db/models/users.js270
-rw-r--r--db/models/waiting_list.js45
-rw-r--r--db/models/withdrawals.js103
-rw-r--r--db/normalized/README.md48
-rw-r--r--db/normalized/accounts.js231
-rw-r--r--db/normalized/bank_accounts.js24
-rw-r--r--db/normalized/credits.js236
-rw-r--r--db/normalized/debits.js236
-rw-r--r--db/normalized/deposits.js100
-rw-r--r--db/normalized/exchanges.js232
-rw-r--r--db/normalized/invoices.js206
-rw-r--r--db/normalized/liquid_assets.js21
-rw-r--r--db/normalized/ln_keys.js16
-rw-r--r--db/normalized/lnurl_codes.js14
-rw-r--r--db/normalized/non_custodial_accounts.js91
-rw-r--r--db/normalized/orders.js29
-rw-r--r--db/normalized/referrals.js20
-rw-r--r--db/normalized/transactions.js41
-rw-r--r--db/normalized/transfers.js243
-rw-r--r--db/normalized/user_preferences.js20
-rw-r--r--db/normalized/user_security.js22
-rw-r--r--db/normalized/users.js18
-rw-r--r--db/normalized/vouchers.js18
-rw-r--r--db/normalized/waiting_list.js60
-rw-r--r--db/normalized/withdrawals.js128
-rw-r--r--db/schema.sql479
47 files changed, 0 insertions, 4742 deletions
diff --git a/db/db.js b/db/db.js
deleted file mode 100644
index 9e7cc25b..00000000
--- a/db/db.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import Sequelize from "@sequelize/core";
-import config from "$config";
-
-let { database, user, password, options } = config.db;
-export default new Sequelize(database, user, password, options);
diff --git a/db/index.js b/db/index.js
deleted file mode 100644
index e88c8432..00000000
--- a/db/index.js
+++ /dev/null
@@ -1,157 +0,0 @@
-import Sequelize from "@sequelize/core";
-
-import db from "$db/db";
-
-db.authenticate().catch(err => {
- console.debug("Error connecting to database: " + err.message);
-});
-
-import "./models/accounts";
-import "./models/codes";
-import "./models/deposits";
-import "./models/invoices";
-import "./models/keys";
-import "./models/payments";
-import "./models/orders";
-import "./models/requests";
-import "./models/users";
-import "./models/withdrawals";
-
-import "./models/referrals";
-import "./models/waiting_list";
-
-const { User, Account, Payment, Invoice, Key, Order, Referral, Request } = db;
-
-User.hasMany(Account, {
- as: "accounts",
- foreignKey: "user_id"
-});
-
-User.hasMany(Invoice, {
- as: "invoices",
- foreignKey: "user_id"
-});
-
-User.hasMany(Key, {
- as: "keys",
- foreignKey: "user_id"
-});
-
-User.hasMany(Order, {
- as: "orders",
- foreignKey: "user_id"
-});
-
-User.hasMany(Payment, {
- as: "payments",
- foreignKey: "user_id"
-});
-
-User.belongsTo(Account, {
- as: "account",
- foreignKey: "account_id"
-});
-
-Invoice.belongsTo(Account, {
- as: "account",
- foreignKey: "account_id"
-});
-
-Account.belongsTo(User, {
- as: "user",
- foreignKey: "user_id"
-});
-
-Invoice.belongsTo(User, {
- as: "user",
- foreignKey: "user_id"
-});
-
-Key.belongsTo(User, {
- as: "user",
- foreignKey: "user_id"
-});
-
-Payment.belongsTo(Account, {
- as: "account",
- foreignKey: "account_id"
-});
-
-Payment.belongsTo(User, {
- as: "user",
- foreignKey: "user_id"
-});
-
-Payment.belongsTo(Invoice, {
- as: "invoice",
- foreignKey: "invoice_id"
-});
-
-Order.belongsTo(User, {
- as: "user",
- foreignKey: "user_id"
-});
-
-Order.belongsTo(Account, {
- as: "acc1",
- foreignKey: "a1_id"
-});
-
-Order.belongsTo(Account, {
- as: "acc2",
- foreignKey: "a2_id"
-});
-
-User.hasMany(Referral, {
- as: "referral_codes",
- foreignKey: "sponsor_id"
-});
-
-User.hasMany(Referral, {
- as: "sponsors",
- foreignKey: "user_id"
-});
-
-Referral.belongsTo(User, {
- as: "sponsor",
- foreignKey: "sponsor_id"
-});
-
-Referral.belongsTo(User, {
- as: "user",
- foreignKey: "user_id"
-});
-
-Payment.belongsTo(Payment, {
- as: "fee_payment",
- foreignKey: "fee_payment_id"
-});
-
-Payment.belongsTo(User, {
- as: "with",
- foreignKey: "with_id"
-});
-
-Request.belongsTo(User, {
- as: "requester",
- foreignKey: "requester_id"
-});
-
-Request.belongsTo(User, {
- as: "recipient",
- foreignKey: "recipient_id"
-});
-
-Request.belongsTo(Invoice, {
- as: "invoice",
- foreignKey: "invoice_id"
-});
-
-Invoice.hasOne(Request, {
- as: "request",
- foreignKey: "invoice_id"
-});
-
-db.Order = Order;
-
-export default db;
diff --git a/db/init/prodschema.sql b/db/init/prodschema.sql
deleted file mode 100644
index 38e25324..00000000
--- a/db/init/prodschema.sql
+++ /dev/null
@@ -1,312 +0,0 @@
--- MySQL dump 10.14 Distrib 5.5.68-MariaDB, for Linux (x86_64)
---
--- Host: localhost Database: coinos
--- ------------------------------------------------------
--- Server version 5.5.68-MariaDB
-
-/*!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 */;
-/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
-/*!40103 SET TIME_ZONE='+00:00' */;
-/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-
---
--- Table structure for table `SequelizeMeta`
---
-
-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,
- PRIMARY KEY (`name`),
- UNIQUE KEY `name` (`name`),
- UNIQUE KEY `SequelizeMeta_name_unique` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `accounts`
---
-
-DROP TABLE IF EXISTS `accounts`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `accounts` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `user_id` int(11) DEFAULT NULL,
- `asset` varchar(255) DEFAULT NULL,
- `createdAt` datetime NOT NULL,
- `updatedAt` datetime NOT NULL,
- `balance` double DEFAULT NULL,
- `pending` double DEFAULT NULL,
- `name` varchar(255) DEFAULT NULL,
- `ticker` varchar(255) DEFAULT NULL,
- `precision` int(11) DEFAULT NULL,
- `domain` varchar(255) DEFAULT NULL,
- `contract` text,
- `index` int(11) NOT NULL DEFAULT '0',
- `pubkey` varchar(255) DEFAULT NULL,
- `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=20553 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `cheaters`
---
-
-DROP TABLE IF EXISTS `cheaters`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `cheaters` (
- `id` int(11) NOT NULL DEFAULT '0',
- `username` varchar(255) DEFAULT NULL,
- `sum` double DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `codes`
---
-
-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,
- PRIMARY KEY (`code`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `deposits`
---
-
-DROP TABLE IF EXISTS `deposits`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `deposits` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `user_id` int(11) DEFAULT NULL,
- `createdAt` datetime NOT NULL,
- `updatedAt` datetime NOT NULL,
- `amount` double DEFAULT NULL,
- `credited` tinyint(1) DEFAULT NULL,
- `code` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=4554 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `invoices`
---
-
-DROP TABLE IF EXISTS `invoices`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `invoices` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `user_id` int(11) DEFAULT NULL,
- `text` text,
- `createdAt` datetime NOT NULL,
- `updatedAt` datetime NOT NULL,
- `rate` double DEFAULT NULL,
- `currency` varchar(255) NOT NULL,
- `address` varchar(255) DEFAULT NULL,
- `received` double DEFAULT NULL,
- `amount` double DEFAULT NULL,
- `tip` double DEFAULT NULL,
- `network` varchar(255) DEFAULT NULL,
- `unconfidential` varchar(255) DEFAULT NULL,
- `uuid` varchar(255) DEFAULT NULL,
- `memo` text,
- `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=36355 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `linkingkeys`
---
-
-DROP TABLE IF EXISTS `linkingkeys`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `linkingkeys` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `user_id` int(11) DEFAULT NULL,
- `hex` varchar(255) DEFAULT NULL,
- `createdAt` datetime NOT NULL,
- `updatedAt` datetime NOT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=11822 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `naughty`
---
-
-DROP TABLE IF EXISTS `naughty`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `naughty` (
- `id` int(11) NOT NULL DEFAULT '0',
- `username` varchar(255) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `orders`
---
-
-DROP TABLE IF EXISTS `orders`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!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',
- `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=389 DEFAULT CHARSET=utf8mb4;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `payments`
---
-
-DROP TABLE IF EXISTS `payments`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `payments` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `user_id` int(11) DEFAULT NULL,
- `hash` text,
- `createdAt` datetime NOT NULL,
- `updatedAt` datetime NOT NULL,
- `rate` double DEFAULT NULL,
- `currency` varchar(255) DEFAULT NULL,
- `address` varchar(255) DEFAULT NULL,
- `received` tinyint(1) DEFAULT NULL,
- `amount` double DEFAULT NULL,
- `tip` double NOT NULL DEFAULT '0',
- `confirmed` tinyint(1) NOT NULL,
- `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',
- `redeemcode` varchar(255) DEFAULT NULL,
- `path` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `idx_redeemcode` (`redeemcode`)
-) ENGINE=InnoDB AUTO_INCREMENT=25828 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `reset`
---
-
-DROP TABLE IF EXISTS `reset`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `reset` (
- `password` varchar(255) DEFAULT NULL,
- `seed` varchar(255) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `users`
---
-
-DROP TABLE IF EXISTS `users`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-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,
- `currency` varchar(255) DEFAULT NULL,
- `createdAt` datetime NOT NULL,
- `updatedAt` datetime NOT NULL,
- `twofa` tinyint(1) DEFAULT NULL,
- `pin` varchar(255) DEFAULT NULL,
- `currencies` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin,
- `otpsecret` varchar(255) DEFAULT NULL,
- `account_id` int(11) DEFAULT NULL,
- `ip` int(10) unsigned DEFAULT NULL,
- `subscriptions` text,
- `seed` varchar(255) 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',
- PRIMARY KEY (`id`),
- KEY `ip` (`ip`),
- KEY `username` (`username`)
-) ENGINE=InnoDB AUTO_INCREMENT=14579 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `withdrawals`
---
-
-DROP TABLE IF EXISTS `withdrawals`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `withdrawals` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `user_id` int(11) NOT NULL,
- `createdAt` datetime NOT NULL,
- `updatedAt` datetime NOT NULL,
- `amount` double DEFAULT NULL,
- `completed` tinyint(1) DEFAULT NULL,
- `transit` varchar(255) DEFAULT NULL,
- `account` varchar(255) DEFAULT NULL,
- `institution` varchar(255) DEFAULT NULL,
- `notes` text,
- `email` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=4118 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
-
-/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
-/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
-/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
-/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
-/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
-/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-
--- Dump completed on 2021-07-15 1:26:35
diff --git a/db/migrations/20210612181508_init_referrals.js b/db/migrations/20210612181508_init_referrals.js
deleted file mode 100644
index 63b20ce4..00000000
--- a/db/migrations/20210612181508_init_referrals.js
+++ /dev/null
@@ -1,24 +0,0 @@
-export const up = function(knex) {
- return Promise.all([
- knex.schema.dropTableIfExists('referrals'),
-
- knex.schema.createTable('referrals', function(t) {
- t.increments('id').unsigned().primary();
- t.integer('user_id').nullable();
- t.foreign('user_id').references('users.id');
-
- t.integer('sponsor_id').notNull();
- t.foreign('sponsor_id').references('users.id');
-
- t.string('token').notNull();
- t.string('expiry').nullable();
- t.enum('status', ['available', 'used', 'expired', 'cancelled']).notNull().defaultTo('available');
-
- t.timestamps(true, true);
- })
- ])
-};
-
-export const down = function(knex) {
- return knex.schema.dropTable('referrals');
-};
diff --git a/db/migrations/20210612192804_init_waiting_list.js.js b/db/migrations/20210612192804_init_waiting_list.js.js
deleted file mode 100644
index 0cef7356..00000000
--- a/db/migrations/20210612192804_init_waiting_list.js.js
+++ /dev/null
@@ -1,24 +0,0 @@
-export const up = function(knex) {
-
- return Promise.all([
- knex.schema.dropTableIfExists('waiting_list'),
-
- knex.schema.createTable('waiting_list', function(t) {
- t.increments('id').unsigned().primary();
-
- t.string('email').notNull();
- t.string('phone').notNull();
- t.enu('status', ['pending', 'activated', 'expired', 'cancelled']).notNull();
-
- t.integer('user_id').nullable();
- t.foreign('user_id').references('users.id');
- t.text('notes').nullable();
-
- t.timestamps(true, true);
- })
- ])
-};
-
-export const down = function(knex) {
- return knex.schema.dropTable('waiting_list');
-};
diff --git a/db/migrations/20210612203333_schema_diff_merges.js b/db/migrations/20210612203333_schema_diff_merges.js
deleted file mode 100644
index 418105d2..00000000
--- a/db/migrations/20210612203333_schema_diff_merges.js
+++ /dev/null
@@ -1,39 +0,0 @@
-export const up = function(knex) {
- return Promise.all([
- knex.schema.dropTableIfExists('reset'),
- knex.schema.dropTableIfExists('naughty'),
- knex.schema.dropTableIfExists('cheaters'),
-
- knex.raw("UPDATE accounts set createdAt = '2020-01-01' where createdAt < '2020-01-01'"),
- knex.raw("UPDATE accounts set updatedAt = '2020-01-01' where updatedAt < '2020-01-01'"),
- knex.raw("ALTER TABLE accounts modify `contract` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL"),
-
- knex.schema.alterTable('orders', function(t) {
- t.dropColumn('a1');
- t.dropColumn('a2');
- }),
-
- knex.schema.alterTable("users", function(t) {
- t.string('authyId').nullable();
- t.dropColumn('symbol');
- }),
-
- knex.raw("ALTER TABLE users MODIFY `subscriptions` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL"),
-
- ])
-};
-
-export const down = async function(knex) {
- return Promise.all([
- knex.schema.table("orders", function(t) {
- t.integer("a1");
- t.integer("a2")
- }),
-
- knex.schema.table("users", function(t) {
- t.string("symbol");
- t.dropColumn("unit");
- t.dropColumn("authyId");
- }),
- ])
-}; \ No newline at end of file
diff --git a/db/migrations/20210625232223_add_invoice_id_to_payments.js b/db/migrations/20210625232223_add_invoice_id_to_payments.js
deleted file mode 100644
index adf99d24..00000000
--- a/db/migrations/20210625232223_add_invoice_id_to_payments.js
+++ /dev/null
@@ -1,13 +0,0 @@
-export const up = async function (knex) {
- return knex.schema.table("payments", function(table) {
- table.integer("invoice_id");
- table.foreign("invoice_id").references("invoices.id");
- })
-};
-
-export const down = async function (knex) {
- return knex.schema.table("payments", function(table) {
- table.dropForeign("invoice_id");
- table.dropColumn("invoice_id");
- })
-};
diff --git a/db/migrations/20210628221727_add_webhook_to_invoices.js b/db/migrations/20210628221727_add_webhook_to_invoices.js
deleted file mode 100644
index 434819e5..00000000
--- a/db/migrations/20210628221727_add_webhook_to_invoices.js
+++ /dev/null
@@ -1,11 +0,0 @@
-export const up = async function(knex) {
- return knex.schema.table("invoices", function(table) {
- table.text("webhook");
- });
-};
-
-export const down = async function(knex) {
- return knex.schema.table("invoices", function(table) {
- table.dropColumn("webhook");
- });
-};
diff --git a/db/migrations/20210713174217_add_admin_to_users.js b/db/migrations/20210713174217_add_admin_to_users.js
deleted file mode 100644
index 879c8cb7..00000000
--- a/db/migrations/20210713174217_add_admin_to_users.js
+++ /dev/null
@@ -1,16 +0,0 @@
-export const up = async function(knex) {
- return knex.schema.table("users", function(t) {
- t.boolean("admin");
- t.string('email');
- t.string('phone');
-
- });
-};
-
-export const down = async function(knex) {
- return knex.schema.table("users", function(t) {
- t.dropColumn("admin");
- t.dropColumn('email')
- t.dropColumn('phone')
- });
-};
diff --git a/db/migrations/20210714123455_data_fixes_merge.js b/db/migrations/20210714123455_data_fixes_merge.js
deleted file mode 100644
index dfe96509..00000000
--- a/db/migrations/20210714123455_data_fixes_merge.js
+++ /dev/null
@@ -1,22 +0,0 @@
-export const up = function(knex) {
- return Promise.all([
- knex.raw("delete from invoices where invoices.account_id not in (select id from accounts)"),
- knex.raw("delete from orders where orders.a1_id not in (select id from accounts) or orders.a2_id not in (select id from accounts)"),
- knex.raw("update users set account_id = 10427 where id = 6262 and account_id = 10428"),
- knex.raw("delete from payments where account_id not in (select id from accounts)"),
- knex.raw("alter table orders drop rate"),
- knex.raw("alter table orders add rate double"),
- knex.raw("update orders set rate = v1/v2"),
-
- knex.raw('update accounts left join users on accounts.user_id = users.id set user_id = null where length(username) > 32'),
- knex.raw('update accounts left join users on accounts.user_id = users.id set user_id = null where users.id is null'),
- knex.raw('delete from accounts where user_id is null'),
- knex.raw('delete from users where length(username) > 32')
- ])
-};
-
-export const down = function(knex) {
- return Promise.all([
-
- ])
-};
diff --git a/db/migrations/20210714123456_add_fks_merge.js b/db/migrations/20210714123456_add_fks_merge.js
deleted file mode 100644
index 3d5f3e94..00000000
--- a/db/migrations/20210714123456_add_fks_merge.js
+++ /dev/null
@@ -1,45 +0,0 @@
-export const up = function(knex) {
- return Promise.all([
-
- // alter table invoices add foreign key (user_id) references users (id);
- // alter table invoices add foreign key (account_id) references accounts (id);
- knex.schema.alterTable("invoices", function(t) {
- t.foreign('user_id').references('users.id')
- t.foreign('account_id').references('accounts.id')
- t.index('updatedAt')
- }),
-
- // alter table payments add foreign key (user_id) references users (id);
- // alter table payments add foreign key (account_id) references accounts (id);
- knex.schema.alterTable("payments", function(t) {
- t.foreign('user_id').references('users.id')
- t.foreign('account_id').references('accounts.id')
- t.index('updatedAt')
- }),
-
- // alter table orders add foreign key (user_id) references users (id);
- // alter table orders add foreign key (a1_id) references accounts (id);
- // alter table orders add foreign key (a2_id) references accounts (id);
- knex.schema.alterTable("orders", function(t) {
- t.foreign('user_id').references('users.id')
- t.foreign('a1_id').references('accounts.id')
- t.foreign('a2_id').references('accounts.id')
- t.index('updatedAt')
- }),
-
- // alter table deposits add foreign key (user_id) references users (id)
- knex.schema.alterTable("deposits", function(t) {
- t.foreign('user_id').references('users.id')
- t.index('updatedAt')
- }),
-
- // alter table withdrawals add foreign key (user_id) references users (id)
- knex.schema.alterTable("withdrawals", function(t) {
- t.foreign('user_id').references('users.id')
- t.index('updatedAt')
- }),
- ])
-};
-
-export const down = function(knex) {
-};
diff --git a/db/migrations/s2/user_adjustments.js b/db/migrations/s2/user_adjustments.js
deleted file mode 100644
index cbe17977..00000000
--- a/db/migrations/s2/user_adjustments.js
+++ /dev/null
@@ -1,67 +0,0 @@
-
-export const up = function(knex) {
- return Promise.all([
-
- // move security fields to separate t (potentially different access permissions)
-
- knex.schema.createTable('user_security', function (t) {
- t.increments('id').unsigned().primary();
- t.int('user_id').notNull();
- t.foreign('user_id').references('users.user_id');
-
- t.boolean('twofa').notNull().defaultTo(false);
- t.string('pin').notNull();
- t.string('otp_secret').nullable();
- t.string('seed').nullable();
- }),
-
- knex.raw("INSERT INTO user_security (user_id, twofa, pin, otp_secret, seed) SELECT users.id, twofa, pin, otpsecret, seed FROM users"),
-
- // move user-customizeable fields to separate t (potentially different access permissions)
-
- knex.schema.createTable('user_preferences', function (t) {
- t.increments('id').unsigned().primary();
- t.int('user_id').notNull();
- t.foreign('user_id').references('users.user_id');
-
- t.enum('default_unit', ['SAT', 'BTC', 'CAD']).notNull().defaultTo('SAT');
- t.enum('default_currency', ['CAD', 'USD']).notNull().defaultTo('CAD');
- t.enum('default_fiat', ['CAD', 'USD']).notNull().defaultTo('CAD');
- t.set('show_currencies', ['CAD', 'USD']).notNull().defaultTo('CAD');
- }),
-
- knex.raw("INSERT INTO user_preferences (user_id, default_unit, default_currency, default_fiat, show_currencies) SELECT users.id, unit, currency, fiat, currencies FROM users"),
-
- // remove deprecated fields
-
- knex.schema.table('users', function (t) {
- t.string('uuid');
- t.enum('access', ['Anonymous', 'Member', 'Admin']).defaultTo('Anonymous');
-
- t.dropColumn('account_id');
- t.dropColumn('unit');
- t.dropColumn('fiat');
- t.dropColumn('currency');
- t.dropColumn('currencies');
- })
- ])
-
-};
-
-export const down = function(knex) {
- return Promise.all([
- knex.schema.table('users', function (t) {
- t.dropColumn('uuid');
- t.dropColumn('access');
-
- t.int('account_id');
- t.string('unit');
- t.string('fiat');
- t.string('currency');
- t.string('currencies');
- }),
-
- knex.schema.dropTable('user_preferences'),
- knex.schema.dropTable('user_security'),
- ]);
-};
diff --git a/db/models/accounts.js b/db/models/accounts.js
deleted file mode 100644
index 9485bc99..00000000
--- a/db/models/accounts.js
+++ /dev/null
@@ -1,217 +0,0 @@
-import db from "$db/db";
-import { DataTypes } from '@sequelize/core';
-
-const attributes = {
- id: {
- type: DataTypes.INTEGER(11),
- allowNull: false,
- defaultValue: null,
- primaryKey: true,
- autoIncrement: true,
- comment: null,
- field: "id"
- },
- user_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "user_id"
- },
- createdAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "createdAt"
- },
- updatedAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "updatedAt"
- },
- path: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "path"
- },
- seed: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "seed"
- },
- network: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "network"
- },
- name: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "name"
- },
- contract: {
- type: DataTypes.TEXT,
- get: function() {
- return JSON.parse(this.getDataValue("contract"));
- },
- set: function(value) {
- return this.setDataValue("contract", JSON.stringify(value));
- },
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "contract"
- },
- domain: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "domain"
- },
- ticker: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "ticker"
- },
- asset: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "asset"
- },
- balance: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "balance"
- },
- btc_credits: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: 0.0,
- primaryKey: false,
- autoIncrement: false,
- comment: "Credits that can be used towards paying Bitcoin withdrawal fees",
- field: "btc_credits"
- },
- liquid_credits: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: 0.0,
- primaryKey: false,
- autoIncrement: false,
- comment: "Credits that can be used towards paying Liquid withdrawal fees",
- field: "liquid_credits"
- },
- lightning_credits: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: 0.0,
- primaryKey: false,
- autoIncrement: false,
- comment: "Credits that can be used towards paying Lightning withdrawal fees",
- field: "lightning_credits"
- },
- pending: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "pending"
- },
- hide: {
- type: DataTypes.BOOLEAN,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "hide"
- },
- index: {
- type: DataTypes.INTEGER(11),
- allowNull: false,
- defaultValue: 0,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "index"
- },
- privkey: {
- type: DataTypes.STRING,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "privkey"
- },
- pubkey: {
- type: DataTypes.STRING,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "pubkey"
- },
- precision: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "precision"
- },
-};
-
-const options = {
- tableName: "accounts",
- comment: "",
- indexes: []
-};
-
-db["Account"] = db.define("accounts_model", attributes, options);
diff --git a/db/models/codes.js b/db/models/codes.js
deleted file mode 100644
index 0981ac5e..00000000
--- a/db/models/codes.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import db from "$db/db";
-import { DataTypes } from '@sequelize/core';
-
-const attributes = {
- code: {
- type: DataTypes.STRING(255),
- allowNull: false,
- defaultValue: null,
- primaryKey: true,
- autoIncrement: false,
- comment: null,
- field: "code"
- },
- text: {
- type: DataTypes.TEXT,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "text"
- },
-};
-
-const options = {
- tableName: "codes",
- comment: "",
- indexes: [],
- timestamps: false
-};
-
-db["Code"] = db.define("codes_model", attributes, options);
diff --git a/db/models/deposits.js b/db/models/deposits.js
deleted file mode 100644
index c486f468..00000000
--- a/db/models/deposits.js
+++ /dev/null
@@ -1,76 +0,0 @@
-import db from "$db/db";
-import { DataTypes } from '@sequelize/core';
-
-const attributes = {
- id: {
- type: DataTypes.INTEGER(11),
- allowNull: false,
- defaultValue: null,
- primaryKey: true,
- autoIncrement: true,
- comment: null,
- field: "id"
- },
- amount: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "amount"
- },
- user_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "user_id"
- },
- createdAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "createdAt"
- },
- updatedAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "updatedAt"
- },
- credited: {
- type: DataTypes.BOOLEAN,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "credited"
- },
- code: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "code"
- },
-};
-
-const options = {
- tableName: "deposits",
- comment: "",
- indexes: []
-};
-
-db["Deposit"] = db.define("deposits_model", attributes, options);
diff --git a/db/models/invoices.js b/db/models/invoices.js
deleted file mode 100644
index 82e64427..00000000
--- a/db/models/invoices.js
+++ /dev/null
@@ -1,202 +0,0 @@
-import db from "$db/db";
-import { DataTypes } from '@sequelize/core';
-
-const attributes = {
- id: {
- type: DataTypes.INTEGER(11),
- allowNull: false,
- defaultValue: null,
- primaryKey: true,
- autoIncrement: true,
- comment: null,
- field: "id"
- },
- account_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "account_id"
- },
- user_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "user_id"
- },
- text: {
- type: DataTypes.TEXT,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "text"
- },
- createdAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "createdAt"
- },
- updatedAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "updatedAt"
- },
- path: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "path"
- },
- rate: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "rate"
- },
- uuid: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: DataTypes.UUIDV4,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "uuid"
- },
- memo: {
- type: DataTypes.TEXT,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "memo"
- },
- network: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "network"
- },
- currency: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "currency"
- },
- unconfidential: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "unconfidential"
- },
- address: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "address"
- },
- received: {
- type: DataTypes.DOUBLE,
- allowNull: false,
- defaultValue: 0,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "received"
- },
- amount: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "amount"
- },
- pending: {
- type: DataTypes.DOUBLE,
- allowNull: false,
- defaultValue: 0,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "pending"
- },
- webhook: {
- type: DataTypes.TEXT,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "webhook"
- },
- status: {
- type: DataTypes.TEXT,
- allowNull: true,
- defaultValue: "unpaid",
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "status"
- },
- tip: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "tip"
- },
- prompt: {
- type: DataTypes.BOOLEAN,
- allowNull: false,
- defaultValue: false,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "prompt"
- },
-};
-
-const options = {
- tableName: "invoices",
- comment: "",
- indexes: []
-};
-
-db["Invoice"] = db.define("invoices_model", attributes, options);
diff --git a/db/models/keys.js b/db/models/keys.js
deleted file mode 100644
index 5a5fda0c..00000000
--- a/db/models/keys.js
+++ /dev/null
@@ -1,40 +0,0 @@
-import db from "$db/db";
-import { DataTypes } from '@sequelize/core';
-
-const attributes = {
- id: {
- type: DataTypes.INTEGER(11),
- allowNull: false,
- defaultValue: null,
- primaryKey: true,
- autoIncrement: true,
- comment: null,
- field: "id"
- },
- user_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "user_id"
- },
- hex: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "hex"
- },
-};
-
-const options = {
- tableName: "linkingkeys",
- comment: "",
- indexes: []
-};
-
-db["Key"] = db.define("keys_model", attributes, options);
diff --git a/db/models/orders.js b/db/models/orders.js
deleted file mode 100644
index 50a74c40..00000000
--- a/db/models/orders.js
+++ /dev/null
@@ -1,112 +0,0 @@
-import db from "$db/db";
-import { DataTypes } from '@sequelize/core';
-
-const attributes = {
- id: {
- type: DataTypes.INTEGER(11),
- allowNull: false,
- defaultValue: null,
- primaryKey: true,
- autoIncrement: true,
- comment: null,
- field: "id"
- },
- a1_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "a1_id"
- },
- a2_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "a2_id"
- },
- user_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "user_id"
- },
- completedAt: {
- type: DataTypes.DATE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "completedAt"
- },
- createdAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "createdAt"
- },
- updatedAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "updatedAt"
- },
- v1: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "v1"
- },
- v2: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "v2"
- },
- rate: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "rate"
- },
- accepted: {
- type: DataTypes.BOOLEAN,
- allowNull: false,
- defaultValue: false,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "accepted"
- },
-};
-
-const options = {
- tableName: "orders",
- comment: "",
- indexes: []
-};
-
-db.Order = db.define("orders_model", attributes, options);
diff --git a/db/models/payments.js b/db/models/payments.js
deleted file mode 100644
index fac8ff56..00000000
--- a/db/models/payments.js
+++ /dev/null
@@ -1,220 +0,0 @@
-import db from "$db/db";
-import { DataTypes } from '@sequelize/core';
-
-const attributes = {
- id: {
- type: DataTypes.INTEGER(11),
- allowNull: false,
- defaultValue: null,
- primaryKey: true,
- autoIncrement: true,
- comment: null,
- field: "id"
- },
- with_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "with_id"
- },
- account_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "account_id"
- },
- invoice_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "invoice_id"
- },
- user_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "user_id"
- },
- path: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "path"
- },
- memo: {
- type: DataTypes.TEXT,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "memo"
- },
- hash: {
- type: DataTypes.TEXT,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "hash"
- },
- createdAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "createdAt"
- },
- updatedAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "updatedAt"
- },
- rate: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "rate"
- },
- preimage: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "preimage"
- },
- network: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "network"
- },
- currency: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "currency"
- },
- address: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "address"
- },
- received: {
- type: DataTypes.INTEGER(1),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "received"
- },
- amount: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "amount"
- },
- fee: {
- type: DataTypes.DOUBLE,
- allowNull: false,
- defaultValue: 0,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "fee"
- },
- tip: {
- type: DataTypes.DOUBLE,
- allowNull: false,
- defaultValue: 0,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "tip"
- },
- redeemed: {
- type: DataTypes.BOOLEAN,
- allowNull: false,
- defaultValue: false,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "redeemed"
- },
- redeemcode: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "redeemcode"
- },
- confirmed: {
- type: DataTypes.INTEGER(1),
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "confirmed"
- },
- fee_payment_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "fee_payment_id"
- }
-};
-
-const options = {
- tableName: "payments",
- comment: "",
- indexes: []
-};
-
-db["Payment"] = db.define("payments_model", attributes, options);
diff --git a/db/models/referrals.js b/db/models/referrals.js
deleted file mode 100644
index 8aebde2e..00000000
--- a/db/models/referrals.js
+++ /dev/null
@@ -1,90 +0,0 @@
-import db from "$db/db";
-import { DataTypes } from '@sequelize/core';
-
-const attributes = {
- id: {
- type: DataTypes.INTEGER(11),
- allowNull: false,
- defaultValue: null,
- primaryKey: true,
- autoIncrement: true,
- comment: null,
- field: "id"
- },
- user_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "user_id"
- },
- sponsor_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "sponsor_id"
- },
-
- token: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "token"
- },
- expiry: {
- type: DataTypes.DATE(),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "token"
- },
- status: {
- type: DataTypes.ENUM,
- values: ['available', 'used', 'expired', 'cancelled'],
- allowNull: true,
- defaultValue: 'available',
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "token"
- }
-};
-
-const options = {
- tableName: "referrals",
- comment: "",
- indexes: []
-};
-
-db["Referral"] = db.define("referrals_model", attributes, options);
-
-// exports.up = function(knex) {
-// return knex.schema.createTable('referrals', function(t) {
-// t.increments('id').unsigned().primary();
-// t.int('user_id').nullable();
-// t.foreign('user_id').references('users.id');
-
-// t.int('sponsor_id').notNull();
-// t.foreign('sponsor_id').references('users.id');
-
-// t.string('token').notNull();
-// t.string('expiry').nullable();
-// t.enum('status', ['available', 'used', 'expired', 'cancelled']).notNull().defaultTo('available');
-
-// t.timestamps();
-// })
-// };
-
-// exports.down = function(knex) {
-// return knex.schema.dropTable('referrals');
-// };
diff --git a/db/models/requests.js b/db/models/requests.js
deleted file mode 100644
index 76703a72..00000000
--- a/db/models/requests.js
+++ /dev/null
@@ -1,67 +0,0 @@
-import db from "$db/db";
-import { DataTypes } from '@sequelize/core';
-
-const attributes = {
- id: {
- type: DataTypes.INTEGER(11),
- allowNull: false,
- defaultValue: null,
- primaryKey: true,
- autoIncrement: true,
- comment: null,
- field: "id"
- },
- requester_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "requester_id"
- },
- recipient_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "recipient_id"
- },
- memo: {
- type: DataTypes.TEXT,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "memo"
- },
- createdAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "createdAt"
- },
- updatedAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "updatedAt"
- },
-};
-
-const options = {
- tableName: "requests",
- comment: "",
- indexes: []
-};
-
-db["Request"] = db.define("requests_model", attributes, options);
diff --git a/db/models/users.js b/db/models/users.js
deleted file mode 100644
index fce79537..00000000
--- a/db/models/users.js
+++ /dev/null
@@ -1,270 +0,0 @@
-import db from "$db/db";
-import { DataTypes } from "@sequelize/core";
-
-const attributes = {
- id: {
- type: DataTypes.INTEGER(11),
- allowNull: false,
- defaultValue: null,
- primaryKey: true,
- autoIncrement: true,
- comment: null,
- field: "id"
- },
- uuid: {
- type: DataTypes.STRING,
- allowNull: false,
- defaultValue: DataTypes.UUIDV4,
- primaryKey: true,
- autoIncrement: false,
- comment: null,
- field: "uuid"
- },
- address: {
- type: DataTypes.STRING,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "address"
- },
- theme: {
- type: DataTypes.STRING,
- allowNull: true,
- defaultValue: false,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "theme"
- },
- profile: {
- type: DataTypes.BOOLEAN,
- allowNull: true,
- defaultValue: false,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "profile"
- },
- banner: {
- type: DataTypes.BOOLEAN,
- allowNull: true,
- defaultValue: false,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "banner"
- },
- admin: {
- type: DataTypes.BOOLEAN,
- allowNull: true,
- defaultValue: false,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "admin"
- },
- locked: {
- type: DataTypes.BOOLEAN,
- allowNull: true,
- defaultValue: false,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "locked"
- },
- verified: {
- type: DataTypes.STRING,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "verified"
- },
- fiat: {
- type: DataTypes.BOOLEAN,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "fiat"
- },
- index: {
- type: DataTypes.INTEGER,
- allowNull: true,
- defaultValue: 0,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "index"
- },
- ip: {
- type: DataTypes.INTEGER.UNSIGNED,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "ip"
- },
- seed: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "seed"
- },
- username: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "username"
- },
- password: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "password"
- },
- unit: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: "SAT",
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "unit"
- },
- account_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "account_id"
- },
- otpsecret: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: "CAD",
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "otpsecret"
- },
- currency: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: "CAD",
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "currency"
- },
- currencies: {
- type: DataTypes.JSON,
- allowNull: false,
- defaultValue: ["USD"],
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "currencies"
- },
- createdAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "createdAt"
- },
- updatedAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "updatedAt"
- },
- subscriptions: {
- type: DataTypes.TEXT,
- get: function() {
- return JSON.parse(this.getDataValue("subscriptions"));
- },
- set: function(value) {
- return this.setDataValue("subscriptions", JSON.stringify(value));
- },
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "subscriptions"
- },
- twofa: {
- type: DataTypes.INTEGER(1),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "twofa"
- },
- cipher: {
- type: DataTypes.STRING(255)
- },
- pubkey: {
- type: DataTypes.STRING(255)
- },
- salt: {
- type: DataTypes.STRING(255)
- },
- pin: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "pin"
- },
- email: {
- type: DataTypes.STRING(255)
- },
- phone: {
- type: DataTypes.STRING(255)
- },
- locktime: {
- type: DataTypes.INTEGER(11)
- },
- prompt: {
- type: DataTypes.BOOLEAN
- },
- display: {
- type: DataTypes.STRING(255)
- }
-};
-
-const options = {
- tableName: "users",
- comment: "",
- indexes: [],
- charset: "utf8mb4",
- collate: "utf8mb4_unicode_ci"
-};
-
-db["User"] = db.define("users_model", attributes, options);
diff --git a/db/models/waiting_list.js b/db/models/waiting_list.js
deleted file mode 100644
index 37f2889b..00000000
--- a/db/models/waiting_list.js
+++ /dev/null
@@ -1,45 +0,0 @@
-import db from "$db/db";
-import { DataTypes } from '@sequelize/core';
-
-const attributes = {
- id: {
- type: DataTypes.INTEGER(11),
- primaryKey: true,
- autoIncrement: true,
- allowNull: false
- },
- email: {
- type: DataTypes.STRING(255),
- validate: {
- isEmail: true
- }
- },
- phone: {
- type: DataTypes.STRING(255),
- validate: {
- is: /^[0-9]+$/ // replace spaces, brackets, dashes dynamically prior to create
- }
- },
- status: {
- type: DataTypes.ENUM,
- values: ['pending', 'activated', 'expired', 'cancelled'],
- defaultValue: 'pending',
- allowNull: false
- }
-}
-
-const options = {
- tableName: "waiting_list",
- comment: "Users on waiting list",
- timestamps: true,
- createdAt: 'created_at',
- updatedAt: 'updated_at',
- indexes: [
- {
- unique: true,
- fields: ['email', 'phone']
- }
- ]
-};
-
-db["WaitingList"] = db.define("waiting_list_model", attributes, options);
diff --git a/db/models/withdrawals.js b/db/models/withdrawals.js
deleted file mode 100644
index fa2afb22..00000000
--- a/db/models/withdrawals.js
+++ /dev/null
@@ -1,103 +0,0 @@
-import db from "$db/db";
-import { DataTypes } from '@sequelize/core';
-
-const attributes = {
- id: {
- type: DataTypes.INTEGER(11),
- allowNull: false,
- defaultValue: null,
- primaryKey: true,
- autoIncrement: true,
- comment: null,
- field: "id"
- },
- amount: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "amount"
- },
- user_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "user_id"
- },
- createdAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "createdAt"
- },
- updatedAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "updatedAt"
- },
- transit: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "transit"
- },
- institution: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "institution"
- },
- account: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "account"
- },
- email: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "email"
- },
- notes: {
- type: DataTypes.TEXT,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "notes"
- },
-};
-
-const options = {
- tableName: "withdrawals",
- comment: "",
- indexes: []
-};
-
-db["Withdrawal"] = db.define("withdrawals_model", attributes, options);
diff --git a/db/normalized/README.md b/db/normalized/README.md
deleted file mode 100644
index fd3cb0d3..00000000
--- a/db/normalized/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# General guidelines for Database schema:
-
-- String fields whose values are NOT open-ended (ie can contain random strings) should be changed to either:
- - an FK to a separate lookup table (when the domain of options is large or can grow)
- - an enum (when there are a short list of essentailly static options)
-
-- Field names should follow SQL standards:
- - lower case
- - underscore_separated_words
-
-- options for designated models should be standardized with:
- {
- tableName: "table_name",
- comment: "description of table if not self-evident",
- timestamps: true,
- createdAt: 'created_at',
- updatedAt: 'updated_at',
- indexes: [
- { <as required> }
- ]
- };
-
- ## Note regarding field attributes specified in model:
-
- - createdAt, updatedAt are renamed to abide by SQL standard.
-
- - by default allowNull is false, so this attribute need only be specified when fields are NOT NULL.
-
- - comment attribute should added to any field that is not self-evident
-
- - may need to add indexes to more fields for rapid access
-
- ## Notes regarding changes / updates
-
- - Some 1-1 tables are split up simply to separate scope or to control access permission (ie only user_preferences table may be edited by users themselves)
-
- ## Sequelize Operational Questions:
- - Are indexes automatically generated by Sequelize migration for primary keys and/or foreign keys ?
- - Does Sequelize add non-unique indexes for data mining if specified: eg { fields: ['username'] }
- - Do timestamp fields require default value spec (eg Sequelize.NOW) ... or how can we define this in model ?
-
- ## Ongoing Questions:
- - payments table needs to be investigated and refactored
- - is invoices table required or is this just summary information ?
- - orders table needs to be investigated and refactored
- - need to add subscriptions table if applicable ( what is this comprised of ?)
- - user_keys table should be commented to clarify application of each of these values.
-
diff --git a/db/normalized/accounts.js b/db/normalized/accounts.js
deleted file mode 100644
index 8e5aad33..00000000
--- a/db/normalized/accounts.js
+++ /dev/null
@@ -1,231 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('accounts', function(t) {
- t.increments('id').unsigned().primary();
- t.int('user_id').notNull();
- t.foreign('user_id').references('users.id');
-
- t.int('uuid').notNull();
-
- t.double('balance');
- t.double('pending');
-
- t.enu('network', ['Bitcoin', 'Liquid', 'Lightning', 'CoinOS']).notNull();
-
- t.longtext('contract').collate('utf8mb4').nullable(); // custodial ?
-
- // knex.raw("ALTER TABLE accounts MODIFY `contract` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL")
-
- // t.string('hide');
- // t.string('index');
-
- t.int('liquid_asset_id').notNull();
- t.foreign('liquid_asset_id').references('liquid_assets.id');
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
- return knex.schema.dropTable('accounts');
-};
-
-// Change
-//
-// move assets fields (asset, ticker, name, precision...) to separate liquid_assets reference
-
-// separate network specific fields to bitcoin_accounts / liquid_accounts / coinos_accounts tables ? or just non_custodial ?
-// eg liquid -> liquid_asset info
-// non-custodial ? -> privkey, pubkey, path, seed ?
-// contract, hide, index ?
-//
-
-
-// const { DataTypes } = require('@sequelize/core');
-
-// const attributes = {
-// id: {
-// type: DataTypes.INTEGER(11),
-// allowNull: false,
-// defaultValue: null,
-// primaryKey: true,
-// autoIncrement: true,
-// comment: null,
-// field: "id"
-// },
-// user_id: {
-// type: DataTypes.INTEGER(11),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "user_id"
-// },
-// createdAt: {
-// type: DataTypes.DATE,
-// allowNull: false,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "createdAt"
-// },
-// updatedAt: {
-// type: DataTypes.DATE,
-// allowNull: false,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "updatedAt"
-// },
-// path: {
-// type: DataTypes.STRING(255),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "path"
-// },
-// seed: {
-// type: DataTypes.STRING(255),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "seed"
-// },
-// network: {
-// type: DataTypes.STRING(255),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "network"
-// },
-// name: {
-// type: DataTypes.STRING(255),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "name"
-// },
-// contract: {
-// type: DataTypes.TEXT,
-// get: function() {
-// return JSON.parse(this.getDataValue("contract"));
-// },
-// set: function(value) {
-// return this.setDataValue("contract", JSON.stringify(value));
-// },
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "contract"
-// },
-// domain: {
-// type: DataTypes.STRING(255),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "domain"
-// },
-// ticker: {
-// type: DataTypes.STRING(255),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "ticker"
-// },
-// asset: {
-// type: DataTypes.STRING(255),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "asset"
-// },
-// balance: {
-// type: DataTypes.DOUBLE,
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "balance"
-// },
-// pending: {
-// type: DataTypes.DOUBLE,
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "pending"
-// },
-// hide: {
-// type: DataTypes.BOOLEAN,
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "hide"
-// },
-// index: {
-// type: DataTypes.INTEGER(11),
-// allowNull: false,
-// defaultValue: 0,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "index"
-// },
-// privkey: {
-// type: DataTypes.STRING,
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "privkey"
-// },
-// pubkey: {
-// type: DataTypes.STRING,
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "pubkey"
-// },
-// precision: {
-// type: DataTypes.INTEGER(11),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "precision"
-// },
-// };
-
-// const options = {
-// tableName: "accounts",
-// comment: "",
-// indexes: []
-// };
-
-// db["Account"] = db.define("accounts_model", attributes, options);
diff --git a/db/normalized/bank_accounts.js b/db/normalized/bank_accounts.js
deleted file mode 100644
index 5d8ea0dc..00000000
--- a/db/normalized/bank_accounts.js
+++ /dev/null
@@ -1,24 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('bank_accounts', function(t) {
- t.increments('id').unsigned().primary();
- t.int('user_id').notNull();
- t.foreign('user_id').references('users.id');
-
- t.int('transit_number');
- t.int('institution_number');
- t.int('account_number');
-
- t.string('swift');
- t.string('iban');
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
- return knex.schema.dropTable('user_security');
-};
-
-// Changes:
-//
-// bank info -> bank_account records
diff --git a/db/normalized/credits.js b/db/normalized/credits.js
deleted file mode 100644
index 5511b616..00000000
--- a/db/normalized/credits.js
+++ /dev/null
@@ -1,236 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('credits', function(t) {
- t.increments('id').unsigned().primary();
-
- t.enu('type', ['deposit', 'order', 'transfer', 'invoice', 'exchange'])
- t.string('description')
-
- t.int('account_id').notNull();
- t.foreign('account_id').references('accounts.id');
-
- t.double('amount');
-
- t.enu('status', ['pending', 'completed', 'reversed', 'cancelled'])
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
-return knex.schema.dropTable('credits');
-};
-
-// Changes:
-//
-// Should these be tracked as transactions ?
-// SAT -> SAT
-// tracking various exchange variations (outside of external networks ?)
-//
-// Is user / account / amount info redundant ?
-// + transaction_type: deposit / withdrawal / transfer / exchange ?
-//
-// add transfers table ? (for internal transfers only ?)
-// add redemptions table ? (for bitcoin transfers only ?)
-// add exchanges table ? (for conversion from one currency to another)
-//
-// network -> scope: internal / bitcoin / liquid / lightning ?
-// add bitcoin_transaction ? (with redemption attributes)
-// add liquid_transaction ? ()
-// add lightning_transaction ? (with LN_invoice_hash)
-// add internal_transaction ? ()
-//
-// context for path, memo, rate, preimage, address, received, fee, tip, confirmed, redeemcode ?
-
-
-import { DataTypes } from '@sequelize/core';
-
-const attributes = {
- id: {
- type: DataTypes.INTEGER(11),
- allowNull: false,
- defaultValue: null,
- primaryKey: true,
- autoIncrement: true,
- comment: null,
- field: "id"
- },
- account_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "account_id"
- },
- user_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "user_id"
- },
- path: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "path"
- },
- memo: {
- type: DataTypes.TEXT,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "memo"
- },
- hash: {
- type: DataTypes.TEXT,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "hash"
- },
- createdAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "createdAt"
- },
- updatedAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "updatedAt"
- },
- rate: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "rate"
- },
- preimage: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "preimage"
- },
- network: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "network"
- },
- currency: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "currency"
- },
- address: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "address"
- },
- received: {
- type: DataTypes.INTEGER(1),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "received"
- },
- amount: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "amount"
- },
- fee: {
- type: DataTypes.DOUBLE,
- allowNull: false,
- defaultValue: 0,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "fee"
- },
- tip: {
- type: DataTypes.DOUBLE,
- allowNull: false,
- defaultValue: 0,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "tip"
- },
- redeemed: {
- type: DataTypes.BOOLEAN,
- allowNull: false,
- defaultValue: false,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "redeemed"
- },
- redeemcode: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "redeemcode"
- },
- confirmed: {
- type: DataTypes.INTEGER(1),
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "confirmed"
- }
-};
-
-const options = {
- tableName: "payments",
- comment: "",
- indexes: []
-};
-
-db["Payment"] = db.define("payments_model", attributes, options);
diff --git a/db/normalized/debits.js b/db/normalized/debits.js
deleted file mode 100644
index 6fcee974..00000000
--- a/db/normalized/debits.js
+++ /dev/null
@@ -1,236 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('debits', function(t) {
- t.increments('id').unsigned().primary();
-
- t.enu('type', ['withdrawal', 'order', 'transfer', 'invoice', 'exchange'])
-
- t.int('account_id').notNull();
- t.foreign('account_id').references('accounts.id');
-
- t.double('amount');
-
- t.enu('type', ['withdrawal', 'transfer', 'order', 'invoice'])
- t.enu('status', ['pending', 'completed', 'reversed', 'cancelled'])
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
-return knex.schema.dropTable('debits');
-};
-
-// Changes:
-//
-// Should these be tracked as transactions ?
-// SAT -> SAT
-// tracking various exchange variations (outside of external networks ?)
-//
-// Is user / account / amount info redundant ?
-// + transaction_type: deposit / withdrawal / transfer / exchange ?
-//
-// add transfers table ? (for internal transfers only ?)
-// add redemptions table ? (for bitcoin transfers only ?)
-// add exchanges table ? (for conversion from one currency to another)
-//
-// network -> scope: internal / bitcoin / liquid / lightning ?
-// add bitcoin_transaction ? (with redemption attributes)
-// add liquid_transaction ? ()
-// add lightning_transaction ? (with LN_invoice_hash)
-// add internal_transaction ? ()
-//
-// context for path, memo, rate, preimage, address, received, fee, tip, confirmed, redeemcode ?
-
-
-import { DataTypes } from '@sequelize/core';
-
-const attributes = {
- id: {
- type: DataTypes.INTEGER(11),
- allowNull: false,
- defaultValue: null,
- primaryKey: true,
- autoIncrement: true,
- comment: null,
- field: "id"
- },
- account_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "account_id"
- },
- user_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "user_id"
- },
- path: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "path"
- },
- memo: {
- type: DataTypes.TEXT,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "memo"
- },
- hash: {
- type: DataTypes.TEXT,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "hash"
- },
- createdAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "createdAt"
- },
- updatedAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "updatedAt"
- },
- rate: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "rate"
- },
- preimage: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "preimage"
- },
- network: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "network"
- },
- currency: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "currency"
- },
- address: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "address"
- },
- received: {
- type: DataTypes.INTEGER(1),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "received"
- },
- amount: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "amount"
- },
- fee: {
- type: DataTypes.DOUBLE,
- allowNull: false,
- defaultValue: 0,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "fee"
- },
- tip: {
- type: DataTypes.DOUBLE,
- allowNull: false,
- defaultValue: 0,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "tip"
- },
- redeemed: {
- type: DataTypes.BOOLEAN,
- allowNull: false,
- defaultValue: false,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "redeemed"
- },
- redeemcode: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "redeemcode"
- },
- confirmed: {
- type: DataTypes.INTEGER(1),
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "confirmed"
- }
-};
-
-const options = {
- tableName: "payments",
- comment: "",
- indexes: []
-};
-
-db["Payment"] = db.define("payments_model", attributes, options);
diff --git a/db/normalized/deposits.js b/db/normalized/deposits.js
deleted file mode 100644
index 17a7c500..00000000
--- a/db/normalized/deposits.js
+++ /dev/null
@@ -1,100 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('deposits', function(t) {
- t.increments('id').unsigned().primary();
-
- t.int('credit_id').notNull();
- t.foreign('credit_id').references('credits.id');
-
- t.string('confirmation_code');
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
- return knex.schema.dropTable('deposits');
-};
-
-// Changes:
-//
-// reference transaction
-// reference account rather than user
-// credited - redundant with confirmation_code ?
-// code -> confirmation_code
-
-
-// const { DataTypes } = require('@sequelize/core');
-
-// const attributes = {
-// id: {
-// type: DataTypes.INTEGER(11),
-// allowNull: false,
-// defaultValue: null,
-// primaryKey: true,
-// autoIncrement: true,
-// comment: null,
-// field: "id"
-// },
-// amount: {
-// type: DataTypes.DOUBLE,
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "amount"
-// },
-// user_id: {
-// type: DataTypes.INTEGER(11),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "user_id"
-// },
-// createdAt: {
-// type: DataTypes.DATE,
-// allowNull: false,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "createdAt"
-// },
-// updatedAt: {
-// type: DataTypes.DATE,
-// allowNull: false,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "updatedAt"
-// },
-// credited: {
-// type: DataTypes.BOOLEAN,
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "credited"
-// },
-// code: {
-// type: DataTypes.STRING(255),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "code"
-// },
-// };
-
-// const options = {
-// tableName: "deposits",
-// comment: "",
-// indexes: []
-// };
-
-// db["Deposit"] = db.define("deposits_model", attributes, options);
diff --git a/db/normalized/exchanges.js b/db/normalized/exchanges.js
deleted file mode 100644
index 2be91990..00000000
--- a/db/normalized/exchanges.js
+++ /dev/null
@@ -1,232 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('exchanges', function(t) {
- t.increments('id').unsigned().primary();
-
- t.int('transfer_id').notNull();
- t.foreign('transfer_id').references('transfers.id');
-
- t.double('exchange_rate').notNull()
- t.double('exchange_fee').notNull().defaultTo(0)
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
-return knex.schema.dropTable('exchanges');
-};
-
-// Changes:
-//
-// Should these be tracked as transactions ?
-// SAT -> SAT
-// tracking various exchange variations (outside of external networks ?)
-//
-// Is user / account / amount info redundant ?
-// + transaction_type: deposit / withdrawal / transfer / exchange ?
-//
-// add transfers table ? (for internal transfers only ?)
-// add redemptions table ? (for bitcoin transfers only ?)
-// add exchanges table ? (for conversion from one currency to another)
-//
-// network -> scope: internal / bitcoin / liquid / lightning ?
-// add bitcoin_transaction ? (with redemption attributes)
-// add liquid_transaction ? ()
-// add lightning_transaction ? (with LN_invoice_hash)
-// add internal_transaction ? ()
-//
-// context for path, memo, rate, preimage, address, received, fee, tip, confirmed, redeemcode ?
-
-
-import { DataTypes } from '@sequelize/core';
-
-const attributes = {
- id: {
- type: DataTypes.INTEGER(11),
- allowNull: false,
- defaultValue: null,
- primaryKey: true,
- autoIncrement: true,
- comment: null,
- field: "id"
- },
- account_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "account_id"
- },
- user_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "user_id"
- },
- path: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "path"
- },
- memo: {
- type: DataTypes.TEXT,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "memo"
- },
- hash: {
- type: DataTypes.TEXT,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "hash"
- },
- createdAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "createdAt"
- },
- updatedAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "updatedAt"
- },
- rate: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "rate"
- },
- preimage: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "preimage"
- },
- network: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "network"
- },
- currency: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "currency"
- },
- address: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "address"
- },
- received: {
- type: DataTypes.INTEGER(1),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "received"
- },
- amount: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "amount"
- },
- fee: {
- type: DataTypes.DOUBLE,
- allowNull: false,
- defaultValue: 0,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "fee"
- },
- tip: {
- type: DataTypes.DOUBLE,
- allowNull: false,
- defaultValue: 0,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "tip"
- },
- redeemed: {
- type: DataTypes.BOOLEAN,
- allowNull: false,
- defaultValue: false,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "redeemed"
- },
- redeemcode: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "redeemcode"
- },
- confirmed: {
- type: DataTypes.INTEGER(1),
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "confirmed"
- }
-};
-
-const options = {
- tableName: "payments",
- comment: "",
- indexes: []
-};
-
-db["Payment"] = db.define("payments_model", attributes, options);
diff --git a/db/normalized/invoices.js b/db/normalized/invoices.js
deleted file mode 100644
index 823ad11d..00000000
--- a/db/normalized/invoices.js
+++ /dev/null
@@ -1,206 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('invoices', function(t) {
- t.increments('id').unsigned().primary();
-
- t.int('transfer_id').notNull();
- t.foreign('transfer_id').references('transfers.id');
-
- t.enu('network', ['Bitcoin', 'Liquid', 'Lightning', 'CoinOS']).notNull();
-
- t.string('bolt11'); // was 'text'
-
- // Clarify ??? - break out ? - context ? include everything encoded in hash...
- t.double('amount');
-
- // Exchanges
- // ( are there a couple of types of invoices ? - eg checkout / voucher / receive ... with different attributes ?)
- t.double('rate')
- t.string('currency')
- t.double('tip')
-
- t.string('path')
- t.string('uuid')
- t.string('memo')
- t.string('unconfidential')
- t.string('address')
- t.string('received')
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
- return knex.schema.dropTable('invoices');
-};
-
-
-// Variations: ?
-// wallet -> receive - fields ?
-// checkout - fields ?
-// voucher - fields ?
-
-// const { DataTypes } = require('@sequelize/core');
-
-// const attributes = {
-// id: {
-// type: DataTypes.INTEGER(11),
-// allowNull: false,
-// defaultValue: null,
-// primaryKey: true,
-// autoIncrement: true,
-// comment: null,
-// field: "id"
-// },
-// account_id: {
-// type: DataTypes.INTEGER(11),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "account_id"
-// },
-// user_id: {
-// type: DataTypes.INTEGER(11),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "user_id"
-// },
-// text: {
-// type: DataTypes.TEXT,
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "text"
-// },
-// createdAt: {
-// type: DataTypes.DATE,
-// allowNull: false,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "createdAt"
-// },
-// updatedAt: {
-// type: DataTypes.DATE,
-// allowNull: false,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "updatedAt"
-// },
-// path: {
-// type: DataTypes.STRING(255),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "path"
-// },
-// rate: {
-// type: DataTypes.DOUBLE,
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "rate"
-// },
-// uuid: {
-// type: DataTypes.STRING(255),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "uuid"
-// },
-// memo: {
-// type: DataTypes.TEXT,
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "memo"
-// },
-// network: {
-// type: DataTypes.STRING(255),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "network"
-// },
-// currency: {
-// type: DataTypes.STRING(255),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "currency"
-// },
-// unconfidential: {
-// type: DataTypes.STRING(255),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "unconfidential"
-// },
-// address: {
-// type: DataTypes.STRING(255),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "address"
-// },
-// received: {
-// type: DataTypes.STRING(255),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "received"
-// },
-// amount: {
-// type: DataTypes.DOUBLE,
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "amount"
-// },
-// tip: {
-// type: DataTypes.DOUBLE,
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "tip"
-// },
-// };
-
-// const options = {
-// tableName: "invoices",
-// comment: "",
-// indexes: []
-// };
-
-// db["Invoice"] = db.define("invoices_model", attributes, options);
diff --git a/db/normalized/liquid_assets.js b/db/normalized/liquid_assets.js
deleted file mode 100644
index fab96dc5..00000000
--- a/db/normalized/liquid_assets.js
+++ /dev/null
@@ -1,21 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('liquid_assets', function(t) {
- t.increments('id').unsigned().primary();
-
- t.string('asset_id').notNull();
- t.string('name').notNull();
-
- t.string('domain')
- t.string('ticker').notNull();
- t.int('precision').defaultTo(8);
- t.string('issuer_pubkey')
-
- t.boolean('registered').defaultTo(false);
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
- return knex.schema.dropTable('liquid_assets');
-}; \ No newline at end of file
diff --git a/db/normalized/ln_keys.js b/db/normalized/ln_keys.js
deleted file mode 100644
index 7922e40e..00000000
--- a/db/normalized/ln_keys.js
+++ /dev/null
@@ -1,16 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('ln_keys', function(t) {
- t.increments('id').unsigned().primary();
-
- t.int('user_id').notNull();
- t.foreign('user_id').references('users.id');
-
- t.string('hex').notNull();
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
- return knex.schema.dropTable('ln_keys');
-}; \ No newline at end of file
diff --git a/db/normalized/lnurl_codes.js b/db/normalized/lnurl_codes.js
deleted file mode 100644
index 5ed81135..00000000
--- a/db/normalized/lnurl_codes.js
+++ /dev/null
@@ -1,14 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('lnurl_codes', function(t) {
- t.increments('id').unsigned().primary();
-
- t.string('code').notNull();
- t.text('text');
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
- return knex.schema.dropTable('lnurl_codes');
-};
diff --git a/db/normalized/non_custodial_accounts.js b/db/normalized/non_custodial_accounts.js
deleted file mode 100644
index e8190ce6..00000000
--- a/db/normalized/non_custodial_accounts.js
+++ /dev/null
@@ -1,91 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('non_custodial_accounts', function(t) {
- t.increments('id').unsigned().primary();
- t.int('account_id').notNull();
- t.foreign('account_id').references('accounts.id');
-
- // what is the scope / context of these attributes ?
- t.string('path');
- t.string('seed');
- // t.string('hide');
- // t.string('index');
- t.string('pub_key');
- t.string('priv_key');
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
- return knex.schema.dropTable('non_custodial_accounts');
-};
-
-// const { DataTypes } = require('@sequelize/core');
-
-// const attributes = {
-// id: {
-// type: DataTypes.INTEGER(11),
-// primaryKey: true,
-// autoIncrement: true,
-// allowNull: false
-// },
-// account_id: {
-// type: DataTypes.INTEGER(11),
-// references: { model: Account, key: 'id' },
-// allowNull: false,
-// comment: "Reference to account"
-// },
-// path: {
-// type: DataTypes.STRING(255),
-// comment: "What is this ?"
-// },
-// seed: {
-// type: DataTypes.STRING(255),
-// comment: "What is this ?"
-// },
-// network: {
-// type: DataTypes.INTEGER(11),
-// references: { model: Network, key: 'id' },
-// allowNull: false,
-// comment: "Reference to network"
-// },
-// domain: {
-// type: DataTypes.STRING(255),
-// comment: "What is this ? ... is it unique or an enum ?"
-// },
-// ticker: {
-// type: DataTypes.STRING(255),
-// comment: "What is this ?"
-// },
-// hide: {
-// type: DataTypes.STRING(255),
-// comment: "What is this ?"
-// },
-// index: {
-// type: DataTypes.STRING(255),
-// comment: "What is this ?"
-// },
-// pub_key: {
-// type: DataTypes.STRING(255),
-// comment: "What is this ?"
-// },
-// priv_key: {
-// type: DataTypes.STRING(255),
-// comment: "What is this ?"
-// }
-// }
-// const options = {
-// tableName: "non_custodial_accounts",
-// comment: "",
-// timestamps: true,
-// createdAt: 'created_at',
-// updatedAt: 'updated_at',
-// indexes: [
-// {
-// unique: true,
-// fields: ['account_id']
-// }
-// ]
-// };
-
-// db["NonCustodialAccount"] = db.define("non_custodial_accounts_model", attributes, options);
diff --git a/db/normalized/orders.js b/db/normalized/orders.js
deleted file mode 100644
index 06e83db1..00000000
--- a/db/normalized/orders.js
+++ /dev/null
@@ -1,29 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('orders', function(t) {
- t.increments('id').unsigned().primary();
-
- t.int('sell_transfer_id').notNull();
- t.foreign('sell_transfer_id').references('transfers.id');
-
- t.int('buy_transfer_id').notNull();
- t.foreign('buy_transfer_id').references('transfers.id');
-
- // t.int('exchange_id').notNull();
- // t.foreign('exchange_id').references('exchanges.id');
-
- t.double('exchange_rate').notNull();
- // t.double('amount').notNull();
-
- t.enu('status', ['Submitted', 'Accepted', 'Cancelled']).notNull();
- t.date('completion_date')
-
- t.timestamps();
- })
-};
-
-// Bid / Accepted ... separate into Bid (credit + debit), Accepted (credit + debit)
-
-export const down = function(knex) {
- return knex.schema.dropTable('orders');
-};
-
diff --git a/db/normalized/referrals.js b/db/normalized/referrals.js
deleted file mode 100644
index 7380f2cf..00000000
--- a/db/normalized/referrals.js
+++ /dev/null
@@ -1,20 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('referrals', function(t) {
- t.increments('id').unsigned().primary();
- t.int('user_id').nullable();
- t.foreign('user_id').references('users.id');
-
- t.int('sponsor_id').notNull();
- t.foreign('sponsor_id').references('users.id');
-
- t.string('token').notNull();
- t.string('expiry').nullable();
- t.enum('status', ['available', 'used', 'expired', 'cancelled']).notNull().defaultTo('available');
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
- return knex.schema.dropTable('referrals');
-};
diff --git a/db/normalized/transactions.js b/db/normalized/transactions.js
deleted file mode 100644
index 230faca4..00000000
--- a/db/normalized/transactions.js
+++ /dev/null
@@ -1,41 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('transactions', function(t) {
- t.increments('id').unsigned().primary();
-
- t.enu('type', ['deposit', 'withdrawal', 'transfer', 'exchange', 'invoice', 'voucher', 'new asset'])
-
- // t.text('notes');
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
-return knex.schema.dropTable('transactions');
-};
-
-// Changes:
-//
-// Deposit = deposit + credit
-// Withdrawal = withdrawal + debit
-// Transfer = credit + debit
-// Exchange = credit + debit + debit + credit
-// Invoice = invoice + debit ?
-// Voucher = invoice + debit ?
-// New Asset = liquid_asset + credit
-
-//
-// context for path, memo, rate, preimage, address, received, fee, tip, confirmed, redeemcode ?
-export const up = function(knex) {
- return knex.schema.createTable('transactions', function(t) {
- t.increments('id').unsigned().primary();
-
- t.enu('type', ['deposit', 'withdrawal', 'order', 'transfer', 'invoice', 'voucher'])
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
-return knex.schema.dropTable('transactions');
-}; \ No newline at end of file
diff --git a/db/normalized/transfers.js b/db/normalized/transfers.js
deleted file mode 100644
index 64f5c392..00000000
--- a/db/normalized/transfers.js
+++ /dev/null
@@ -1,243 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('transfers', function(t) {
- t.increments('id').unsigned().primary();
-
- t.int('transaction_id').notNull();
- t.foreign('transaction_id').references('accounts.id');
-
- t.int('debit_id').notNull();
- t.foreign('debit_id').references('debits.id');
-
- t.int('credit_id').notNull();
- t.foreign('credit_id').references('credits.id');
-
- // t.int('liquid_asset_id').notNull();
- // t.foreign('liquid_asset_id').references('liquid_assets.id');
-
- // t.double('amount');
- t.double('transfer_fee').notNull().defaultTo(0)
-
- t.enu('status', ['pending', 'completed', 'reversed', 'cancelled'])
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
-return knex.schema.dropTable('transfers');
-};
-
-// Changes:
-//
-// Should these be tracked as transactions ?
-// SAT -> SAT
-// tracking various exchange variations (outside of external networks ?)
-//
-// Is user / account / amount info redundant ?
-// + transaction_type: deposit / withdrawal / transfer / exchange ?
-//
-// add transfers table ? (for internal transfers only ?)
-// add redemptions table ? (for bitcoin transfers only ?)
-// add exchanges table ? (for conversion from one currency to another)
-//
-// network -> scope: internal / bitcoin / liquid / lightning ?
-// add bitcoin_transaction ? (with redemption attributes)
-// add liquid_transaction ? ()
-// add lightning_transaction ? (with LN_invoice_hash)
-// add internal_transaction ? ()
-//
-// context for path, memo, rate, preimage, address, received, fee, tip, confirmed, redeemcode ?
-
-
-import { DataTypes } from '@sequelize/core';
-
-const attributes = {
- id: {
- type: DataTypes.INTEGER(11),
- allowNull: false,
- defaultValue: null,
- primaryKey: true,
- autoIncrement: true,
- comment: null,
- field: "id"
- },
- account_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "account_id"
- },
- user_id: {
- type: DataTypes.INTEGER(11),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "user_id"
- },
- path: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "path"
- },
- memo: {
- type: DataTypes.TEXT,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "memo"
- },
- hash: {
- type: DataTypes.TEXT,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "hash"
- },
- createdAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "createdAt"
- },
- updatedAt: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "updatedAt"
- },
- rate: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "rate"
- },
- preimage: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "preimage"
- },
- network: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "network"
- },
- currency: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "currency"
- },
- address: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "address"
- },
- received: {
- type: DataTypes.INTEGER(1),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "received"
- },
- amount: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "amount"
- },
- fee: {
- type: DataTypes.DOUBLE,
- allowNull: false,
- defaultValue: 0,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "fee"
- },
- tip: {
- type: DataTypes.DOUBLE,
- allowNull: false,
- defaultValue: 0,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "tip"
- },
- redeemed: {
- type: DataTypes.BOOLEAN,
- allowNull: false,
- defaultValue: false,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "redeemed"
- },
- redeemcode: {
- type: DataTypes.STRING(255),
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "redeemcode"
- },
- confirmed: {
- type: DataTypes.INTEGER(1),
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "confirmed"
- }
-};
-
-const options = {
- tableName: "payments",
- comment: "",
- indexes: []
-};
-
-db["Payment"] = db.define("payments_model", attributes, options);
diff --git a/db/normalized/user_preferences.js b/db/normalized/user_preferences.js
deleted file mode 100644
index 6af69f3f..00000000
--- a/db/normalized/user_preferences.js
+++ /dev/null
@@ -1,20 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('user_preferences', function(t) {
- t.increments('id').unsigned().primary();
- t.int('user_id').notNull();
- t.foreign('user_id').references('users.id');
-
- t.enum('default_unit', ['SAT', 'BTC', 'CAD']).notNull().defaultTo('SAT');
- t.enum('default_currency', ['CAD', 'USD']).notNull().defaultTo('CAD');
- t.enum('default_fiat', ['CAD', 'USD']).notNull().defaultTo('CAD');
- t.set('show_currencies', ['CAD', 'USD']).notNull().defaultTo('CAD');
- t.longtext(`subscriptions`).collate('utf8mb4').nullable(); // CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL")
- t.timestamps();
-
- // knex.raw("ALTER TABLE users MODIFY `subscriptions` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL")
- })
-};
-
-export const down = function(knex) {
- return knex.schema.dropTable('user_preferences');
-};
diff --git a/db/normalized/user_security.js b/db/normalized/user_security.js
deleted file mode 100644
index 919b2902..00000000
--- a/db/normalized/user_security.js
+++ /dev/null
@@ -1,22 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('user_security', function(t) {
- t.increments('id').unsigned().primary();
- t.int('user_id').notNull();
- t.foreign('user_id').references('users.id');
-
- t.boolean('twofa').notNull().defaultTo(false);
- t.string('pin').notNull();
- t.string('otp_secret').nullable();
- t.string('seed').nullable();
-
- t.boolean('email_verified').notNull().default(false)
- t.boolean('phone_verified').notNull().default(false)
- t.boolean('kyc_verified').notNull().default(false)
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
- return knex.schema.dropTable('user_security');
-}; \ No newline at end of file
diff --git a/db/normalized/users.js b/db/normalized/users.js
deleted file mode 100644
index dd239f24..00000000
--- a/db/normalized/users.js
+++ /dev/null
@@ -1,18 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('users', function(t) {
- t.increments('id').unsigned().primary();
-
- t.string('uuid').notNull().index();
- t.string('username').notNull().index();
- t.string('password').notNull();
- t.string('email').nullable().index();
- t.string('phone').nullable();
- t.enum('access', ['Anonymous', 'Registered', 'Admin']).notNull().defaultTo('Anonymous');
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
- return knex.schema.dropTable('users');
-}; \ No newline at end of file
diff --git a/db/normalized/vouchers.js b/db/normalized/vouchers.js
deleted file mode 100644
index 35d54de2..00000000
--- a/db/normalized/vouchers.js
+++ /dev/null
@@ -1,18 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('vouchers', function(t) {
- t.increments('id').unsigned().primary();
-
- t.int('invoice_id').notNull();
- t.foreign('invoice_id').references('invoices.id');
-
- t.string('redemption_code').notNull();
-
- t.enu('status', ['pending', 'redeemed', 'cancelled']).notNull();
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
- return knex.schema.dropTable('vouchers');
-}; \ No newline at end of file
diff --git a/db/normalized/waiting_list.js b/db/normalized/waiting_list.js
deleted file mode 100644
index 5a37dc52..00000000
--- a/db/normalized/waiting_list.js
+++ /dev/null
@@ -1,60 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('waiting_list', function(t) {
- t.increments('id').unsigned().primary();
-
- t.string('email').notNull();
- t.string('phone').notNull();
- t.enu('status', ['pending', 'activated', 'expired', 'cancelled']).notNull();
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
- return knex.schema.dropTable('waiting_list');
-};
-
-// const { DataTypes } = require('@sequelize/core');
-
-// const attributes = {
-// id: {
-// type: DataTypes.INTEGER(11),
-// primaryKey: true,
-// autoIncrement: true,
-// allowNull: false
-// },
-// email: {
-// type: DataTypes.STRING(255),
-// validate: {
-// isEmail: true
-// }
-// },
-// sms: {
-// type: DataTypes.STRING(255),
-// validate: {
-// is: /^[0-9]+$/ // replace spaces, brackets, dashes dynamically prior to create
-// }
-// },
-// status: {
-// type: DataTypes.ENUM,
-// values: ['pending', 'activated', 'expired', 'cancelled'],
-// defaultValue: 'pending',
-// allowNull: false
-// }
-// }
-
-// const options = {
-// tableName: "waiting_list",
-// comment: "Users on waiting list",
-// timestamps: true,
-// createdAt: 'created_at',
-// updatedAt: 'updated_at',
-// indexes: [
-// {
-// unique: true,
-// fields: ['email', 'sms']
-// }
-// ]
-// };
-
-// db["WaitingList"] = db.define("waiting_list_model", attributes, options);
diff --git a/db/normalized/withdrawals.js b/db/normalized/withdrawals.js
deleted file mode 100644
index 742f3dbf..00000000
--- a/db/normalized/withdrawals.js
+++ /dev/null
@@ -1,128 +0,0 @@
-export const up = function(knex) {
- return knex.schema.createTable('withdrawals', function(t) {
- t.increments('id').unsigned().primary();
-
- t.int('debit_id').notNull();
- t.foreign('debit_id').references('debits.id');
-
- t.int('bank_account_id').notNull();
- t.foreign('bank_account_id').references('bank_accounts.id');
-
- t.double('withdrawal_fee').notNull().defaultTo(0)
-
- t.text('notes');
-
- t.timestamps();
- })
-};
-
-export const down = function(knex) {
- return knex.schema.dropTable('withdrawals');
-};
-
-// Changes:
-//
-// bank info -> bank_account records
-
-// const { DataTypes } = require('@sequelize/core');
-
-// const attributes = {
-// id: {
-// type: DataTypes.INTEGER(11),
-// allowNull: false,
-// defaultValue: null,
-// primaryKey: true,
-// autoIncrement: true,
-// comment: null,
-// field: "id"
-// },
-// amount: {
-// type: DataTypes.DOUBLE,
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "amount"
-// },
-// user_id: {
-// type: DataTypes.INTEGER(11),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "user_id"
-// },
-// createdAt: {
-// type: DataTypes.DATE,
-// allowNull: false,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "createdAt"
-// },
-// updatedAt: {
-// type: DataTypes.DATE,
-// allowNull: false,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "updatedAt"
-// },
-// transit: {
-// type: DataTypes.STRING(255),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "transit"
-// },
-// institution: {
-// type: DataTypes.STRING(255),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "institution"
-// },
-// account: {
-// type: DataTypes.STRING(255),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "account"
-// },
-// email: {
-// type: DataTypes.STRING(255),
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "email"
-// },
-// notes: {
-// type: DataTypes.TEXT,
-// allowNull: true,
-// defaultValue: null,
-// primaryKey: false,
-// autoIncrement: false,
-// comment: null,
-// field: "notes"
-// },
-// };
-
-// const options = {
-// tableName: "withdrawals",
-// comment: "",
-// indexes: []
-// };
-
-// db["Withdrawal"] = db.define("withdrawals_model", attributes, options);
diff --git a/db/schema.sql b/db/schema.sql
deleted file mode 100644
index e6e2e03f..00000000
--- a/db/schema.sql
+++ /dev/null
@@ -1,479 +0,0 @@
--- MariaDB dump 10.19 Distrib 10.6.1-MariaDB, for debian-linux-gnu (x86_64)
---
--- Host: localhost Database: coinos
--- ------------------------------------------------------
--- 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 utf8mb4 */;
-/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
-/*!40103 SET TIME_ZONE='+00:00' */;
-/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-
---
--- Current Database: `coinos`
---
-
-CREATE DATABASE /*!32312 IF NOT EXISTS*/ `coinos` /*!40100 DEFAULT CHARACTER SET latin1 */;
-
-USE `coinos`;
-
---
--- Table structure for table `SequelizeMeta`
---
-
-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 utf8mb3_unicode_ci NOT NULL,
- PRIMARY KEY (`name`),
- UNIQUE KEY `name` (`name`),
- UNIQUE KEY `SequelizeMeta_name_unique` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `accounts`
---
-
-DROP TABLE IF EXISTS `accounts`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `accounts` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `user_id` int(11) DEFAULT NULL,
- `asset` varchar(255) DEFAULT NULL,
- `createdAt` datetime NOT NULL,
- `updatedAt` datetime NOT NULL,
- `balance` double DEFAULT NULL,
- `pending` double DEFAULT NULL,
- `name` varchar(255) DEFAULT NULL,
- `ticker` varchar(255) DEFAULT NULL,
- `precision` int(11) DEFAULT NULL,
- `domain` varchar(255) DEFAULT NULL,
- `contract` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
- `index` int(11) NOT NULL DEFAULT 0,
- `pubkey` varchar(255) DEFAULT NULL,
- `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,
- `btc_credits` double NOT NULL DEFAULT 0,
- `liquid_credits` double NOT NULL DEFAULT 0,
- `lightning_credits` double NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`),
- KEY `asset` (`asset`)
-) ENGINE=InnoDB AUTO_INCREMENT=21826 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `codes`
---
-
-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 DEFAULT NULL,
- PRIMARY KEY (`code`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `deposits`
---
-
-DROP TABLE IF EXISTS `deposits`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `deposits` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `user_id` int(11) DEFAULT NULL,
- `createdAt` datetime NOT NULL,
- `updatedAt` datetime NOT NULL,
- `amount` double DEFAULT NULL,
- `credited` tinyint(1) DEFAULT NULL,
- `code` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `deposits_user_id_foreign` (`user_id`),
- CONSTRAINT `deposits_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=4568 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `invoices`
---
-
-DROP TABLE IF EXISTS `invoices`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `invoices` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `user_id` int(11) DEFAULT NULL,
- `text` text DEFAULT NULL,
- `createdAt` datetime NOT NULL,
- `updatedAt` datetime NOT NULL,
- `rate` double DEFAULT NULL,
- `currency` varchar(255) NOT NULL,
- `address` varchar(255) DEFAULT NULL,
- `received` bigint(20) NOT NULL DEFAULT 0,
- `amount` bigint(20) DEFAULT NULL,
- `tip` double DEFAULT NULL,
- `network` varchar(255) DEFAULT NULL,
- `unconfidential` varchar(255) DEFAULT NULL,
- `uuid` varchar(255) DEFAULT uuid(),
- `memo` text DEFAULT NULL,
- `account_id` int(11) DEFAULT NULL,
- `path` varchar(255) DEFAULT NULL,
- `webhook` text DEFAULT NULL,
- `status` varchar(255) DEFAULT 'unpaid',
- `prompt` tinyint(1) NOT NULL DEFAULT 0,
- `pending` bigint(20) DEFAULT 0,
- PRIMARY KEY (`id`),
- KEY `part_of_unconfidential` (`unconfidential`(10)),
- KEY `text_index` (`text`(100)),
- KEY `unconfidential_index` (`unconfidential`(100)),
- KEY `address_index` (`address`(100)),
- KEY `invoices_user_id_foreign` (`user_id`),
- KEY `invoices_account_id_foreign` (`account_id`),
- KEY `uuid` (`uuid`(10)),
- CONSTRAINT `invoices_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`),
- CONSTRAINT `invoices_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=49340 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `linkingkeys`
---
-
-DROP TABLE IF EXISTS `linkingkeys`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `linkingkeys` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `user_id` int(11) DEFAULT NULL,
- `hex` varchar(255) DEFAULT NULL,
- `createdAt` datetime NOT NULL,
- `updatedAt` datetime NOT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=12640 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `lnurl_migrations`
---
-
-DROP TABLE IF EXISTS `lnurl_migrations`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `lnurl_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=8 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `lnurl_migrations_lock`
---
-
-DROP TABLE IF EXISTS `lnurl_migrations_lock`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `lnurl_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=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=18 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 */;
-
---
--- Table structure for table `orders`
---
-
-DROP TABLE IF EXISTS `orders`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `orders` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `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,
- `a1_id` int(11) DEFAULT NULL,
- `a2_id` int(11) DEFAULT NULL,
- `completedAt` datetime DEFAULT NULL,
- `rate` double DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `orders_user_id_foreign` (`user_id`),
- KEY `orders_a1_id_foreign` (`a1_id`),
- KEY `orders_a2_id_foreign` (`a2_id`),
- CONSTRAINT `orders_a1_id_foreign` FOREIGN KEY (`a1_id`) REFERENCES `accounts` (`id`),
- CONSTRAINT `orders_a2_id_foreign` FOREIGN KEY (`a2_id`) REFERENCES `accounts` (`id`),
- CONSTRAINT `orders_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=337 DEFAULT CHARSET=utf8mb4;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `payments`
---
-
-DROP TABLE IF EXISTS `payments`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `payments` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `user_id` int(11) DEFAULT NULL,
- `hash` text DEFAULT NULL,
- `createdAt` datetime NOT NULL,
- `updatedAt` datetime NOT NULL,
- `rate` double DEFAULT NULL,
- `currency` varchar(255) DEFAULT NULL,
- `address` varchar(255) DEFAULT NULL,
- `received` tinyint(1) DEFAULT NULL,
- `amount` double DEFAULT NULL,
- `tip` double NOT NULL DEFAULT 0,
- `confirmed` tinyint(1) NOT NULL,
- `fee` double NOT NULL DEFAULT 0,
- `network` varchar(255) DEFAULT NULL,
- `account_id` int(11) DEFAULT NULL,
- `preimage` varchar(255) DEFAULT NULL,
- `memo` text DEFAULT NULL,
- `redeemed` tinyint(1) NOT NULL DEFAULT 0,
- `redeemcode` varchar(255) DEFAULT NULL,
- `path` varchar(255) DEFAULT NULL,
- `invoice_id` int(11) DEFAULT NULL,
- `fee_payment_id` int(11) DEFAULT NULL,
- `with_id` int(11) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `idx_redeemcode` (`redeemcode`),
- KEY `payments_invoice_id_foreign` (`invoice_id`),
- KEY `payments_user_id_foreign` (`user_id`),
- KEY `payments_account_id_foreign` (`account_id`),
- KEY `fk_payments` (`fee_payment_id`),
- KEY `fk_with` (`with_id`),
- CONSTRAINT `fk_payments` FOREIGN KEY (`fee_payment_id`) REFERENCES `payments` (`id`),
- CONSTRAINT `fk_with` FOREIGN KEY (`with_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
- CONSTRAINT `payments_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`),
- CONSTRAINT `payments_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`),
- CONSTRAINT `payments_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=30378 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `prs`
---
-
-DROP TABLE IF EXISTS `prs`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `prs` (
- `text` text DEFAULT NULL,
- `preimage` text DEFAULT NULL
-) ENGINE=InnoDB 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,
- `user_id` int(11) DEFAULT NULL,
- `sponsor_id` int(11) NOT NULL,
- `token` varchar(255) NOT NULL,
- `expiry` varchar(255) DEFAULT NULL,
- `status` enum('available','used','expired','cancelled') NOT NULL DEFAULT 'available',
- `created_at` datetime DEFAULT NULL,
- `updated_at` datetime DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `referrals_user_id_foreign` (`user_id`),
- KEY `referrals_sponsor_id_foreign` (`sponsor_id`),
- CONSTRAINT `referrals_sponsor_id_foreign` FOREIGN KEY (`sponsor_id`) REFERENCES `users` (`id`),
- CONSTRAINT `referrals_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `requests`
---
-
-DROP TABLE IF EXISTS `requests`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `requests` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `requester_id` int(11) DEFAULT NULL,
- `recipient_id` int(11) DEFAULT NULL,
- `memo` text DEFAULT NULL,
- `createdAt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
- `updatedAt` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
- `invoice_id` int(11) DEFAULT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=29 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,
- `apiKeyId` varchar(255) DEFAULT NULL,
- `tag` varchar(255) DEFAULT NULL,
- `params` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`params`)),
- `initialUses` int(10) unsigned DEFAULT 1,
- `remainingUses` int(10) unsigned DEFAULT 0,
- `createdAt` timestamp NOT NULL DEFAULT current_timestamp(),
- `updatedAt` timestamp NOT NULL DEFAULT current_timestamp(),
- UNIQUE KEY `urls_hash_unique` (`hash`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `users`
---
-
-DROP TABLE IF EXISTS `users`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-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',
- `currency` varchar(255) DEFAULT NULL,
- `createdAt` datetime NOT NULL,
- `updatedAt` datetime NOT NULL,
- `twofa` tinyint(1) DEFAULT NULL,
- `pin` varchar(255) DEFAULT NULL,
- `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` 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,
- `verified` varchar(255) DEFAULT NULL,
- `locked` tinyint(1) DEFAULT 0,
- `authyId` varchar(255) DEFAULT NULL,
- `admin` tinyint(1) DEFAULT NULL,
- `email` varchar(255) DEFAULT NULL,
- `phone` varchar(255) DEFAULT NULL,
- `address` text DEFAULT NULL,
- `profile` tinyint(1) DEFAULT 0,
- `banner` tinyint(1) DEFAULT 0,
- `theme` varchar(255) DEFAULT NULL,
- `uuid` varchar(255) NOT NULL DEFAULT uuid(),
- PRIMARY KEY (`id`),
- KEY `ip` (`ip`),
- KEY `username` (`username`)
-) ENGINE=InnoDB AUTO_INCREMENT=15518 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) NOT NULL,
- `phone` varchar(255) NOT NULL,
- `status` enum('pending','activated','expired','cancelled') NOT NULL,
- `user_id` int(11) DEFAULT NULL,
- `notes` text DEFAULT NULL,
- `created_at` datetime DEFAULT NULL,
- `updated_at` datetime DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `waiting_list_user_id_foreign` (`user_id`),
- CONSTRAINT `waiting_list_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `withdrawals`
---
-
-DROP TABLE IF EXISTS `withdrawals`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `withdrawals` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `user_id` int(11) NOT NULL,
- `createdAt` datetime NOT NULL,
- `updatedAt` datetime NOT NULL,
- `amount` double DEFAULT NULL,
- `completed` tinyint(1) DEFAULT NULL,
- `transit` varchar(255) DEFAULT NULL,
- `account` varchar(255) DEFAULT NULL,
- `institution` varchar(255) DEFAULT NULL,
- `notes` text DEFAULT NULL,
- `email` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `withdrawals_user_id_foreign` (`user_id`),
- CONSTRAINT `withdrawals_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=4119 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
-
-/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
-/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
-/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
-/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
-/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
-/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-
--- Dump completed on 2022-11-24 19:44:06