From 28f3f69c5e593bcb8462e773ad4a82fb934ada4d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 13 May 2021 19:57:01 -0400 Subject: schema docs --- db/normalized/accounts.js | 13 +++++++------ db/normalized/assets.js | 27 --------------------------- db/normalized/deposits.js | 6 +++--- 3 files changed, 10 insertions(+), 36 deletions(-) delete mode 100644 db/normalized/assets.js (limited to 'db/normalized') diff --git a/db/normalized/accounts.js b/db/normalized/accounts.js index 7eabaaa0..36e332d7 100644 --- a/db/normalized/accounts.js +++ b/db/normalized/accounts.js @@ -18,11 +18,10 @@ const attributes = { allowNull: false, comment: "Referral granted to this user (updated when token used)" }, - asset_id: { - type: DataTypes.INTEGER(11), - references: { model: Asset, key: 'code' }, + asset: { + type: DataTypes.STRING, allowNull: false, - comment: "Reference to asset" + comment: "Reference to liquid asset on liquid blockchain" }, balance: { type: DataTypes.DOUBLE, @@ -31,12 +30,14 @@ const attributes = { pending: { type: DataTypes.DOUBLE, allowNull: false, - comment: "What is this ?" + comment: "Pending balance indicates that the transaction has been detected on the blockchain but not confirmed" }, + /* DEPRECATED precision: { type: DataTypes.INTEGER(11), - comment: "what is this for ? ... is it unique for each account ?" + comment: "The decimal precision for the liquid asset " } + */ } const options = { tableName: "accounts", diff --git a/db/normalized/assets.js b/db/normalized/assets.js deleted file mode 100644 index 63866b4f..00000000 --- a/db/normalized/assets.js +++ /dev/null @@ -1,27 +0,0 @@ -const { DataTypes } = require('sequelize'); - -const attributes = { - code: { - type: DataTypes.INTEGER(11), - primaryKey: true, - allowNull: false - }, - name: { - type: DataTypes.STRING(255) - } -} -const options = { - tableName: "assets", - comment: "", - timestamps: true, - createdAt: 'created_at', - updatedAt: 'updated_at', - indexes: [ - { - unique: true, - fields: ['code'] - } - ] -}; - -db["Asset"] = db.define("assets_model", attributes, options); diff --git a/db/normalized/deposits.js b/db/normalized/deposits.js index 7259abc2..ec9472d8 100644 --- a/db/normalized/deposits.js +++ b/db/normalized/deposits.js @@ -17,9 +17,9 @@ const attributes = { type: DataTypes.DECIMAL(10,2), allowNull: false }, - code: { - // is this unique ? - type: DataTypes.STRING(255) + deposit_code: { + type: DataTypes.STRING(255), + comment: "Unique randomly generated code to be put in the interac deposit reference/message to link the deposit to this record/user", }, status: { type: DataTypes.ENUM, -- cgit v1.2.3