@javalabs/prisma-client 1.0.3 → 1.0.6
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/scripts/data-migration/batch-migrator.d.ts +14 -19
- package/dist/scripts/data-migration/batch-migrator.js +98 -297
- package/dist/scripts/data-migration/batch-migrator.js.map +1 -1
- package/dist/scripts/data-migration/data-transformer.d.ts +16 -7
- package/dist/scripts/data-migration/data-transformer.js +169 -133
- package/dist/scripts/data-migration/data-transformer.js.map +1 -1
- package/dist/scripts/data-migration/db-connector.d.ts +6 -1
- package/dist/scripts/data-migration/db-connector.js +44 -8
- package/dist/scripts/data-migration/db-connector.js.map +1 -1
- package/dist/scripts/data-migration/dependency-resolver.d.ts +10 -10
- package/dist/scripts/data-migration/dependency-resolver.js +92 -211
- package/dist/scripts/data-migration/dependency-resolver.js.map +1 -1
- package/dist/scripts/data-migration/foreign-key-manager.d.ts +6 -5
- package/dist/scripts/data-migration/foreign-key-manager.js +108 -18
- package/dist/scripts/data-migration/foreign-key-manager.js.map +1 -1
- package/dist/scripts/data-migration/migration-config.json +63 -0
- package/dist/scripts/data-migration/migration-tool.d.ts +25 -6
- package/dist/scripts/data-migration/migration-tool.js +78 -38
- package/dist/scripts/data-migration/migration-tool.js.map +1 -1
- package/dist/scripts/data-migration/multi-source-migrator.d.ts +17 -0
- package/dist/scripts/data-migration/multi-source-migrator.js +130 -0
- package/dist/scripts/data-migration/multi-source-migrator.js.map +1 -0
- package/dist/scripts/data-migration/schema-utils.d.ts +3 -3
- package/dist/scripts/data-migration/schema-utils.js +62 -19
- package/dist/scripts/data-migration/schema-utils.js.map +1 -1
- package/dist/scripts/data-migration/tenant-migrator.js +9 -2
- package/dist/scripts/data-migration/tenant-migrator.js.map +1 -1
- package/dist/scripts/data-migration/typecast-manager.d.ts +7 -3
- package/dist/scripts/data-migration/typecast-manager.js +169 -25
- package/dist/scripts/data-migration/typecast-manager.js.map +1 -1
- package/dist/scripts/data-migration/types.d.ts +68 -2
- package/dist/scripts/fix-table-indexes.d.ts +26 -0
- package/dist/scripts/fix-table-indexes.js +460 -0
- package/dist/scripts/fix-table-indexes.js.map +1 -0
- package/dist/scripts/multi-db-migration.d.ts +1 -0
- package/dist/scripts/multi-db-migration.js +55 -0
- package/dist/scripts/multi-db-migration.js.map +1 -0
- package/dist/scripts/run-migration.js +41 -75
- package/dist/scripts/run-migration.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/migration-config.json +40 -72
- package/{migration-config-public.json → migration-config.json.bk} +14 -14
- package/package.json +6 -3
- package/prisma/migrations/20250422001248_add_bank_account_id/migration.sql +458 -0
- package/prisma/migrations/20250422001957_add_bank_account_id_relations/migration.sql +14 -0
- package/prisma/schema.prisma +13 -12
- package/src/scripts/data-migration/batch-migrator.ts +192 -513
- package/src/scripts/data-migration/data-transformer.ts +252 -203
- package/src/scripts/data-migration/db-connector.ts +66 -13
- package/src/scripts/data-migration/dependency-resolver.ts +121 -266
- package/src/scripts/data-migration/foreign-key-manager.ts +214 -32
- package/src/scripts/data-migration/migration-config.json +63 -0
- package/src/scripts/data-migration/migration-tool.ts +377 -225
- package/src/scripts/data-migration/schema-utils.ts +94 -32
- package/src/scripts/data-migration/tenant-migrator.ts +12 -5
- package/src/scripts/data-migration/typecast-manager.ts +186 -31
- package/src/scripts/data-migration/types.ts +78 -5
- package/src/scripts/dumps/source_dump_20250428_145606.sql +323 -0
- package/src/scripts/fix-table-indexes.ts +602 -0
- package/src/scripts/post-migration-validator.ts +206 -107
- package/src/scripts/run-migration.ts +87 -101
package/migration-config.json
CHANGED
|
@@ -1,95 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"commonSchema": "public",
|
|
3
3
|
"tenantInfo": {
|
|
4
|
-
"sourceTable": "
|
|
5
|
-
"tenantIdColumn": "
|
|
4
|
+
"sourceTable": "users",
|
|
5
|
+
"tenantIdColumn": "user_id",
|
|
6
6
|
"providerIdColumn": "provider_id"
|
|
7
7
|
},
|
|
8
|
+
"migrationPriorities": {
|
|
9
|
+
"high": ["countries", "providers", "users", "api_keys"],
|
|
10
|
+
"medium": ["transactions", "charges", "balances"],
|
|
11
|
+
"low": ["invoices", "api_request_logs"]
|
|
12
|
+
},
|
|
8
13
|
"tables": {
|
|
9
|
-
"countries": {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"banks": { "type": "public", "idField": "id" },
|
|
13
|
-
"api_keys": { "type": "public", "idField": "id" },
|
|
14
|
-
"transactions": {
|
|
15
|
-
"type": "tenant",
|
|
16
|
-
"idField": "id",
|
|
17
|
-
"filterColumn": "provider_id"
|
|
18
|
-
},
|
|
19
|
-
"invoices": {
|
|
20
|
-
"type": "tenant",
|
|
21
|
-
"idField": "id",
|
|
22
|
-
"filterColumn": "transaction_id",
|
|
23
|
-
"via": "transactions"
|
|
24
|
-
},
|
|
25
|
-
"balances": {
|
|
26
|
-
"type": "tenant",
|
|
27
|
-
"idField": "id",
|
|
28
|
-
"filterColumn": "user_id",
|
|
29
|
-
"via": "users"
|
|
30
|
-
},
|
|
31
|
-
"charges": {
|
|
32
|
-
"type": "tenant",
|
|
33
|
-
"idField": "id",
|
|
34
|
-
"filterColumn": "reference",
|
|
35
|
-
"via": "transactions"
|
|
14
|
+
"countries": {
|
|
15
|
+
"type": "public",
|
|
16
|
+
"idField": "id"
|
|
36
17
|
},
|
|
37
|
-
"
|
|
38
|
-
"type": "
|
|
39
|
-
"idField": "
|
|
40
|
-
"
|
|
41
|
-
},
|
|
42
|
-
"api_request_logs": {
|
|
43
|
-
"type": "tenant",
|
|
44
|
-
"idField": "id",
|
|
45
|
-
"filterColumn": "api_key",
|
|
46
|
-
"via": "api_keys"
|
|
47
|
-
},
|
|
48
|
-
"credit_requests": {
|
|
49
|
-
"type": "tenant",
|
|
50
|
-
"idField": "id",
|
|
51
|
-
"filterColumn": "user_id",
|
|
52
|
-
"via": "users"
|
|
18
|
+
"providers": {
|
|
19
|
+
"type": "public",
|
|
20
|
+
"idField": "provider_id",
|
|
21
|
+
"dependencies": ["countries"]
|
|
53
22
|
},
|
|
54
|
-
"
|
|
55
|
-
"type": "
|
|
56
|
-
"idField": "
|
|
57
|
-
"
|
|
58
|
-
"via": "users"
|
|
23
|
+
"users": {
|
|
24
|
+
"type": "public",
|
|
25
|
+
"idField": "user_id",
|
|
26
|
+
"dependencies": ["providers"]
|
|
59
27
|
},
|
|
60
|
-
"
|
|
61
|
-
"type": "
|
|
28
|
+
"api_keys": {
|
|
29
|
+
"type": "public",
|
|
62
30
|
"idField": "id",
|
|
63
|
-
"
|
|
64
|
-
"via": "transactions"
|
|
31
|
+
"dependencies": ["users"]
|
|
65
32
|
},
|
|
66
|
-
"
|
|
67
|
-
"type": "
|
|
33
|
+
"transactions": {
|
|
34
|
+
"type": "public",
|
|
68
35
|
"idField": "id",
|
|
69
|
-
"filterColumn": "provider_id"
|
|
36
|
+
"filterColumn": "provider_id",
|
|
37
|
+
"dependencies": ["users", "providers"]
|
|
70
38
|
},
|
|
71
|
-
"
|
|
72
|
-
"type": "
|
|
39
|
+
"charges": {
|
|
40
|
+
"type": "public",
|
|
73
41
|
"idField": "id",
|
|
74
|
-
"filterColumn": "
|
|
75
|
-
"
|
|
42
|
+
"filterColumn": "provider_id",
|
|
43
|
+
"dependencies": ["transactions"]
|
|
76
44
|
},
|
|
77
|
-
"
|
|
78
|
-
"type": "
|
|
45
|
+
"invoices": {
|
|
46
|
+
"type": "public",
|
|
79
47
|
"idField": "id",
|
|
80
|
-
"filterColumn": "provider_id"
|
|
48
|
+
"filterColumn": "provider_id",
|
|
49
|
+
"dependencies": ["transactions", "charges"]
|
|
81
50
|
},
|
|
82
|
-
"
|
|
83
|
-
"type": "
|
|
51
|
+
"balances": {
|
|
52
|
+
"type": "public",
|
|
84
53
|
"idField": "id",
|
|
85
|
-
"filterColumn": "
|
|
86
|
-
"
|
|
54
|
+
"filterColumn": "provider_id",
|
|
55
|
+
"dependencies": ["users"]
|
|
87
56
|
},
|
|
88
|
-
"
|
|
89
|
-
"type": "
|
|
57
|
+
"api_request_logs": {
|
|
58
|
+
"type": "public",
|
|
90
59
|
"idField": "id",
|
|
91
|
-
"
|
|
92
|
-
"via": "transactions"
|
|
60
|
+
"dependencies": ["api_keys"]
|
|
93
61
|
}
|
|
94
62
|
}
|
|
95
63
|
}
|
|
@@ -12,81 +12,81 @@
|
|
|
12
12
|
"banks": { "type": "public", "idField": "id" },
|
|
13
13
|
"api_keys": { "type": "public", "idField": "id" },
|
|
14
14
|
"transactions": {
|
|
15
|
-
"type": "
|
|
15
|
+
"type": "tenant",
|
|
16
16
|
"idField": "id",
|
|
17
17
|
"filterColumn": "provider_id"
|
|
18
18
|
},
|
|
19
19
|
"invoices": {
|
|
20
|
-
"type": "
|
|
20
|
+
"type": "tenant",
|
|
21
21
|
"idField": "id",
|
|
22
22
|
"filterColumn": "transaction_id",
|
|
23
23
|
"via": "transactions"
|
|
24
24
|
},
|
|
25
25
|
"balances": {
|
|
26
|
-
"type": "
|
|
26
|
+
"type": "tenant",
|
|
27
27
|
"idField": "id",
|
|
28
28
|
"filterColumn": "user_id",
|
|
29
29
|
"via": "users"
|
|
30
30
|
},
|
|
31
31
|
"charges": {
|
|
32
|
-
"type": "
|
|
32
|
+
"type": "tenant",
|
|
33
33
|
"idField": "id",
|
|
34
34
|
"filterColumn": "reference",
|
|
35
35
|
"via": "transactions"
|
|
36
36
|
},
|
|
37
37
|
"payouts": {
|
|
38
|
-
"type": "
|
|
38
|
+
"type": "tenant",
|
|
39
39
|
"idField": "id",
|
|
40
40
|
"filterColumn": "provider_id"
|
|
41
41
|
},
|
|
42
42
|
"api_request_logs": {
|
|
43
|
-
"type": "
|
|
43
|
+
"type": "tenant",
|
|
44
44
|
"idField": "id",
|
|
45
45
|
"filterColumn": "api_key",
|
|
46
46
|
"via": "api_keys"
|
|
47
47
|
},
|
|
48
48
|
"credit_requests": {
|
|
49
|
-
"type": "
|
|
49
|
+
"type": "tenant",
|
|
50
50
|
"idField": "id",
|
|
51
51
|
"filterColumn": "user_id",
|
|
52
52
|
"via": "users"
|
|
53
53
|
},
|
|
54
54
|
"customers": {
|
|
55
|
-
"type": "
|
|
55
|
+
"type": "tenant",
|
|
56
56
|
"idField": "id",
|
|
57
57
|
"filterColumn": "user_id",
|
|
58
58
|
"via": "users"
|
|
59
59
|
},
|
|
60
60
|
"daily_logs": {
|
|
61
|
-
"type": "
|
|
61
|
+
"type": "tenant",
|
|
62
62
|
"idField": "id",
|
|
63
63
|
"filterColumn": "transaction_id",
|
|
64
64
|
"via": "transactions"
|
|
65
65
|
},
|
|
66
66
|
"global_user_transactions": {
|
|
67
|
-
"type": "
|
|
67
|
+
"type": "tenant",
|
|
68
68
|
"idField": "id",
|
|
69
69
|
"filterColumn": "provider_id"
|
|
70
70
|
},
|
|
71
71
|
"notifications": {
|
|
72
|
-
"type": "
|
|
72
|
+
"type": "tenant",
|
|
73
73
|
"idField": "id",
|
|
74
74
|
"filterColumn": "user_id",
|
|
75
75
|
"via": "users"
|
|
76
76
|
},
|
|
77
77
|
"pending_references": {
|
|
78
|
-
"type": "
|
|
78
|
+
"type": "tenant",
|
|
79
79
|
"idField": "id",
|
|
80
80
|
"filterColumn": "provider_id"
|
|
81
81
|
},
|
|
82
82
|
"toku": {
|
|
83
|
-
"type": "
|
|
83
|
+
"type": "tenant",
|
|
84
84
|
"idField": "id",
|
|
85
85
|
"filterColumn": "transaction_id",
|
|
86
86
|
"via": "transactions"
|
|
87
87
|
},
|
|
88
88
|
"transaction_updates": {
|
|
89
|
-
"type": "
|
|
89
|
+
"type": "tenant",
|
|
90
90
|
"idField": "id",
|
|
91
91
|
"filterColumn": "transaction_id",
|
|
92
92
|
"via": "transactions"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@javalabs/prisma-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Shared Prisma client for Tupay microservices",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,16 +14,19 @@
|
|
|
14
14
|
"migrate:data:yes": "node dist/scripts/run-migration.js migrate -y",
|
|
15
15
|
"postinstall": "npx prisma generate"
|
|
16
16
|
},
|
|
17
|
+
"prisma": {
|
|
18
|
+
"schema": "prisma/schema.prisma"
|
|
19
|
+
},
|
|
17
20
|
"keywords": [],
|
|
18
21
|
"author": "",
|
|
19
22
|
"license": "ISC",
|
|
20
23
|
"dependencies": {
|
|
21
24
|
"@nestjs/common": "^10.0.0",
|
|
22
25
|
"@nestjs/core": "^10.0.0",
|
|
23
|
-
"@prisma/client": "^
|
|
26
|
+
"@prisma/client": "^6.6.0",
|
|
24
27
|
"commander": "^11.1.0",
|
|
25
28
|
"dotenv": "^16.4.7",
|
|
26
|
-
"prisma": "^
|
|
29
|
+
"prisma": "^6.6.0",
|
|
27
30
|
"pg": "^8.14.1"
|
|
28
31
|
},
|
|
29
32
|
"devDependencies": {
|