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