diff options
Diffstat (limited to 'db')
| -rw-r--r-- | db/index.js | 5 | ||||
| -rw-r--r-- | db/models/accounts.js | 9 | ||||
| -rw-r--r-- | db/models/invoices.js | 9 | ||||
| -rw-r--r-- | db/models/users.js | 27 | ||||
| -rw-r--r-- | db/schema.sql | 17 |
5 files changed, 21 insertions, 46 deletions
diff --git a/db/index.js b/db/index.js index 7f011c9c..6fa225e6 100644 --- a/db/index.js +++ b/db/index.js @@ -41,6 +41,11 @@ db["User"].belongsTo(db["Account"], { foreignKey: "account_id" }); +db["Invoice"].belongsTo(db["Account"], { + as: "account", + foreignKey: "account_id" +}); + db["Account"].belongsTo(db["User"], { as: "user", foreignKey: "user_id" diff --git a/db/models/accounts.js b/db/models/accounts.js index 89c85ef1..53684caf 100644 --- a/db/models/accounts.js +++ b/db/models/accounts.js @@ -124,15 +124,6 @@ const attributes = { comment: null, field: "index" }, - address: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - primaryKey: false, - autoIncrement: false, - comment: null, - field: "address" - }, pubkey: { type: DataTypes.STRING, allowNull: true, diff --git a/db/models/invoices.js b/db/models/invoices.js index 231ed6f6..d2a73f7f 100644 --- a/db/models/invoices.js +++ b/db/models/invoices.js @@ -10,6 +10,15 @@ const attributes = { 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, diff --git a/db/models/users.js b/db/models/users.js index 6a5b138c..f6446a38 100644 --- a/db/models/users.js +++ b/db/models/users.js @@ -55,24 +55,6 @@ const attributes = { comment: null, field: "password" }, - liquid: { - type: DataTypes.STRING(255), - allowNull: true, - defaultValue: null, - primaryKey: false, - autoIncrement: false, - comment: null, - field: "liquid" - }, - confidential: { - type: DataTypes.STRING(255), - allowNull: true, - defaultValue: null, - primaryKey: false, - autoIncrement: false, - comment: null, - field: "confidential" - }, unit: { type: DataTypes.STRING(255), allowNull: true, @@ -82,15 +64,6 @@ const attributes = { comment: null, field: "unit" }, - address: { - type: DataTypes.STRING(255), - allowNull: true, - defaultValue: null, - primaryKey: false, - autoIncrement: false, - comment: null, - field: "address" - }, account_id: { type: DataTypes.INTEGER(11), allowNull: true, diff --git a/db/schema.sql b/db/schema.sql index 731f7ca9..b423620e 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -60,10 +60,9 @@ CREATE TABLE `accounts` ( `contract` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, `pubkey` varchar(255) DEFAULT NULL, `index` int(11) DEFAULT NULL, - `address` varchar(255) DEFAULT NULL, `hide` tinyint(1) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=3786 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=3809 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -103,8 +102,9 @@ CREATE TABLE `invoices` ( `unconfidential` varchar(255) DEFAULT NULL, `uuid` varchar(255) DEFAULT NULL, `memo` text DEFAULT NULL, + `account_id` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=5068 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=5116 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -121,7 +121,7 @@ CREATE TABLE `linkingkeys` ( `createdAt` datetime NOT NULL, `updatedAt` datetime NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4517 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=4518 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -152,7 +152,7 @@ CREATE TABLE `payments` ( `redeemcode` varchar(255) DEFAULT NULL, `redeemed` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4972 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=5169 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -203,7 +203,6 @@ CREATE TABLE `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(255) DEFAULT NULL, `password` varchar(255) DEFAULT NULL, - `address` varchar(255) DEFAULT NULL, `unit` varchar(255) DEFAULT 'SAT', `account_id` int(11) DEFAULT NULL, `currency` varchar(255) DEFAULT NULL, @@ -212,8 +211,6 @@ CREATE TABLE `users` ( `twofa` tinyint(1) DEFAULT NULL, `authyId` varchar(255) DEFAULT NULL, `pin` varchar(255) DEFAULT NULL, - `confidential` varchar(255) DEFAULT NULL, - `liquid` varchar(255) DEFAULT NULL, `currencies` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, `otpsecret` varchar(255) DEFAULT NULL, `ip` int(10) unsigned DEFAULT NULL, @@ -223,7 +220,7 @@ CREATE TABLE `users` ( `fiat` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `ip` (`ip`) -) ENGINE=InnoDB AUTO_INCREMENT=652 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=653 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -235,4 +232,4 @@ CREATE TABLE `users` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-08-11 14:18:10 +-- Dump completed on 2020-08-16 15:42:08 |
