@kipicore/dbcore 1.1.478 → 1.1.480
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/db/psql/migrations/20260425000005-create_user_payouts.js +23 -1
- package/dist/db/psql/migrations/20260427122337-paidAmount_add_in_payout_transaction_histories.d.ts +2 -0
- package/dist/db/psql/migrations/{20260425000006-create_user_payout_details.js → 20260427122337-paidAmount_add_in_payout_transaction_histories.js} +6 -9
- package/dist/interfaces/payoutTransactionHistoryInterface.d.ts +2 -1
- package/dist/models/psql/payoutTransactionHistoryModel.d.ts +1 -0
- package/dist/models/psql/payoutTransactionHistoryModel.js +6 -0
- package/package.json +1 -1
- package/dist/db/psql/migrations/20260425000006-create_user_payout_details.d.ts +0 -2
|
@@ -3,11 +3,22 @@ module.exports = {
|
|
|
3
3
|
up: async (queryInterface, Sequelize) => {
|
|
4
4
|
const transaction = await queryInterface.sequelize.transaction();
|
|
5
5
|
try {
|
|
6
|
+
// First convert ENUM to STRING using explicit cast
|
|
7
|
+
await queryInterface.sequelize.query(`
|
|
8
|
+
ALTER TABLE "user_payouts"
|
|
9
|
+
ALTER COLUMN "type" DROP DEFAULT,
|
|
10
|
+
ALTER COLUMN "type" TYPE VARCHAR USING "type"::text;
|
|
11
|
+
`, { transaction });
|
|
12
|
+
// Then set new default value
|
|
6
13
|
await queryInterface.changeColumn('user_payouts', 'type', {
|
|
7
14
|
type: Sequelize.STRING,
|
|
8
|
-
allowNull:
|
|
15
|
+
allowNull: true,
|
|
9
16
|
defaultValue: 'NONE',
|
|
10
17
|
}, { transaction });
|
|
18
|
+
// Optional: Drop old enum type if no longer needed
|
|
19
|
+
await queryInterface.sequelize.query(`
|
|
20
|
+
DROP TYPE IF EXISTS "enum_user_payouts_type";
|
|
21
|
+
`, { transaction });
|
|
11
22
|
await transaction.commit();
|
|
12
23
|
}
|
|
13
24
|
catch (error) {
|
|
@@ -18,6 +29,17 @@ module.exports = {
|
|
|
18
29
|
down: async (queryInterface, Sequelize) => {
|
|
19
30
|
const transaction = await queryInterface.sequelize.transaction();
|
|
20
31
|
try {
|
|
32
|
+
// Recreate ENUM type
|
|
33
|
+
await queryInterface.sequelize.query(`
|
|
34
|
+
CREATE TYPE "enum_user_payouts_type" AS ENUM
|
|
35
|
+
('PERCENTAGE', 'HOURLY', 'MONTHLY', 'ANNUAL', 'NONE');
|
|
36
|
+
`, { transaction });
|
|
37
|
+
await queryInterface.sequelize.query(`
|
|
38
|
+
ALTER TABLE "user_payouts"
|
|
39
|
+
ALTER COLUMN "type" DROP DEFAULT,
|
|
40
|
+
ALTER COLUMN "type" TYPE "enum_user_payouts_type"
|
|
41
|
+
USING "type"::"enum_user_payouts_type";
|
|
42
|
+
`, { transaction });
|
|
21
43
|
await queryInterface.changeColumn('user_payouts', 'type', {
|
|
22
44
|
type: Sequelize.ENUM('PERCENTAGE', 'HOURLY', 'MONTHLY', 'ANNUAL', 'NONE'),
|
|
23
45
|
allowNull: false,
|
|
@@ -3,10 +3,10 @@ module.exports = {
|
|
|
3
3
|
up: async (queryInterface, Sequelize) => {
|
|
4
4
|
const transaction = await queryInterface.sequelize.transaction();
|
|
5
5
|
try {
|
|
6
|
-
await queryInterface.
|
|
7
|
-
type: Sequelize.
|
|
8
|
-
allowNull:
|
|
9
|
-
defaultValue:
|
|
6
|
+
await queryInterface.addColumn('payout_transaction_histories', 'paid_amount', {
|
|
7
|
+
type: Sequelize.FLOAT,
|
|
8
|
+
allowNull: true,
|
|
9
|
+
defaultValue: 0,
|
|
10
10
|
}, { transaction });
|
|
11
11
|
await transaction.commit();
|
|
12
12
|
}
|
|
@@ -15,13 +15,10 @@ module.exports = {
|
|
|
15
15
|
throw error;
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
-
down: async (queryInterface
|
|
18
|
+
down: async (queryInterface) => {
|
|
19
19
|
const transaction = await queryInterface.sequelize.transaction();
|
|
20
20
|
try {
|
|
21
|
-
await queryInterface.
|
|
22
|
-
type: Sequelize.ENUM('PERCENTAGE', 'HOURLY', 'MONTHLY', 'ANNUAL', 'NONE'),
|
|
23
|
-
allowNull: false,
|
|
24
|
-
}, { transaction });
|
|
21
|
+
await queryInterface.removeColumn('payout_transaction_histories', 'paid_amount', { transaction });
|
|
25
22
|
await transaction.commit();
|
|
26
23
|
}
|
|
27
24
|
catch (error) {
|
|
@@ -9,8 +9,9 @@ export interface IPayoutTransactionHistoryModelAttributes {
|
|
|
9
9
|
payableAmount: number;
|
|
10
10
|
additionalPayoutIds: string[];
|
|
11
11
|
paidDate?: Date;
|
|
12
|
-
payoutDate?:
|
|
12
|
+
payoutDate?: Date;
|
|
13
13
|
status?: PAYOUT_STATUS;
|
|
14
|
+
paidAmount: number;
|
|
14
15
|
createdBy?: string;
|
|
15
16
|
updatedBy?: string;
|
|
16
17
|
deletedBy?: string;
|
|
@@ -72,6 +72,12 @@ PayoutTransactionHistoryModel.init({
|
|
|
72
72
|
defaultValue: 0,
|
|
73
73
|
field: 'total_amount',
|
|
74
74
|
},
|
|
75
|
+
paidAmount: {
|
|
76
|
+
type: sequelize_1.DataTypes.FLOAT,
|
|
77
|
+
allowNull: true,
|
|
78
|
+
defaultValue: 0,
|
|
79
|
+
field: 'paid_amount',
|
|
80
|
+
},
|
|
75
81
|
payableAmount: {
|
|
76
82
|
type: sequelize_1.DataTypes.FLOAT,
|
|
77
83
|
allowNull: true,
|
package/package.json
CHANGED