@javalabs/prisma-client 1.0.4 → 1.0.8
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/database-initializer.d.ts +5 -0
- package/dist/scripts/database-initializer.js +45 -0
- package/dist/scripts/database-initializer.js.map +1 -0
- 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/post-migration-validator.d.ts +18 -5
- package/dist/scripts/post-migration-validator.js +61 -39
- package/dist/scripts/post-migration-validator.js.map +1 -1
- package/dist/scripts/run-migration.js +83 -96
- package/dist/scripts/run-migration.js.map +1 -1
- package/dist/scripts/sequence-synchronizer.d.ts +8 -0
- package/dist/scripts/sequence-synchronizer.js +88 -0
- package/dist/scripts/sequence-synchronizer.js.map +1 -0
- 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 +10 -3
- package/prisma/migrations/{20250422001248_add_bank_account_id → 0_init}/migration.sql +269 -47
- package/prisma/migrations/20250505171324_add_bank_owner_name_in_manual_transfer/migration.sql +2 -0
- package/prisma/migrations/20250505173850_add_method_name_in_manual_transfer/migration.sql +2 -0
- package/prisma/migrations/migration_lock.toml +2 -2
- package/prisma/schema.prisma +214 -77
- 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/database-initializer.ts +49 -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 +140 -124
- package/src/scripts/sequence-synchronizer.ts +127 -0
- package/prisma/migrations/20250422001957_add_bank_account_id_relations/migration.sql +0 -14
- package/src/scripts/dumps/source_dump_20250413_112626.sql +0 -1527
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,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@javalabs/prisma-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Shared Prisma client for Tupay microservices",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"private": false,
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "restricted"
|
|
10
|
+
},
|
|
7
11
|
"scripts": {
|
|
8
12
|
"build": "tsc",
|
|
9
13
|
"generate": "prisma generate",
|
|
@@ -14,16 +18,19 @@
|
|
|
14
18
|
"migrate:data:yes": "node dist/scripts/run-migration.js migrate -y",
|
|
15
19
|
"postinstall": "npx prisma generate"
|
|
16
20
|
},
|
|
21
|
+
"prisma": {
|
|
22
|
+
"schema": "prisma/schema.prisma"
|
|
23
|
+
},
|
|
17
24
|
"keywords": [],
|
|
18
25
|
"author": "",
|
|
19
26
|
"license": "ISC",
|
|
20
27
|
"dependencies": {
|
|
21
28
|
"@nestjs/common": "^10.0.0",
|
|
22
29
|
"@nestjs/core": "^10.0.0",
|
|
23
|
-
"@prisma/client": "^
|
|
30
|
+
"@prisma/client": "^6.6.0",
|
|
24
31
|
"commander": "^11.1.0",
|
|
25
32
|
"dotenv": "^16.4.7",
|
|
26
|
-
"prisma": "^
|
|
33
|
+
"prisma": "^6.6.0",
|
|
27
34
|
"pg": "^8.14.1"
|
|
28
35
|
},
|
|
29
36
|
"devDependencies": {
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
-- CreateEnum
|
|
2
|
+
CREATE TYPE "enum_account_type" AS ENUM ('checking', 'savings');
|
|
3
|
+
|
|
1
4
|
-- CreateEnum
|
|
2
5
|
CREATE TYPE "enum_charges_document_type" AS ENUM ('CC', 'CE', 'NIT', 'TI', 'PP');
|
|
3
6
|
|
|
4
7
|
-- CreateEnum
|
|
5
8
|
CREATE TYPE "enum_charges_user_type" AS ENUM ('NATURAL', 'LEGAL');
|
|
6
9
|
|
|
10
|
+
-- CreateEnum
|
|
11
|
+
CREATE TYPE "enum_toku_status" AS ENUM ('pending', 'paid', 'failed');
|
|
12
|
+
|
|
7
13
|
-- CreateEnum
|
|
8
14
|
CREATE TYPE "enum_transaction_status" AS ENUM ('pending', 'approved', 'rejected', 'paid', 'completed', 'failed', 'canceled', 'processed');
|
|
9
15
|
|
|
@@ -11,16 +17,40 @@ CREATE TYPE "enum_transaction_status" AS ENUM ('pending', 'approved', 'rejected'
|
|
|
11
17
|
CREATE TYPE "enum_transaction_type" AS ENUM ('payin', 'payout');
|
|
12
18
|
|
|
13
19
|
-- CreateEnum
|
|
14
|
-
CREATE TYPE "
|
|
20
|
+
CREATE TYPE "enum_users_role" AS ENUM ('user', 'admin');
|
|
15
21
|
|
|
16
22
|
-- CreateEnum
|
|
17
|
-
CREATE TYPE "
|
|
23
|
+
CREATE TYPE "enum_users_status" AS ENUM ('active', 'inactive');
|
|
18
24
|
|
|
19
25
|
-- CreateEnum
|
|
20
|
-
CREATE TYPE "
|
|
26
|
+
CREATE TYPE "enum_credit_requests_status" AS ENUM ('pending', 'approved', 'rejected');
|
|
21
27
|
|
|
22
28
|
-- CreateEnum
|
|
23
|
-
CREATE TYPE "
|
|
29
|
+
CREATE TYPE "enum_global_user_transactions_status" AS ENUM ('pending', 'approved', 'rejected');
|
|
30
|
+
|
|
31
|
+
-- CreateEnum
|
|
32
|
+
CREATE TYPE "enum_global_user_transactions_transaction_type" AS ENUM ('payin', 'payout');
|
|
33
|
+
|
|
34
|
+
-- CreateEnum
|
|
35
|
+
CREATE TYPE "enum_invoices_status" AS ENUM ('pending', 'paid', 'failed');
|
|
36
|
+
|
|
37
|
+
-- CreateEnum
|
|
38
|
+
CREATE TYPE "enum_pending_references_status" AS ENUM ('pending', 'processed');
|
|
39
|
+
|
|
40
|
+
-- CreateEnum
|
|
41
|
+
CREATE TYPE "enum_transaction_updates_new_status" AS ENUM ('approved', 'rejected');
|
|
42
|
+
|
|
43
|
+
-- CreateEnum
|
|
44
|
+
CREATE TYPE "enum_transactions_account_type" AS ENUM ('checking', 'savings');
|
|
45
|
+
|
|
46
|
+
-- CreateEnum
|
|
47
|
+
CREATE TYPE "enum_transactions_status" AS ENUM ('pending', 'approved', 'rejected', 'paid', 'completed', 'failed');
|
|
48
|
+
|
|
49
|
+
-- CreateEnum
|
|
50
|
+
CREATE TYPE "enum_transactions_transaction_type" AS ENUM ('payin', 'payout');
|
|
51
|
+
|
|
52
|
+
-- CreateEnum
|
|
53
|
+
CREATE TYPE "enum_transactions_user_type_account" AS ENUM ('checking', 'savings');
|
|
24
54
|
|
|
25
55
|
-- CreateTable
|
|
26
56
|
CREATE TABLE "api_keys" (
|
|
@@ -180,6 +210,39 @@ CREATE TABLE "invoices" (
|
|
|
180
210
|
CONSTRAINT "invoices_pkey" PRIMARY KEY ("id")
|
|
181
211
|
);
|
|
182
212
|
|
|
213
|
+
-- CreateTable
|
|
214
|
+
CREATE TABLE "manual_payments" (
|
|
215
|
+
"id" SERIAL NOT NULL,
|
|
216
|
+
"user_id" INTEGER NOT NULL,
|
|
217
|
+
"amount" DECIMAL(10,2) NOT NULL,
|
|
218
|
+
"currency" VARCHAR(10) NOT NULL,
|
|
219
|
+
"bank_transaction_id" VARCHAR(255),
|
|
220
|
+
"receipt_image_url" VARCHAR(255),
|
|
221
|
+
"notes" TEXT,
|
|
222
|
+
"status" "enum_transaction_status" NOT NULL DEFAULT 'pending',
|
|
223
|
+
"admin_notes" TEXT,
|
|
224
|
+
"processed_by" INTEGER,
|
|
225
|
+
"created_at" TIMESTAMPTZ(6) NOT NULL,
|
|
226
|
+
"processed_at" TIMESTAMPTZ(6),
|
|
227
|
+
"country_code" VARCHAR(10),
|
|
228
|
+
"bank_account_id" INTEGER,
|
|
229
|
+
|
|
230
|
+
CONSTRAINT "manual_payments_pkey" PRIMARY KEY ("id")
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
-- CreateTable
|
|
234
|
+
CREATE TABLE "manual_transfer_bank_acounts" (
|
|
235
|
+
"id" SERIAL NOT NULL,
|
|
236
|
+
"account_number" VARCHAR(255) NOT NULL,
|
|
237
|
+
"account_type" VARCHAR(255) NOT NULL,
|
|
238
|
+
"bank_name" VARCHAR(255) NOT NULL,
|
|
239
|
+
"country_code" VARCHAR(255) NOT NULL,
|
|
240
|
+
"created_at" TIMESTAMPTZ(6) NOT NULL,
|
|
241
|
+
"updated_at" TIMESTAMPTZ(6) NOT NULL,
|
|
242
|
+
|
|
243
|
+
CONSTRAINT "manual_transfer_bank_acounts_pkey" PRIMARY KEY ("id")
|
|
244
|
+
);
|
|
245
|
+
|
|
183
246
|
-- CreateTable
|
|
184
247
|
CREATE TABLE "notifications" (
|
|
185
248
|
"id" SERIAL NOT NULL,
|
|
@@ -294,67 +357,189 @@ CREATE TABLE "users" (
|
|
|
294
357
|
CONSTRAINT "users_pkey" PRIMARY KEY ("user_id")
|
|
295
358
|
);
|
|
296
359
|
|
|
297
|
-
--
|
|
298
|
-
CREATE
|
|
299
|
-
"id" SERIAL NOT NULL,
|
|
300
|
-
"user_id" INTEGER NOT NULL,
|
|
301
|
-
"amount" DECIMAL(10,2) NOT NULL,
|
|
302
|
-
"currency" VARCHAR(10) NOT NULL,
|
|
303
|
-
"bank_account_id" INTEGER,
|
|
304
|
-
"bank_transaction_id" VARCHAR(255),
|
|
305
|
-
"receipt_image_url" VARCHAR(255),
|
|
306
|
-
"notes" TEXT,
|
|
307
|
-
"status" "enum_transaction_status" NOT NULL DEFAULT 'pending',
|
|
308
|
-
"admin_notes" TEXT,
|
|
309
|
-
"processed_by" INTEGER,
|
|
310
|
-
"created_at" TIMESTAMPTZ(6) NOT NULL,
|
|
311
|
-
"processed_at" TIMESTAMPTZ(6),
|
|
312
|
-
"country_code" VARCHAR(10),
|
|
313
|
-
"usersUser_id" INTEGER,
|
|
360
|
+
-- CreateIndex
|
|
361
|
+
CREATE UNIQUE INDEX "api_keys_api_key_key" ON "api_keys"("api_key");
|
|
314
362
|
|
|
315
|
-
|
|
316
|
-
);
|
|
363
|
+
-- CreateIndex
|
|
364
|
+
CREATE INDEX "idx_api_keys_id" ON "api_keys"("id");
|
|
317
365
|
|
|
318
|
-
--
|
|
319
|
-
CREATE
|
|
320
|
-
"id" SERIAL NOT NULL,
|
|
321
|
-
"account_number" VARCHAR(255) NOT NULL,
|
|
322
|
-
"account_type" VARCHAR(255) NOT NULL,
|
|
323
|
-
"bank_name" VARCHAR(255) NOT NULL,
|
|
324
|
-
"country_code" VARCHAR(255) NOT NULL,
|
|
325
|
-
"created_at" TIMESTAMPTZ(6) NOT NULL,
|
|
326
|
-
"updated_at" TIMESTAMPTZ(6) NOT NULL,
|
|
366
|
+
-- CreateIndex
|
|
367
|
+
CREATE INDEX "idx_api_keys_provider_id" ON "api_keys"("provider_id");
|
|
327
368
|
|
|
328
|
-
|
|
329
|
-
);
|
|
369
|
+
-- CreateIndex
|
|
370
|
+
CREATE INDEX "idx_api_keys_user_id" ON "api_keys"("user_id");
|
|
330
371
|
|
|
331
372
|
-- CreateIndex
|
|
332
|
-
CREATE
|
|
373
|
+
CREATE INDEX "idx_api_request_logs_id" ON "api_request_logs"("id");
|
|
374
|
+
|
|
375
|
+
-- CreateIndex
|
|
376
|
+
CREATE INDEX "idx_api_request_logs_status_code" ON "api_request_logs"("status_code");
|
|
377
|
+
|
|
378
|
+
-- CreateIndex
|
|
379
|
+
CREATE INDEX "idx_balances_id" ON "balances"("id");
|
|
380
|
+
|
|
381
|
+
-- CreateIndex
|
|
382
|
+
CREATE INDEX "idx_balances_user_id" ON "balances"("user_id");
|
|
383
|
+
|
|
384
|
+
-- CreateIndex
|
|
385
|
+
CREATE INDEX "idx_banks_code" ON "banks"("code");
|
|
386
|
+
|
|
387
|
+
-- CreateIndex
|
|
388
|
+
CREATE INDEX "idx_banks_country_code" ON "banks"("country_code");
|
|
389
|
+
|
|
390
|
+
-- CreateIndex
|
|
391
|
+
CREATE INDEX "idx_banks_id" ON "banks"("id");
|
|
333
392
|
|
|
334
393
|
-- CreateIndex
|
|
335
394
|
CREATE UNIQUE INDEX "charges_order_id" ON "charges"("order_id");
|
|
336
395
|
|
|
396
|
+
-- CreateIndex
|
|
397
|
+
CREATE INDEX "idx_charges_bank_code" ON "charges"("bank_code");
|
|
398
|
+
|
|
399
|
+
-- CreateIndex
|
|
400
|
+
CREATE INDEX "idx_charges_created_at" ON "charges"("created_at");
|
|
401
|
+
|
|
402
|
+
-- CreateIndex
|
|
403
|
+
CREATE INDEX "idx_charges_id" ON "charges"("id");
|
|
404
|
+
|
|
405
|
+
-- CreateIndex
|
|
406
|
+
CREATE INDEX "idx_charges_order_id" ON "charges"("order_id");
|
|
407
|
+
|
|
408
|
+
-- CreateIndex
|
|
409
|
+
CREATE INDEX "idx_charges_return_code" ON "charges"("return_code");
|
|
410
|
+
|
|
411
|
+
-- CreateIndex
|
|
412
|
+
CREATE INDEX "idx_charges_traceability_code" ON "charges"("traceability_code");
|
|
413
|
+
|
|
337
414
|
-- CreateIndex
|
|
338
415
|
CREATE UNIQUE INDEX "countries_code_key" ON "countries"("code");
|
|
339
416
|
|
|
340
417
|
-- CreateIndex
|
|
341
418
|
CREATE UNIQUE INDEX "countries_currencyCode_key" ON "countries"("currencyCode");
|
|
342
419
|
|
|
420
|
+
-- CreateIndex
|
|
421
|
+
CREATE INDEX "idx_countries_code" ON "countries"("code");
|
|
422
|
+
|
|
423
|
+
-- CreateIndex
|
|
424
|
+
CREATE INDEX "idx_countries_id" ON "countries"("id");
|
|
425
|
+
|
|
426
|
+
-- CreateIndex
|
|
427
|
+
CREATE INDEX "idx_credit_requests_id" ON "credit_requests"("id");
|
|
428
|
+
|
|
429
|
+
-- CreateIndex
|
|
430
|
+
CREATE INDEX "idx_credit_requests_invoice_id" ON "credit_requests"("invoice_id");
|
|
431
|
+
|
|
432
|
+
-- CreateIndex
|
|
433
|
+
CREATE INDEX "idx_credit_requests_user_id" ON "credit_requests"("user_id");
|
|
434
|
+
|
|
343
435
|
-- CreateIndex
|
|
344
436
|
CREATE UNIQUE INDEX "customers_custom_id_key" ON "customers"("custom_id");
|
|
345
437
|
|
|
346
438
|
-- CreateIndex
|
|
347
439
|
CREATE UNIQUE INDEX "customers_mail_key" ON "customers"("mail");
|
|
348
440
|
|
|
441
|
+
-- CreateIndex
|
|
442
|
+
CREATE INDEX "idx_customers_created_at" ON "customers"("created_at");
|
|
443
|
+
|
|
444
|
+
-- CreateIndex
|
|
445
|
+
CREATE INDEX "idx_customers_custom_id" ON "customers"("custom_id");
|
|
446
|
+
|
|
447
|
+
-- CreateIndex
|
|
448
|
+
CREATE INDEX "idx_customers_id" ON "customers"("id");
|
|
449
|
+
|
|
450
|
+
-- CreateIndex
|
|
451
|
+
CREATE INDEX "idx_customers_user_id" ON "customers"("user_id");
|
|
452
|
+
|
|
453
|
+
-- CreateIndex
|
|
454
|
+
CREATE INDEX "idx_daily_logs_id" ON "daily_logs"("id");
|
|
455
|
+
|
|
456
|
+
-- CreateIndex
|
|
457
|
+
CREATE INDEX "idx_daily_logs_transaction_id" ON "daily_logs"("transaction_id");
|
|
458
|
+
|
|
459
|
+
-- CreateIndex
|
|
460
|
+
CREATE INDEX "idx_global_user_transactions_id" ON "global_user_transactions"("id");
|
|
461
|
+
|
|
462
|
+
-- CreateIndex
|
|
463
|
+
CREATE INDEX "idx_global_user_transactions_provider_id" ON "global_user_transactions"("provider_id");
|
|
464
|
+
|
|
465
|
+
-- CreateIndex
|
|
466
|
+
CREATE INDEX "idx_global_user_transactions_transaction_id" ON "global_user_transactions"("transaction_id");
|
|
467
|
+
|
|
468
|
+
-- CreateIndex
|
|
469
|
+
CREATE INDEX "idx_global_user_transactions_user_id" ON "global_user_transactions"("user_id");
|
|
470
|
+
|
|
349
471
|
-- CreateIndex
|
|
350
472
|
CREATE UNIQUE INDEX "invoices_reference_key" ON "invoices"("reference");
|
|
351
473
|
|
|
474
|
+
-- CreateIndex
|
|
475
|
+
CREATE INDEX "idx_invoices_id" ON "invoices"("id");
|
|
476
|
+
|
|
477
|
+
-- CreateIndex
|
|
478
|
+
CREATE INDEX "idx_invoices_transaction_id" ON "invoices"("transaction_id");
|
|
479
|
+
|
|
352
480
|
-- CreateIndex
|
|
353
481
|
CREATE UNIQUE INDEX "invoices_id_transaction_id" ON "invoices"("id", "transaction_id");
|
|
354
482
|
|
|
483
|
+
-- CreateIndex
|
|
484
|
+
CREATE INDEX "idx_manual_payments_bank_account_id" ON "manual_payments"("bank_account_id");
|
|
485
|
+
|
|
486
|
+
-- CreateIndex
|
|
487
|
+
CREATE INDEX "idx_manual_payments_bank_transaction_id" ON "manual_payments"("bank_transaction_id");
|
|
488
|
+
|
|
489
|
+
-- CreateIndex
|
|
490
|
+
CREATE INDEX "idx_manual_payments_country_code" ON "manual_payments"("country_code");
|
|
491
|
+
|
|
492
|
+
-- CreateIndex
|
|
493
|
+
CREATE INDEX "idx_manual_payments_created_at" ON "manual_payments"("created_at");
|
|
494
|
+
|
|
495
|
+
-- CreateIndex
|
|
496
|
+
CREATE INDEX "idx_manual_payments_id" ON "manual_payments"("id");
|
|
497
|
+
|
|
498
|
+
-- CreateIndex
|
|
499
|
+
CREATE INDEX "idx_manual_payments_processed_by" ON "manual_payments"("processed_by");
|
|
500
|
+
|
|
501
|
+
-- CreateIndex
|
|
502
|
+
CREATE INDEX "idx_manual_payments_user_id" ON "manual_payments"("user_id");
|
|
503
|
+
|
|
504
|
+
-- CreateIndex
|
|
505
|
+
CREATE INDEX "idx_manual_transfer_bank_acounts_country_code" ON "manual_transfer_bank_acounts"("country_code");
|
|
506
|
+
|
|
507
|
+
-- CreateIndex
|
|
508
|
+
CREATE INDEX "idx_manual_transfer_bank_acounts_created_at" ON "manual_transfer_bank_acounts"("created_at");
|
|
509
|
+
|
|
510
|
+
-- CreateIndex
|
|
511
|
+
CREATE INDEX "idx_manual_transfer_bank_acounts_id" ON "manual_transfer_bank_acounts"("id");
|
|
512
|
+
|
|
513
|
+
-- CreateIndex
|
|
514
|
+
CREATE INDEX "idx_manual_transfer_bank_acounts_updated_at" ON "manual_transfer_bank_acounts"("updated_at");
|
|
515
|
+
|
|
516
|
+
-- CreateIndex
|
|
517
|
+
CREATE INDEX "idx_notifications_id" ON "notifications"("id");
|
|
518
|
+
|
|
519
|
+
-- CreateIndex
|
|
520
|
+
CREATE INDEX "idx_notifications_transaction_id" ON "notifications"("transaction_id");
|
|
521
|
+
|
|
522
|
+
-- CreateIndex
|
|
523
|
+
CREATE INDEX "idx_notifications_user_id" ON "notifications"("user_id");
|
|
524
|
+
|
|
525
|
+
-- CreateIndex
|
|
526
|
+
CREATE INDEX "idx_pending_references_id" ON "pending_references"("id");
|
|
527
|
+
|
|
528
|
+
-- CreateIndex
|
|
529
|
+
CREATE INDEX "idx_pending_references_provider_id" ON "pending_references"("provider_id");
|
|
530
|
+
|
|
531
|
+
-- CreateIndex
|
|
532
|
+
CREATE INDEX "idx_pending_references_user_id" ON "pending_references"("user_id");
|
|
533
|
+
|
|
355
534
|
-- CreateIndex
|
|
356
535
|
CREATE UNIQUE INDEX "providers_api_key_key" ON "providers"("api_key");
|
|
357
536
|
|
|
537
|
+
-- CreateIndex
|
|
538
|
+
CREATE INDEX "idx_providers_country_id" ON "providers"("country_id");
|
|
539
|
+
|
|
540
|
+
-- CreateIndex
|
|
541
|
+
CREATE INDEX "idx_providers_provider_id" ON "providers"("provider_id");
|
|
542
|
+
|
|
358
543
|
-- CreateIndex
|
|
359
544
|
CREATE UNIQUE INDEX "toku_customer_key" ON "toku"("customer");
|
|
360
545
|
|
|
@@ -373,14 +558,50 @@ CREATE UNIQUE INDEX "toku_mail_key" ON "toku"("mail");
|
|
|
373
558
|
-- CreateIndex
|
|
374
559
|
CREATE UNIQUE INDEX "toku_transaction_id_key" ON "toku"("transaction_id");
|
|
375
560
|
|
|
561
|
+
-- CreateIndex
|
|
562
|
+
CREATE INDEX "idx_toku_created_at" ON "toku"("created_at");
|
|
563
|
+
|
|
564
|
+
-- CreateIndex
|
|
565
|
+
CREATE INDEX "idx_toku_id" ON "toku"("id");
|
|
566
|
+
|
|
567
|
+
-- CreateIndex
|
|
568
|
+
CREATE INDEX "idx_toku_product_id" ON "toku"("product_id");
|
|
569
|
+
|
|
570
|
+
-- CreateIndex
|
|
571
|
+
CREATE INDEX "idx_toku_transaction_id" ON "toku"("transaction_id");
|
|
572
|
+
|
|
376
573
|
-- CreateIndex
|
|
377
574
|
CREATE UNIQUE INDEX "toku_id_transaction_id" ON "toku"("id", "transaction_id");
|
|
378
575
|
|
|
576
|
+
-- CreateIndex
|
|
577
|
+
CREATE INDEX "idx_transaction_updates_id" ON "transaction_updates"("id");
|
|
578
|
+
|
|
579
|
+
-- CreateIndex
|
|
580
|
+
CREATE INDEX "idx_transaction_updates_transaction_id" ON "transaction_updates"("transaction_id");
|
|
581
|
+
|
|
379
582
|
-- CreateIndex
|
|
380
583
|
CREATE UNIQUE INDEX "transactions_reference_key" ON "transactions"("reference");
|
|
381
584
|
|
|
382
585
|
-- CreateIndex
|
|
383
|
-
CREATE
|
|
586
|
+
CREATE INDEX "idx_transactions_custom_id" ON "transactions"("custom_id");
|
|
587
|
+
|
|
588
|
+
-- CreateIndex
|
|
589
|
+
CREATE INDEX "idx_transactions_id" ON "transactions"("id");
|
|
590
|
+
|
|
591
|
+
-- CreateIndex
|
|
592
|
+
CREATE INDEX "idx_transactions_provider_id" ON "transactions"("provider_id");
|
|
593
|
+
|
|
594
|
+
-- CreateIndex
|
|
595
|
+
CREATE INDEX "idx_transactions_user_id" ON "transactions"("user_id");
|
|
596
|
+
|
|
597
|
+
-- CreateIndex
|
|
598
|
+
CREATE UNIQUE INDEX "idx_users_email" ON "users"("email");
|
|
599
|
+
|
|
600
|
+
-- CreateIndex
|
|
601
|
+
CREATE INDEX "idx_users_country_id" ON "users"("country_id");
|
|
602
|
+
|
|
603
|
+
-- CreateIndex
|
|
604
|
+
CREATE INDEX "idx_users_user_id" ON "users"("user_id");
|
|
384
605
|
|
|
385
606
|
-- AddForeignKey
|
|
386
607
|
ALTER TABLE "api_keys" ADD CONSTRAINT "api_keys_provider_id_fkey" FOREIGN KEY ("provider_id") REFERENCES "providers"("provider_id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@@ -415,6 +636,18 @@ ALTER TABLE "global_user_transactions" ADD CONSTRAINT "global_user_transactions_
|
|
|
415
636
|
-- AddForeignKey
|
|
416
637
|
ALTER TABLE "invoices" ADD CONSTRAINT "invoices_transaction_id_fkey" FOREIGN KEY ("transaction_id") REFERENCES "transactions"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
417
638
|
|
|
639
|
+
-- AddForeignKey
|
|
640
|
+
ALTER TABLE "manual_payments" ADD CONSTRAINT "manual_payments_bank_account_id_fkey" FOREIGN KEY ("bank_account_id") REFERENCES "manual_transfer_bank_acounts"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
641
|
+
|
|
642
|
+
-- AddForeignKey
|
|
643
|
+
ALTER TABLE "manual_payments" ADD CONSTRAINT "manual_payments_processed_by_fkey" FOREIGN KEY ("processed_by") REFERENCES "users"("user_id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
644
|
+
|
|
645
|
+
-- AddForeignKey
|
|
646
|
+
ALTER TABLE "manual_payments" ADD CONSTRAINT "manual_payments_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("user_id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
647
|
+
|
|
648
|
+
-- AddForeignKey
|
|
649
|
+
ALTER TABLE "manual_transfer_bank_acounts" ADD CONSTRAINT "manual_transfer_bank_acounts_country_code_fkey" FOREIGN KEY ("country_code") REFERENCES "countries"("code") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
650
|
+
|
|
418
651
|
-- AddForeignKey
|
|
419
652
|
ALTER TABLE "notifications" ADD CONSTRAINT "notifications_transaction_id_fkey" FOREIGN KEY ("transaction_id") REFERENCES "transactions"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
420
653
|
|
|
@@ -445,14 +678,3 @@ ALTER TABLE "transactions" ADD CONSTRAINT "transactions_user_id_fkey" FOREIGN KE
|
|
|
445
678
|
-- AddForeignKey
|
|
446
679
|
ALTER TABLE "users" ADD CONSTRAINT "users_country_id_fkey" FOREIGN KEY ("country_id") REFERENCES "countries"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
447
680
|
|
|
448
|
-
-- AddForeignKey
|
|
449
|
-
ALTER TABLE "manual_payments" ADD CONSTRAINT "manual_payments_processed_by_fkey" FOREIGN KEY ("processed_by") REFERENCES "users"("user_id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
450
|
-
|
|
451
|
-
-- AddForeignKey
|
|
452
|
-
ALTER TABLE "manual_payments" ADD CONSTRAINT "manual_payments_usersUser_id_fkey" FOREIGN KEY ("usersUser_id") REFERENCES "users"("user_id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
453
|
-
|
|
454
|
-
-- AddForeignKey
|
|
455
|
-
ALTER TABLE "manual_payments" ADD CONSTRAINT "manual_payments_bank_account_id_fkey" FOREIGN KEY ("bank_account_id") REFERENCES "manual_transfer_bank_acounts"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
456
|
-
|
|
457
|
-
-- AddForeignKey
|
|
458
|
-
ALTER TABLE "manual_transfer_bank_acounts" ADD CONSTRAINT "manual_transfer_bank_acounts_country_code_fkey" FOREIGN KEY ("country_code") REFERENCES "countries"("code") ON DELETE RESTRICT ON UPDATE CASCADE;
|