dip-dobit-shared-model 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ module.exports = {
4
+ async up(queryInterface, Sequelize) {
5
+ const tableDescription = await queryInterface.describeTable("Transactions");
6
+
7
+ if (!tableDescription.appUserId) {
8
+ await queryInterface.addColumn("Transactions", "appUserId", {
9
+ type: Sequelize.BIGINT.UNSIGNED,
10
+ allowNull: true, // temporarily allow null for existing rows
11
+ after: "dobitUserId",
12
+ references: {
13
+ model: "DobitUsers",
14
+ key: "appUserId",
15
+ },
16
+ onUpdate: "CASCADE",
17
+ onDelete: "CASCADE",
18
+ });
19
+ }
20
+ },
21
+
22
+ async down(queryInterface) {
23
+ await queryInterface.removeColumn("Transactions", "appUserId");
24
+ },
25
+ };
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ const tableDescription = await queryInterface.describeTable("DobitUsers");
6
+
7
+ if (!tableDescription.biometricPublicKey) {
8
+ await queryInterface.addColumn("DobitUsers", "biometricPublicKey", {
9
+ type: Sequelize.STRING(700),
10
+ allowNull: true,
11
+ unique: true,
12
+ after: "biometrics",
13
+ });
14
+ }
15
+
16
+ if (!tableDescription.walletBalance) {
17
+ await queryInterface.addColumn("DobitUsers", "walletBalance", {
18
+ type: Sequelize.DECIMAL(10, 2),
19
+ allowNull: true,
20
+ defaultValue: 0.0,
21
+ after: "promotionalOffers",
22
+ });
23
+ }
24
+
25
+ if (!tableDescription.currency) {
26
+ await queryInterface.addColumn("DobitUsers", "currency", {
27
+ type: Sequelize.STRING,
28
+ allowNull: true,
29
+ defaultValue: "NGN",
30
+ after: "walletBalance",
31
+ });
32
+ }
33
+ },
34
+
35
+ down: async (queryInterface) => {
36
+ await queryInterface.removeColumn("DobitUsers", "biometricPublicKey");
37
+ await queryInterface.removeColumn("DobitUsers", "walletBalance");
38
+ await queryInterface.removeColumn("DobitUsers", "currency");
39
+ },
40
+ };
@@ -93,6 +93,11 @@ module.exports = (sequelize) => {
93
93
  allowNull: false,
94
94
  defaultValue: false,
95
95
  },
96
+ biometricPublicKey: {
97
+ type: DataTypes.STRING(700),
98
+ allowNull: true,
99
+ unique: true,
100
+ },
96
101
  pushNotification: {
97
102
  type: DataTypes.BOOLEAN,
98
103
  allowNull: false,
@@ -108,6 +113,16 @@ module.exports = (sequelize) => {
108
113
  allowNull: false,
109
114
  defaultValue: true,
110
115
  },
116
+ walletBalance: {
117
+ type: DataTypes.DECIMAL(10, 2),
118
+ allowNull: false,
119
+ defaultValue: 0.0,
120
+ },
121
+ currency: {
122
+ type: DataTypes.STRING,
123
+ allowNull: false,
124
+ defaultValue: "NGN",
125
+ },
111
126
  userCreatedby: {
112
127
  type: DataTypes.INTEGER.UNSIGNED,
113
128
  allowNull: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dip-dobit-shared-model",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "main": "models/index.js",
5
5
  "scripts": {
6
6
  "migrate:up": "npx sequelize-cli db:migrate",