vr-migrations 1.0.38 → 1.0.40
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.
- package/dist/migrations/001-create-users.js +33 -7
- package/dist/migrations/008-create-payments.js +66 -30
- package/dist/migrations/009-create-payment-event-logs.js +123 -0
- package/dist/seeders/002-users-demo.js +21 -9
- package/package.json +1 -1
- package/dist/migrations/009-create-transactions.js +0 -80
|
@@ -18,11 +18,6 @@ module.exports = {
|
|
|
18
18
|
type: Sequelize.STRING(100),
|
|
19
19
|
allowNull: false,
|
|
20
20
|
},
|
|
21
|
-
nationalId: {
|
|
22
|
-
type: Sequelize.STRING(100),
|
|
23
|
-
allowNull: true,
|
|
24
|
-
unique: true,
|
|
25
|
-
},
|
|
26
21
|
jacketId: {
|
|
27
22
|
type: Sequelize.STRING(100),
|
|
28
23
|
allowNull: true,
|
|
@@ -49,6 +44,35 @@ module.exports = {
|
|
|
49
44
|
type: Sequelize.STRING(100),
|
|
50
45
|
allowNull: true,
|
|
51
46
|
},
|
|
47
|
+
gender: {
|
|
48
|
+
type: Sequelize.ENUM("male", "female"),
|
|
49
|
+
allowNull: false,
|
|
50
|
+
defaultValue: "male",
|
|
51
|
+
},
|
|
52
|
+
birthDate: {
|
|
53
|
+
type: Sequelize.INTEGER,
|
|
54
|
+
allowNull: true,
|
|
55
|
+
validate: {
|
|
56
|
+
min: 1,
|
|
57
|
+
max: 31,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
birthMonth: {
|
|
61
|
+
type: Sequelize.INTEGER,
|
|
62
|
+
allowNull: true,
|
|
63
|
+
validate: {
|
|
64
|
+
min: 1,
|
|
65
|
+
max: 12,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
birthYear: {
|
|
69
|
+
type: Sequelize.INTEGER,
|
|
70
|
+
allowNull: true,
|
|
71
|
+
validate: {
|
|
72
|
+
min: 1900,
|
|
73
|
+
max: new Date().getFullYear(),
|
|
74
|
+
},
|
|
75
|
+
},
|
|
52
76
|
primaryPhoneId: {
|
|
53
77
|
type: Sequelize.UUID,
|
|
54
78
|
allowNull: true,
|
|
@@ -67,7 +91,6 @@ module.exports = {
|
|
|
67
91
|
type: Sequelize.BOOLEAN,
|
|
68
92
|
defaultValue: false,
|
|
69
93
|
},
|
|
70
|
-
|
|
71
94
|
lastLoginAt: {
|
|
72
95
|
type: Sequelize.DATE,
|
|
73
96
|
allowNull: true,
|
|
@@ -99,12 +122,15 @@ module.exports = {
|
|
|
99
122
|
|
|
100
123
|
// Add indexes
|
|
101
124
|
await queryInterface.addIndex("users", ["jacketId"]);
|
|
102
|
-
await queryInterface.addIndex("users", ["nationalId"]);
|
|
103
125
|
await queryInterface.addIndex("users", ["primaryPhoneId"]);
|
|
104
126
|
await queryInterface.addIndex("users", ["securityClearanceId"]);
|
|
127
|
+
await queryInterface.addIndex("users", ["gender"]);
|
|
105
128
|
},
|
|
106
129
|
|
|
107
130
|
async down(queryInterface) {
|
|
108
131
|
await queryInterface.dropTable("users");
|
|
132
|
+
await queryInterface.sequelize.query(
|
|
133
|
+
'DROP TYPE IF EXISTS "enum_users_gender";'
|
|
134
|
+
);
|
|
109
135
|
},
|
|
110
136
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
// src/database/migrations/XXXXXXXXXXXXXX-create-payments-table.js
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
4
|
+
/** @type {import('sequelize-cli').Migration} */
|
|
3
5
|
module.exports = {
|
|
4
6
|
async up(queryInterface, Sequelize) {
|
|
5
7
|
await queryInterface.createTable("payments", {
|
|
@@ -9,7 +11,6 @@ module.exports = {
|
|
|
9
11
|
primaryKey: true,
|
|
10
12
|
allowNull: false,
|
|
11
13
|
},
|
|
12
|
-
|
|
13
14
|
userId: {
|
|
14
15
|
type: Sequelize.UUID,
|
|
15
16
|
allowNull: false,
|
|
@@ -20,23 +21,26 @@ module.exports = {
|
|
|
20
21
|
onUpdate: "CASCADE",
|
|
21
22
|
onDelete: "RESTRICT",
|
|
22
23
|
},
|
|
23
|
-
|
|
24
24
|
devicePaymentPlanId: {
|
|
25
25
|
type: Sequelize.UUID,
|
|
26
|
-
allowNull:
|
|
26
|
+
allowNull: true,
|
|
27
27
|
references: {
|
|
28
28
|
model: "device_payment_plans",
|
|
29
29
|
key: "id",
|
|
30
30
|
},
|
|
31
31
|
onUpdate: "CASCADE",
|
|
32
|
-
onDelete: "
|
|
32
|
+
onDelete: "SET NULL",
|
|
33
33
|
},
|
|
34
|
-
|
|
35
|
-
transactionId: {
|
|
34
|
+
installmentId: {
|
|
36
35
|
type: Sequelize.UUID,
|
|
37
36
|
allowNull: true,
|
|
37
|
+
references: {
|
|
38
|
+
model: "installments",
|
|
39
|
+
key: "id",
|
|
40
|
+
},
|
|
41
|
+
onUpdate: "CASCADE",
|
|
42
|
+
onDelete: "SET NULL",
|
|
38
43
|
},
|
|
39
|
-
|
|
40
44
|
idempotencyKeyId: {
|
|
41
45
|
type: Sequelize.UUID,
|
|
42
46
|
allowNull: true,
|
|
@@ -47,60 +51,92 @@ module.exports = {
|
|
|
47
51
|
onUpdate: "CASCADE",
|
|
48
52
|
onDelete: "SET NULL",
|
|
49
53
|
},
|
|
50
|
-
|
|
51
54
|
amount: {
|
|
52
|
-
type: Sequelize.
|
|
55
|
+
type: Sequelize.DECIMAL(10, 2),
|
|
53
56
|
allowNull: false,
|
|
54
57
|
},
|
|
55
|
-
|
|
58
|
+
currency: {
|
|
59
|
+
type: Sequelize.STRING(3),
|
|
60
|
+
allowNull: false,
|
|
61
|
+
defaultValue: "RWF",
|
|
62
|
+
},
|
|
56
63
|
provider: {
|
|
57
|
-
type: Sequelize.ENUM("
|
|
64
|
+
type: Sequelize.ENUM("MTN_MOMO", "AIRTEL_MONEY", "DPO", "FLUTTERWAVE"),
|
|
58
65
|
allowNull: false,
|
|
59
66
|
},
|
|
60
|
-
|
|
61
67
|
providerReference: {
|
|
62
|
-
type: Sequelize.STRING,
|
|
68
|
+
type: Sequelize.STRING(255),
|
|
63
69
|
allowNull: true,
|
|
64
70
|
},
|
|
65
|
-
|
|
66
71
|
status: {
|
|
67
|
-
type: Sequelize.ENUM("PENDING", "SUCCESSFUL", "FAILED"),
|
|
72
|
+
type: Sequelize.ENUM("PENDING", "SUCCESSFUL", "FAILED", "REFUNDED"),
|
|
68
73
|
allowNull: false,
|
|
69
74
|
defaultValue: "PENDING",
|
|
70
75
|
},
|
|
71
|
-
|
|
76
|
+
customerPhone: {
|
|
77
|
+
type: Sequelize.STRING(20),
|
|
78
|
+
allowNull: false,
|
|
79
|
+
},
|
|
80
|
+
customerName: {
|
|
81
|
+
type: Sequelize.STRING(100),
|
|
82
|
+
allowNull: true,
|
|
83
|
+
},
|
|
84
|
+
failureReason: {
|
|
85
|
+
type: Sequelize.TEXT,
|
|
86
|
+
allowNull: true,
|
|
87
|
+
},
|
|
72
88
|
metadata: {
|
|
73
89
|
type: Sequelize.JSONB,
|
|
74
90
|
allowNull: false,
|
|
75
91
|
defaultValue: {},
|
|
76
92
|
},
|
|
77
|
-
|
|
93
|
+
settledAt: {
|
|
94
|
+
type: Sequelize.DATE,
|
|
95
|
+
allowNull: true,
|
|
96
|
+
},
|
|
78
97
|
createdAt: {
|
|
79
98
|
type: Sequelize.DATE,
|
|
80
99
|
allowNull: false,
|
|
81
|
-
defaultValue: Sequelize.
|
|
100
|
+
defaultValue: Sequelize.NOW,
|
|
82
101
|
},
|
|
83
|
-
|
|
84
102
|
updatedAt: {
|
|
85
103
|
type: Sequelize.DATE,
|
|
86
104
|
allowNull: false,
|
|
87
|
-
defaultValue: Sequelize.
|
|
105
|
+
defaultValue: Sequelize.NOW,
|
|
88
106
|
},
|
|
89
107
|
});
|
|
90
108
|
|
|
91
|
-
|
|
92
|
-
await queryInterface.addIndex("payments", ["
|
|
93
|
-
|
|
94
|
-
|
|
109
|
+
// Add indexes
|
|
110
|
+
await queryInterface.addIndex("payments", ["userId"], {
|
|
111
|
+
name: "payment_user_idx",
|
|
112
|
+
});
|
|
113
|
+
await queryInterface.addIndex("payments", ["devicePaymentPlanId"], {
|
|
114
|
+
name: "payment_plan_idx",
|
|
115
|
+
});
|
|
116
|
+
await queryInterface.addIndex("payments", ["installmentId"], {
|
|
117
|
+
name: "payment_installment_idx",
|
|
118
|
+
});
|
|
119
|
+
await queryInterface.addIndex("payments", ["status"], {
|
|
120
|
+
name: "payment_status_idx",
|
|
121
|
+
});
|
|
122
|
+
await queryInterface.addIndex("payments", ["providerReference"], {
|
|
123
|
+
name: "payment_provider_ref_idx",
|
|
124
|
+
});
|
|
125
|
+
await queryInterface.addIndex("payments", ["createdAt"], {
|
|
126
|
+
name: "payment_created_at_idx",
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// Add constraint: exactly one of devicePaymentPlanId or installmentId must be non-null
|
|
130
|
+
// This is handled in the model validation, but can also be added as a CHECK constraint
|
|
131
|
+
await queryInterface.sequelize.query(`
|
|
132
|
+
ALTER TABLE "payments" ADD CONSTRAINT "payments_target_check"
|
|
133
|
+
CHECK (
|
|
134
|
+
(("devicePaymentPlanId" IS NOT NULL)::int + ("installmentId" IS NOT NULL)::int) = 1
|
|
135
|
+
);
|
|
136
|
+
`);
|
|
95
137
|
},
|
|
96
138
|
|
|
97
139
|
async down(queryInterface) {
|
|
98
140
|
await queryInterface.dropTable("payments");
|
|
99
|
-
await queryInterface.sequelize.query(
|
|
100
|
-
'DROP TYPE IF EXISTS "enum_payments_provider";'
|
|
101
|
-
);
|
|
102
|
-
await queryInterface.sequelize.query(
|
|
103
|
-
'DROP TYPE IF EXISTS "enum_payments_status";'
|
|
104
|
-
);
|
|
105
141
|
},
|
|
106
142
|
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// src/database/migrations/XXXXXXXXXXXXXX-create-payment-event-logs-table.js
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
/** @type {import('sequelize-cli').Migration} */
|
|
5
|
+
module.exports = {
|
|
6
|
+
async up(queryInterface, Sequelize) {
|
|
7
|
+
await queryInterface.createTable("payment_event_logs", {
|
|
8
|
+
id: {
|
|
9
|
+
type: Sequelize.UUID,
|
|
10
|
+
defaultValue: Sequelize.UUIDV4,
|
|
11
|
+
primaryKey: true,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
},
|
|
14
|
+
paymentId: {
|
|
15
|
+
type: Sequelize.UUID,
|
|
16
|
+
allowNull: true,
|
|
17
|
+
references: {
|
|
18
|
+
model: "payments",
|
|
19
|
+
key: "id",
|
|
20
|
+
},
|
|
21
|
+
onUpdate: "CASCADE",
|
|
22
|
+
onDelete: "SET NULL",
|
|
23
|
+
},
|
|
24
|
+
provider: {
|
|
25
|
+
type: Sequelize.STRING(50),
|
|
26
|
+
allowNull: false,
|
|
27
|
+
},
|
|
28
|
+
direction: {
|
|
29
|
+
type: Sequelize.ENUM("OUTGOING_REQUEST", "INCOMING_WEBHOOK"),
|
|
30
|
+
allowNull: false,
|
|
31
|
+
},
|
|
32
|
+
action: {
|
|
33
|
+
type: Sequelize.STRING(50),
|
|
34
|
+
allowNull: false,
|
|
35
|
+
},
|
|
36
|
+
externalId: {
|
|
37
|
+
type: Sequelize.STRING(255),
|
|
38
|
+
allowNull: true,
|
|
39
|
+
},
|
|
40
|
+
requestPayload: {
|
|
41
|
+
type: Sequelize.JSONB,
|
|
42
|
+
allowNull: true,
|
|
43
|
+
},
|
|
44
|
+
responsePayload: {
|
|
45
|
+
type: Sequelize.JSONB,
|
|
46
|
+
allowNull: true,
|
|
47
|
+
},
|
|
48
|
+
statusCode: {
|
|
49
|
+
type: Sequelize.INTEGER,
|
|
50
|
+
allowNull: true,
|
|
51
|
+
},
|
|
52
|
+
status: {
|
|
53
|
+
type: Sequelize.ENUM("PENDING", "SUCCESS", "FAILED", "RETRIED"),
|
|
54
|
+
allowNull: false,
|
|
55
|
+
defaultValue: "PENDING",
|
|
56
|
+
},
|
|
57
|
+
error: {
|
|
58
|
+
type: Sequelize.TEXT,
|
|
59
|
+
allowNull: true,
|
|
60
|
+
},
|
|
61
|
+
durationMs: {
|
|
62
|
+
type: Sequelize.INTEGER,
|
|
63
|
+
allowNull: true,
|
|
64
|
+
},
|
|
65
|
+
retryCount: {
|
|
66
|
+
type: Sequelize.INTEGER,
|
|
67
|
+
allowNull: false,
|
|
68
|
+
defaultValue: 0,
|
|
69
|
+
},
|
|
70
|
+
nextRetryAt: {
|
|
71
|
+
type: Sequelize.DATE,
|
|
72
|
+
allowNull: true,
|
|
73
|
+
},
|
|
74
|
+
processedAt: {
|
|
75
|
+
type: Sequelize.DATE,
|
|
76
|
+
allowNull: true,
|
|
77
|
+
},
|
|
78
|
+
createdAt: {
|
|
79
|
+
type: Sequelize.DATE,
|
|
80
|
+
allowNull: false,
|
|
81
|
+
defaultValue: Sequelize.NOW,
|
|
82
|
+
},
|
|
83
|
+
updatedAt: {
|
|
84
|
+
type: Sequelize.DATE,
|
|
85
|
+
allowNull: false,
|
|
86
|
+
defaultValue: Sequelize.NOW,
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Add indexes
|
|
91
|
+
await queryInterface.addIndex("payment_event_logs", ["paymentId"], {
|
|
92
|
+
name: "payment_event_payment_idx",
|
|
93
|
+
});
|
|
94
|
+
await queryInterface.addIndex(
|
|
95
|
+
"payment_event_logs",
|
|
96
|
+
["provider", "externalId"],
|
|
97
|
+
{
|
|
98
|
+
name: "payment_event_provider_external_idx",
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
await queryInterface.addIndex(
|
|
102
|
+
"payment_event_logs",
|
|
103
|
+
["status", "nextRetryAt"],
|
|
104
|
+
{
|
|
105
|
+
name: "payment_event_retry_idx",
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
await queryInterface.addIndex("payment_event_logs", ["createdAt"], {
|
|
109
|
+
name: "payment_event_created_at_idx",
|
|
110
|
+
});
|
|
111
|
+
await queryInterface.addIndex(
|
|
112
|
+
"payment_event_logs",
|
|
113
|
+
["direction", "action"],
|
|
114
|
+
{
|
|
115
|
+
name: "payment_event_direction_action_idx",
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
async down(queryInterface) {
|
|
121
|
+
await queryInterface.dropTable("payment_event_logs");
|
|
122
|
+
},
|
|
123
|
+
};
|
|
@@ -6,10 +6,6 @@ module.exports = {
|
|
|
6
6
|
async up(queryInterface) {
|
|
7
7
|
const now = new Date();
|
|
8
8
|
const passwordHash = await bcrypt.hash("pass@123", 10);
|
|
9
|
-
const nid_1 = await bcrypt.hash("1199900000000001", 10);
|
|
10
|
-
const nid_2 = await bcrypt.hash("1199900000000002", 10);
|
|
11
|
-
const nid_3 = await bcrypt.hash("1199900000000003", 10);
|
|
12
|
-
const nid_4 = await bcrypt.hash("1199900000000004", 10);
|
|
13
9
|
|
|
14
10
|
// STEP 1: Create users FIRST (without primaryPhoneId initially)
|
|
15
11
|
await queryInterface.bulkInsert("users", [
|
|
@@ -17,11 +13,14 @@ module.exports = {
|
|
|
17
13
|
id: "aaaaaaa1-aaaa-aaaa-aaaa-aaaaaaaaaaa1",
|
|
18
14
|
firstName: "Jean",
|
|
19
15
|
lastName: "Rider",
|
|
20
|
-
nationalId: nid_1,
|
|
21
16
|
jacketId: "JACKET-R-001",
|
|
22
17
|
plateNumber: "RAD101A",
|
|
18
|
+
gender: "male",
|
|
19
|
+
birthDate: 15,
|
|
20
|
+
birthMonth: 6,
|
|
21
|
+
birthYear: 1990,
|
|
23
22
|
securityClearanceId: "11111111-1111-1111-1111-111111111111", // RIDER
|
|
24
|
-
primaryPhoneId: null,
|
|
23
|
+
primaryPhoneId: null,
|
|
25
24
|
isActive: true,
|
|
26
25
|
lastLoginAt: null,
|
|
27
26
|
createdAt: now,
|
|
@@ -32,6 +31,10 @@ module.exports = {
|
|
|
32
31
|
lastName: "Passenger",
|
|
33
32
|
email: "jane@passenger.com",
|
|
34
33
|
password: passwordHash,
|
|
34
|
+
gender: "female",
|
|
35
|
+
birthDate: 22,
|
|
36
|
+
birthMonth: 3,
|
|
37
|
+
birthYear: 1995,
|
|
35
38
|
securityClearanceId: "22222222-2222-2222-2222-222222222222", // PASSENGER
|
|
36
39
|
primaryPhoneId: null,
|
|
37
40
|
isActive: true,
|
|
@@ -42,9 +45,12 @@ module.exports = {
|
|
|
42
45
|
id: "aaaaaaa2-aaaa-aaaa-aaaa-aaaaaaaaaaa3",
|
|
43
46
|
firstName: "Alice",
|
|
44
47
|
lastName: "Agent",
|
|
45
|
-
nationalId: nid_2,
|
|
46
48
|
email: "alice@agent.com",
|
|
47
49
|
password: passwordHash,
|
|
50
|
+
gender: "female",
|
|
51
|
+
birthDate: 10,
|
|
52
|
+
birthMonth: 8,
|
|
53
|
+
birthYear: 1988,
|
|
48
54
|
securityClearanceId: "33333333-3333-3333-3333-333333333333", // AGENT
|
|
49
55
|
primaryPhoneId: null,
|
|
50
56
|
isActive: true,
|
|
@@ -55,9 +61,12 @@ module.exports = {
|
|
|
55
61
|
id: "aaaaaaa3-aaaa-aaaa-aaaa-aaaaaaaaaaa4",
|
|
56
62
|
firstName: "Eric",
|
|
57
63
|
lastName: "Admin",
|
|
58
|
-
nationalId: nid_3,
|
|
59
64
|
email: "eric@admin.com",
|
|
60
65
|
password: passwordHash,
|
|
66
|
+
gender: "male",
|
|
67
|
+
birthDate: 5,
|
|
68
|
+
birthMonth: 12,
|
|
69
|
+
birthYear: 1985,
|
|
61
70
|
securityClearanceId: "44444444-4444-4444-4444-444444444444", // ADMIN
|
|
62
71
|
primaryPhoneId: null,
|
|
63
72
|
isActive: true,
|
|
@@ -70,7 +79,10 @@ module.exports = {
|
|
|
70
79
|
lastName: "Admin",
|
|
71
80
|
email: "super@admin.com",
|
|
72
81
|
password: passwordHash,
|
|
73
|
-
|
|
82
|
+
gender: "male",
|
|
83
|
+
birthDate: 1,
|
|
84
|
+
birthMonth: 1,
|
|
85
|
+
birthYear: 1980,
|
|
74
86
|
securityClearanceId: "55555555-5555-5555-5555-555555555555", // SUPER_ADMIN
|
|
75
87
|
primaryPhoneId: null,
|
|
76
88
|
isActive: true,
|
package/package.json
CHANGED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
async up(queryInterface, Sequelize) {
|
|
5
|
-
await queryInterface.createTable("transactions", {
|
|
6
|
-
id: {
|
|
7
|
-
type: Sequelize.UUID,
|
|
8
|
-
defaultValue: Sequelize.UUIDV4,
|
|
9
|
-
primaryKey: true,
|
|
10
|
-
allowNull: false
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
userId: {
|
|
14
|
-
type: Sequelize.UUID,
|
|
15
|
-
allowNull: false,
|
|
16
|
-
references: {
|
|
17
|
-
model: "users",
|
|
18
|
-
key: "id"
|
|
19
|
-
},
|
|
20
|
-
onUpdate: "CASCADE",
|
|
21
|
-
onDelete: "RESTRICT"
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
paymentId: {
|
|
25
|
-
type: Sequelize.UUID,
|
|
26
|
-
allowNull: false,
|
|
27
|
-
references: {
|
|
28
|
-
model: "payments",
|
|
29
|
-
key: "id"
|
|
30
|
-
},
|
|
31
|
-
onUpdate: "CASCADE",
|
|
32
|
-
onDelete: "RESTRICT"
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
amount: {
|
|
36
|
-
type: Sequelize.FLOAT,
|
|
37
|
-
allowNull: false
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
status: {
|
|
41
|
-
type: Sequelize.ENUM("succeeded", "failed"),
|
|
42
|
-
allowNull: false
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
providerReference: {
|
|
46
|
-
type: Sequelize.STRING,
|
|
47
|
-
allowNull: false
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
metadata: {
|
|
51
|
-
type: Sequelize.JSONB,
|
|
52
|
-
allowNull: false,
|
|
53
|
-
defaultValue: {}
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
createdAt: {
|
|
57
|
-
type: Sequelize.DATE,
|
|
58
|
-
allowNull: false,
|
|
59
|
-
defaultValue: Sequelize.fn("NOW")
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
updatedAt: {
|
|
63
|
-
type: Sequelize.DATE,
|
|
64
|
-
allowNull: false,
|
|
65
|
-
defaultValue: Sequelize.fn("NOW")
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
await queryInterface.addIndex("transactions", ["userId"]);
|
|
70
|
-
await queryInterface.addIndex("transactions", ["paymentId"]);
|
|
71
|
-
await queryInterface.addIndex("transactions", ["status"]);
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
async down(queryInterface) {
|
|
75
|
-
await queryInterface.dropTable("transactions");
|
|
76
|
-
await queryInterface.sequelize.query(
|
|
77
|
-
'DROP TYPE IF EXISTS "enum_transactions_status";'
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
};
|