@javalabs/prisma-client 1.0.26 → 1.0.27
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/package.json +5 -5
- package/prisma/schema.prisma +0 -6
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -34
- package/dist/index.js.map +0 -1
- package/dist/prisma-factory.service.d.ts +0 -9
- package/dist/prisma-factory.service.js +0 -47
- package/dist/prisma-factory.service.js.map +0 -1
- package/dist/prisma.module.d.ts +0 -2
- package/dist/prisma.module.js +0 -23
- package/dist/prisma.module.js.map +0 -1
- package/dist/prisma.service.d.ts +0 -6
- package/dist/prisma.service.js +0 -27
- package/dist/prisma.service.js.map +0 -1
- package/dist/scripts/add-uuid-to-table.d.ts +0 -8
- package/dist/scripts/add-uuid-to-table.js +0 -98
- package/dist/scripts/add-uuid-to-table.js.map +0 -1
- package/dist/scripts/create-tenant-schemas.d.ts +0 -1
- package/dist/scripts/create-tenant-schemas.js +0 -117
- package/dist/scripts/create-tenant-schemas.js.map +0 -1
- package/dist/scripts/data-migration/batch-migrator.d.ts +0 -20
- package/dist/scripts/data-migration/batch-migrator.js +0 -134
- package/dist/scripts/data-migration/batch-migrator.js.map +0 -1
- package/dist/scripts/data-migration/data-transformer.d.ts +0 -26
- package/dist/scripts/data-migration/data-transformer.js +0 -278
- package/dist/scripts/data-migration/data-transformer.js.map +0 -1
- package/dist/scripts/data-migration/db-connector.d.ts +0 -12
- package/dist/scripts/data-migration/db-connector.js +0 -94
- package/dist/scripts/data-migration/db-connector.js.map +0 -1
- package/dist/scripts/data-migration/dependency-resolver.d.ts +0 -18
- package/dist/scripts/data-migration/dependency-resolver.js +0 -132
- package/dist/scripts/data-migration/dependency-resolver.js.map +0 -1
- package/dist/scripts/data-migration/entity-discovery.d.ts +0 -11
- package/dist/scripts/data-migration/entity-discovery.js +0 -152
- package/dist/scripts/data-migration/entity-discovery.js.map +0 -1
- package/dist/scripts/data-migration/foreign-key-manager.d.ts +0 -18
- package/dist/scripts/data-migration/foreign-key-manager.js +0 -160
- package/dist/scripts/data-migration/foreign-key-manager.js.map +0 -1
- package/dist/scripts/data-migration/migration-tool.d.ts +0 -48
- package/dist/scripts/data-migration/migration-tool.js +0 -290
- package/dist/scripts/data-migration/migration-tool.js.map +0 -1
- package/dist/scripts/data-migration/schema-utils.d.ts +0 -18
- package/dist/scripts/data-migration/schema-utils.js +0 -207
- package/dist/scripts/data-migration/schema-utils.js.map +0 -1
- package/dist/scripts/data-migration/tenant-migrator.d.ts +0 -15
- package/dist/scripts/data-migration/tenant-migrator.js +0 -117
- package/dist/scripts/data-migration/tenant-migrator.js.map +0 -1
- package/dist/scripts/data-migration/typecast-manager.d.ts +0 -9
- package/dist/scripts/data-migration/typecast-manager.js +0 -179
- package/dist/scripts/data-migration/typecast-manager.js.map +0 -1
- package/dist/scripts/data-migration/types.d.ts +0 -100
- package/dist/scripts/data-migration/types.js +0 -3
- package/dist/scripts/data-migration/types.js.map +0 -1
- package/dist/scripts/database-initializer.d.ts +0 -5
- package/dist/scripts/database-initializer.js +0 -45
- package/dist/scripts/database-initializer.js.map +0 -1
- package/dist/scripts/drop-database.d.ts +0 -10
- package/dist/scripts/drop-database.js +0 -81
- package/dist/scripts/drop-database.js.map +0 -1
- package/dist/scripts/encrypt-user-passwords.d.ts +0 -1
- package/dist/scripts/encrypt-user-passwords.js +0 -33
- package/dist/scripts/encrypt-user-passwords.js.map +0 -1
- package/dist/scripts/error-handler.d.ts +0 -12
- package/dist/scripts/error-handler.js +0 -82
- package/dist/scripts/error-handler.js.map +0 -1
- package/dist/scripts/fix-data-types.d.ts +0 -10
- package/dist/scripts/fix-data-types.js +0 -185
- package/dist/scripts/fix-data-types.js.map +0 -1
- package/dist/scripts/fix-enum-values.d.ts +0 -17
- package/dist/scripts/fix-enum-values.js +0 -234
- package/dist/scripts/fix-enum-values.js.map +0 -1
- package/dist/scripts/fix-schema-discrepancies.d.ts +0 -21
- package/dist/scripts/fix-schema-discrepancies.js +0 -240
- package/dist/scripts/fix-schema-discrepancies.js.map +0 -1
- package/dist/scripts/fix-table-indexes.d.ts +0 -26
- package/dist/scripts/fix-table-indexes.js +0 -460
- package/dist/scripts/fix-table-indexes.js.map +0 -1
- package/dist/scripts/migrate-schema-structure.d.ts +0 -1
- package/dist/scripts/migrate-schema-structure.js +0 -76
- package/dist/scripts/migrate-schema-structure.js.map +0 -1
- package/dist/scripts/migrate-uuid.d.ts +0 -2
- package/dist/scripts/migrate-uuid.js +0 -57
- package/dist/scripts/migrate-uuid.js.map +0 -1
- package/dist/scripts/post-migration-validator.d.ts +0 -34
- package/dist/scripts/post-migration-validator.js +0 -363
- package/dist/scripts/post-migration-validator.js.map +0 -1
- package/dist/scripts/pre-migration-validator.d.ts +0 -25
- package/dist/scripts/pre-migration-validator.js +0 -491
- package/dist/scripts/pre-migration-validator.js.map +0 -1
- package/dist/scripts/reset-database.d.ts +0 -17
- package/dist/scripts/reset-database.js +0 -202
- package/dist/scripts/reset-database.js.map +0 -1
- package/dist/scripts/retry-failed-migrations.d.ts +0 -14
- package/dist/scripts/retry-failed-migrations.js +0 -301
- package/dist/scripts/retry-failed-migrations.js.map +0 -1
- package/dist/scripts/run-migration.d.ts +0 -1
- package/dist/scripts/run-migration.js +0 -512
- package/dist/scripts/run-migration.js.map +0 -1
- package/dist/scripts/schema-sync.d.ts +0 -1
- package/dist/scripts/schema-sync.js +0 -85
- package/dist/scripts/schema-sync.js.map +0 -1
- package/dist/scripts/sequence-sync-cli.d.ts +0 -2
- package/dist/scripts/sequence-sync-cli.js +0 -287
- package/dist/scripts/sequence-sync-cli.js.map +0 -1
- package/dist/scripts/sequence-synchronizer.d.ts +0 -8
- package/dist/scripts/sequence-synchronizer.js +0 -88
- package/dist/scripts/sequence-synchronizer.js.map +0 -1
- package/dist/scripts/sync-enum-types.d.ts +0 -13
- package/dist/scripts/sync-enum-types.js +0 -139
- package/dist/scripts/sync-enum-types.js.map +0 -1
- package/dist/scripts/sync-enum-values.d.ts +0 -20
- package/dist/scripts/sync-enum-values.js +0 -336
- package/dist/scripts/sync-enum-values.js.map +0 -1
- package/dist/scripts/truncate-database.d.ts +0 -10
- package/dist/scripts/truncate-database.js +0 -100
- package/dist/scripts/truncate-database.js.map +0 -1
- package/dist/scripts/verify-migration-setup.d.ts +0 -11
- package/dist/scripts/verify-migration-setup.js +0 -120
- package/dist/scripts/verify-migration-setup.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/prisma/migrations/add_athena_match_fields.sql +0 -18
- package/prisma/migrations/add_bank_receipt_number.sql +0 -9
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
interface ValidationIssue {
|
|
2
|
-
type: string;
|
|
3
|
-
tenantId?: string;
|
|
4
|
-
providerId?: number | null;
|
|
5
|
-
message: string;
|
|
6
|
-
}
|
|
7
|
-
interface ValidationResult {
|
|
8
|
-
success: boolean;
|
|
9
|
-
issueCount: number;
|
|
10
|
-
timestamp: string;
|
|
11
|
-
sourceDatabase: string;
|
|
12
|
-
targetDatabase: string;
|
|
13
|
-
issues: ValidationIssue[];
|
|
14
|
-
}
|
|
15
|
-
export declare class PostMigrationValidator {
|
|
16
|
-
private readonly sourceUrl;
|
|
17
|
-
private readonly targetUrl;
|
|
18
|
-
private readonly logger;
|
|
19
|
-
private readonly sourcePool;
|
|
20
|
-
private readonly targetPool;
|
|
21
|
-
private readonly reportPath;
|
|
22
|
-
private issues;
|
|
23
|
-
constructor(sourceUrl?: string, targetUrl?: string);
|
|
24
|
-
validate(options?: {
|
|
25
|
-
publicOnly?: boolean;
|
|
26
|
-
}): Promise<ValidationResult>;
|
|
27
|
-
private validateTenantData;
|
|
28
|
-
private validateTableData;
|
|
29
|
-
private validateRandomRecords;
|
|
30
|
-
private areValuesDifferent;
|
|
31
|
-
private saveReport;
|
|
32
|
-
private cleanup;
|
|
33
|
-
}
|
|
34
|
-
export {};
|
|
@@ -1,363 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PostMigrationValidator = void 0;
|
|
4
|
-
const pg = require("pg");
|
|
5
|
-
const dotenv = require("dotenv");
|
|
6
|
-
const common_1 = require("@nestjs/common");
|
|
7
|
-
const fs = require("fs");
|
|
8
|
-
const path = require("path");
|
|
9
|
-
dotenv.config();
|
|
10
|
-
class PostMigrationValidator {
|
|
11
|
-
constructor(sourceUrl = process.env.SOURCE_DATABASE_URL, targetUrl = process.env.DATABASE_URL) {
|
|
12
|
-
this.sourceUrl = sourceUrl;
|
|
13
|
-
this.targetUrl = targetUrl;
|
|
14
|
-
this.logger = new common_1.Logger("PostMigrationValidator");
|
|
15
|
-
this.issues = [];
|
|
16
|
-
this.sourcePool = new pg.Pool({
|
|
17
|
-
connectionString: this.sourceUrl,
|
|
18
|
-
});
|
|
19
|
-
this.targetPool = new pg.Pool({
|
|
20
|
-
connectionString: this.targetUrl,
|
|
21
|
-
});
|
|
22
|
-
const reportsDir = path.join(process.cwd(), "migration-logs");
|
|
23
|
-
if (!fs.existsSync(reportsDir)) {
|
|
24
|
-
fs.mkdirSync(reportsDir, { recursive: true });
|
|
25
|
-
}
|
|
26
|
-
const timestamp = new Date()
|
|
27
|
-
.toISOString()
|
|
28
|
-
.replace(/:/g, "-")
|
|
29
|
-
.replace(/\..+/, "");
|
|
30
|
-
this.reportPath = path.join(reportsDir, `post-migration-report-${timestamp}.json`);
|
|
31
|
-
}
|
|
32
|
-
async validate(options) {
|
|
33
|
-
const issues = [];
|
|
34
|
-
const timestamp = new Date().toISOString();
|
|
35
|
-
try {
|
|
36
|
-
if (options === null || options === void 0 ? void 0 : options.publicOnly) {
|
|
37
|
-
this.logger.log("Running validation in public-only mode");
|
|
38
|
-
return {
|
|
39
|
-
success: true,
|
|
40
|
-
issueCount: 0,
|
|
41
|
-
timestamp,
|
|
42
|
-
sourceDatabase: process.env.SOURCE_DATABASE_URL,
|
|
43
|
-
targetDatabase: process.env.DATABASE_URL,
|
|
44
|
-
issues: [],
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
this.logger.log("Starting post-migration validation");
|
|
48
|
-
const apiKeysResult = await this.sourcePool.query(`
|
|
49
|
-
SELECT api_key, provider_id
|
|
50
|
-
FROM api_keys
|
|
51
|
-
`);
|
|
52
|
-
this.logger.log(`Found ${apiKeysResult.rows.length} API keys to validate`);
|
|
53
|
-
for (const apiKey of apiKeysResult.rows) {
|
|
54
|
-
const tenantId = apiKey.api_key;
|
|
55
|
-
const providerId = apiKey.provider_id;
|
|
56
|
-
await this.validateTenantData(tenantId, providerId);
|
|
57
|
-
}
|
|
58
|
-
this.saveReport();
|
|
59
|
-
this.logger.log(`Validation completed with ${this.issues.length} issues found`);
|
|
60
|
-
if (this.issues.length > 0) {
|
|
61
|
-
this.logger.log(`Check the full report at: ${this.reportPath}`);
|
|
62
|
-
this.logger.log("Sample issues:");
|
|
63
|
-
for (let i = 0; i < Math.min(5, this.issues.length); i++) {
|
|
64
|
-
const issue = this.issues[i];
|
|
65
|
-
this.logger.log(`- ${issue.type}: ${issue.message}`);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
this.logger.log("No issues found. Migration was successful.");
|
|
70
|
-
}
|
|
71
|
-
return {
|
|
72
|
-
success: this.issues.length === 0,
|
|
73
|
-
issueCount: this.issues.length,
|
|
74
|
-
timestamp,
|
|
75
|
-
sourceDatabase: this.sourceUrl,
|
|
76
|
-
targetDatabase: this.targetUrl,
|
|
77
|
-
issues: this.issues,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
catch (error) {
|
|
81
|
-
this.logger.error(`Error during validation: ${error.message}`, error.stack);
|
|
82
|
-
this.issues.push({
|
|
83
|
-
type: "VALIDATION_ERROR",
|
|
84
|
-
message: `Validation process failed: ${error.message}`,
|
|
85
|
-
details: error.stack,
|
|
86
|
-
});
|
|
87
|
-
this.saveReport();
|
|
88
|
-
return {
|
|
89
|
-
success: false,
|
|
90
|
-
issueCount: this.issues.length,
|
|
91
|
-
timestamp,
|
|
92
|
-
sourceDatabase: this.sourceUrl,
|
|
93
|
-
targetDatabase: this.targetUrl,
|
|
94
|
-
issues: this.issues,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
finally {
|
|
98
|
-
await this.cleanup();
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
async validateTenantData(tenantId, providerId) {
|
|
102
|
-
this.logger.log(`Validating data for tenant: ${tenantId} (Provider ID: ${providerId})`);
|
|
103
|
-
try {
|
|
104
|
-
const schemaExistsResult = await this.targetPool.query(`
|
|
105
|
-
SELECT 1
|
|
106
|
-
FROM information_schema.schemata
|
|
107
|
-
WHERE schema_name = $1
|
|
108
|
-
LIMIT 1
|
|
109
|
-
`, [tenantId]);
|
|
110
|
-
if (schemaExistsResult.rows.length === 0) {
|
|
111
|
-
this.logger.warn(`Schema ${tenantId} does not exist in target database`);
|
|
112
|
-
this.issues.push({
|
|
113
|
-
type: "MISSING_SCHEMA",
|
|
114
|
-
tenantId,
|
|
115
|
-
providerId,
|
|
116
|
-
message: `Schema ${tenantId} does not exist in target database. Migration failed for this tenant.`,
|
|
117
|
-
});
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
const tablesResult = await this.sourcePool.query(`
|
|
121
|
-
SELECT table_name
|
|
122
|
-
FROM information_schema.tables
|
|
123
|
-
WHERE table_schema = 'public'
|
|
124
|
-
AND table_type = 'BASE TABLE'
|
|
125
|
-
AND table_name NOT IN ('_prisma_migrations', 'api_keys')
|
|
126
|
-
`);
|
|
127
|
-
for (const tableRow of tablesResult.rows) {
|
|
128
|
-
const tableName = tableRow.table_name;
|
|
129
|
-
await this.validateTableData(tenantId, tableName, providerId);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
catch (error) {
|
|
133
|
-
this.logger.error(`Error validating tenant ${tenantId}: ${error.message}`);
|
|
134
|
-
this.issues.push({
|
|
135
|
-
type: "TENANT_VALIDATION_ERROR",
|
|
136
|
-
tenantId,
|
|
137
|
-
providerId,
|
|
138
|
-
message: `Error validating tenant ${tenantId}: ${error.message}`,
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
async validateTableData(tenantId, tableName, providerId) {
|
|
143
|
-
try {
|
|
144
|
-
let sourceCountQuery = `SELECT COUNT(*) as count FROM ${tableName}`;
|
|
145
|
-
const hasProviderIdResult = await this.sourcePool.query(`
|
|
146
|
-
SELECT 1
|
|
147
|
-
FROM information_schema.columns
|
|
148
|
-
WHERE table_schema = 'public'
|
|
149
|
-
AND table_name = $1
|
|
150
|
-
AND column_name = 'provider_id'
|
|
151
|
-
LIMIT 1
|
|
152
|
-
`, [tableName]);
|
|
153
|
-
if (hasProviderIdResult.rows.length > 0) {
|
|
154
|
-
sourceCountQuery += ` WHERE provider_id = ${providerId}`;
|
|
155
|
-
}
|
|
156
|
-
const sourceCountResult = await this.sourcePool.query(sourceCountQuery);
|
|
157
|
-
const sourceCount = parseInt(sourceCountResult.rows[0].count);
|
|
158
|
-
const targetCountQuery = `SELECT COUNT(*) as count FROM "${tenantId}"."${tableName}"`;
|
|
159
|
-
const targetCountResult = await this.targetPool.query(targetCountQuery);
|
|
160
|
-
const targetCount = parseInt(targetCountResult.rows[0].count);
|
|
161
|
-
const migrationPercentage = sourceCount > 0 ? (targetCount / sourceCount) * 100 : 100;
|
|
162
|
-
this.logger.log(`Table ${tableName} for tenant ${tenantId}: ${targetCount}/${sourceCount} records migrated (${migrationPercentage.toFixed(2)}%)`);
|
|
163
|
-
if (migrationPercentage < 95) {
|
|
164
|
-
this.issues.push({
|
|
165
|
-
type: "DATA_MISMATCH",
|
|
166
|
-
tenantId,
|
|
167
|
-
tableName,
|
|
168
|
-
sourceCount,
|
|
169
|
-
targetCount,
|
|
170
|
-
migrationPercentage: parseFloat(migrationPercentage.toFixed(2)),
|
|
171
|
-
message: `Table ${tableName} for tenant ${tenantId}: Only ${migrationPercentage.toFixed(2)}% of records were migrated (${targetCount}/${sourceCount})`,
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
if (targetCount > sourceCount) {
|
|
175
|
-
this.issues.push({
|
|
176
|
-
type: "EXCESS_DATA",
|
|
177
|
-
tenantId,
|
|
178
|
-
tableName,
|
|
179
|
-
sourceCount,
|
|
180
|
-
targetCount,
|
|
181
|
-
message: `Table ${tableName} for tenant ${tenantId}: Target has more records (${targetCount}) than source (${sourceCount})`,
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
if (sourceCount > 0 && targetCount > 0) {
|
|
185
|
-
await this.validateRandomRecords(tenantId, tableName, providerId);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
catch (error) {
|
|
189
|
-
this.logger.error(`Error validating table ${tableName} for tenant ${tenantId}: ${error.message}`);
|
|
190
|
-
this.issues.push({
|
|
191
|
-
type: "TABLE_VALIDATION_ERROR",
|
|
192
|
-
tenantId,
|
|
193
|
-
tableName,
|
|
194
|
-
message: `Error validating table ${tableName} for tenant ${tenantId}: ${error.message}`,
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
async validateRandomRecords(tenantId, tableName, providerId) {
|
|
199
|
-
try {
|
|
200
|
-
const primaryKeyResult = await this.sourcePool.query(`
|
|
201
|
-
SELECT kcu.column_name
|
|
202
|
-
FROM information_schema.table_constraints tc
|
|
203
|
-
JOIN information_schema.key_column_usage kcu
|
|
204
|
-
ON tc.constraint_name = kcu.constraint_name
|
|
205
|
-
AND tc.table_schema = kcu.table_schema
|
|
206
|
-
WHERE tc.constraint_type = 'PRIMARY KEY'
|
|
207
|
-
AND tc.table_schema = 'public'
|
|
208
|
-
AND tc.table_name = $1
|
|
209
|
-
LIMIT 1
|
|
210
|
-
`, [tableName]);
|
|
211
|
-
if (primaryKeyResult.rows.length === 0) {
|
|
212
|
-
this.logger.warn(`No primary key found for table ${tableName}`);
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
const primaryKeyColumn = primaryKeyResult.rows[0].column_name;
|
|
216
|
-
let randomRecordsQuery = `
|
|
217
|
-
SELECT *
|
|
218
|
-
FROM ${tableName}
|
|
219
|
-
`;
|
|
220
|
-
const hasProviderIdResult = await this.sourcePool.query(`
|
|
221
|
-
SELECT 1
|
|
222
|
-
FROM information_schema.columns
|
|
223
|
-
WHERE table_schema = 'public'
|
|
224
|
-
AND table_name = $1
|
|
225
|
-
AND column_name = 'provider_id'
|
|
226
|
-
LIMIT 1
|
|
227
|
-
`, [tableName]);
|
|
228
|
-
if (hasProviderIdResult.rows.length > 0) {
|
|
229
|
-
randomRecordsQuery += ` WHERE provider_id = ${providerId}`;
|
|
230
|
-
}
|
|
231
|
-
randomRecordsQuery += `
|
|
232
|
-
ORDER BY RANDOM()
|
|
233
|
-
LIMIT 5
|
|
234
|
-
`;
|
|
235
|
-
const randomRecordsResult = await this.sourcePool.query(randomRecordsQuery);
|
|
236
|
-
for (const sourceRecord of randomRecordsResult.rows) {
|
|
237
|
-
const primaryKeyValue = sourceRecord[primaryKeyColumn];
|
|
238
|
-
const targetRecordResult = await this.targetPool.query(`
|
|
239
|
-
SELECT *
|
|
240
|
-
FROM "${tenantId}"."${tableName}"
|
|
241
|
-
WHERE "${primaryKeyColumn}" = $1
|
|
242
|
-
LIMIT 1
|
|
243
|
-
`, [primaryKeyValue]);
|
|
244
|
-
if (targetRecordResult.rows.length === 0) {
|
|
245
|
-
this.issues.push({
|
|
246
|
-
type: "MISSING_RECORD",
|
|
247
|
-
tenantId,
|
|
248
|
-
tableName,
|
|
249
|
-
recordId: primaryKeyValue,
|
|
250
|
-
message: `Record with ID ${primaryKeyValue} in table ${tableName} for tenant ${tenantId} was not migrated`,
|
|
251
|
-
});
|
|
252
|
-
continue;
|
|
253
|
-
}
|
|
254
|
-
const targetRecord = targetRecordResult.rows[0];
|
|
255
|
-
for (const columnName in sourceRecord) {
|
|
256
|
-
if (columnName === "provider_id") {
|
|
257
|
-
continue;
|
|
258
|
-
}
|
|
259
|
-
if (!(columnName in targetRecord)) {
|
|
260
|
-
this.issues.push({
|
|
261
|
-
type: "MISSING_COLUMN",
|
|
262
|
-
tenantId,
|
|
263
|
-
tableName,
|
|
264
|
-
recordId: primaryKeyValue,
|
|
265
|
-
columnName,
|
|
266
|
-
message: `Column ${columnName} is missing in record with ID ${primaryKeyValue} in table ${tableName} for tenant ${tenantId}`,
|
|
267
|
-
});
|
|
268
|
-
continue;
|
|
269
|
-
}
|
|
270
|
-
const sourceValue = sourceRecord[columnName];
|
|
271
|
-
const targetValue = targetRecord[columnName];
|
|
272
|
-
if (this.areValuesDifferent(sourceValue, targetValue)) {
|
|
273
|
-
this.issues.push({
|
|
274
|
-
type: "VALUE_MISMATCH",
|
|
275
|
-
tenantId,
|
|
276
|
-
tableName,
|
|
277
|
-
recordId: primaryKeyValue,
|
|
278
|
-
columnName,
|
|
279
|
-
sourceValue,
|
|
280
|
-
targetValue,
|
|
281
|
-
message: `Value mismatch for column ${columnName} in record with ID ${primaryKeyValue} in table ${tableName} for tenant ${tenantId}: ${sourceValue} (source) vs ${targetValue} (target)`,
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
catch (error) {
|
|
288
|
-
this.logger.error(`Error validating random records for table ${tableName} in tenant ${tenantId}: ${error.message}`);
|
|
289
|
-
this.issues.push({
|
|
290
|
-
type: "RECORD_VALIDATION_ERROR",
|
|
291
|
-
tenantId,
|
|
292
|
-
tableName,
|
|
293
|
-
message: `Error validating random records for table ${tableName} in tenant ${tenantId}: ${error.message}`,
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
areValuesDifferent(sourceValue, targetValue) {
|
|
298
|
-
if (sourceValue == null && targetValue == null) {
|
|
299
|
-
return false;
|
|
300
|
-
}
|
|
301
|
-
if (sourceValue == null || targetValue == null) {
|
|
302
|
-
return true;
|
|
303
|
-
}
|
|
304
|
-
if (sourceValue instanceof Date && targetValue instanceof Date) {
|
|
305
|
-
return sourceValue.toISOString() !== targetValue.toISOString();
|
|
306
|
-
}
|
|
307
|
-
if (typeof sourceValue === "number" && typeof targetValue === "number") {
|
|
308
|
-
const epsilon = 0.0001;
|
|
309
|
-
return Math.abs(sourceValue - targetValue) > epsilon;
|
|
310
|
-
}
|
|
311
|
-
if (typeof sourceValue === "string" && typeof targetValue === "string") {
|
|
312
|
-
return sourceValue !== targetValue;
|
|
313
|
-
}
|
|
314
|
-
if (typeof sourceValue === "boolean" && typeof targetValue === "boolean") {
|
|
315
|
-
return sourceValue !== targetValue;
|
|
316
|
-
}
|
|
317
|
-
return String(sourceValue) !== String(targetValue);
|
|
318
|
-
}
|
|
319
|
-
saveReport() {
|
|
320
|
-
try {
|
|
321
|
-
const report = {
|
|
322
|
-
timestamp: new Date().toISOString(),
|
|
323
|
-
sourceDatabase: this.sourceUrl,
|
|
324
|
-
targetDatabase: this.targetUrl,
|
|
325
|
-
issueCount: this.issues.length,
|
|
326
|
-
issues: this.issues,
|
|
327
|
-
};
|
|
328
|
-
fs.writeFileSync(this.reportPath, JSON.stringify(report, null, 2), "utf8");
|
|
329
|
-
}
|
|
330
|
-
catch (error) {
|
|
331
|
-
this.logger.error(`Error saving validation report: ${error.message}`);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
async cleanup() {
|
|
335
|
-
this.logger.log("Cleaning up database connections");
|
|
336
|
-
await this.sourcePool.end();
|
|
337
|
-
await this.targetPool.end();
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
exports.PostMigrationValidator = PostMigrationValidator;
|
|
341
|
-
if (require.main === module) {
|
|
342
|
-
const run = async () => {
|
|
343
|
-
try {
|
|
344
|
-
const validator = new PostMigrationValidator();
|
|
345
|
-
const result = await validator.validate();
|
|
346
|
-
if (result.success) {
|
|
347
|
-
console.log("Post-migration validation successful! No issues found.");
|
|
348
|
-
process.exit(0);
|
|
349
|
-
}
|
|
350
|
-
else {
|
|
351
|
-
console.log(`Post-migration validation completed with ${result.issueCount} issues found.`);
|
|
352
|
-
console.log(JSON.stringify(result, null, 2));
|
|
353
|
-
process.exit(1);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
catch (error) {
|
|
357
|
-
console.error("Error:", error.message);
|
|
358
|
-
process.exit(1);
|
|
359
|
-
}
|
|
360
|
-
};
|
|
361
|
-
run();
|
|
362
|
-
}
|
|
363
|
-
//# sourceMappingURL=post-migration-validator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"post-migration-validator.js","sourceRoot":"","sources":["../../src/scripts/post-migration-validator.ts"],"names":[],"mappings":";;;AAAA,yBAAyB;AACzB,iCAAiC;AACjC,2CAAwC;AACxC,yBAAyB;AACzB,6BAA6B;AAE7B,MAAM,CAAC,MAAM,EAAE,CAAC;AAkBhB,MAAa,sBAAsB;IAOjC,YACmB,YAAoB,OAAO,CAAC,GAAG,CAAC,mBAAmB,EACnD,YAAoB,OAAO,CAAC,GAAG,CAAC,YAAY;QAD5C,cAAS,GAAT,SAAS,CAA0C;QACnD,cAAS,GAAT,SAAS,CAAmC;QAR9C,WAAM,GAAG,IAAI,eAAM,CAAC,wBAAwB,CAAC,CAAC;QAIvD,WAAM,GAAU,EAAE,CAAC;QAMzB,IAAI,CAAC,UAAU,GAAG,IAAI,EAAE,CAAC,IAAI,CAAC;YAC5B,gBAAgB,EAAE,IAAI,CAAC,SAAS;SACjC,CAAC,CAAC;QAEH,IAAI,CAAC,UAAU,GAAG,IAAI,EAAE,CAAC,IAAI,CAAC;YAC5B,gBAAgB,EAAE,IAAI,CAAC,SAAS;SACjC,CAAC,CAAC;QAGH,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,gBAAgB,CAAC,CAAC;QAC9D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC/B,EAAE,CAAC,SAAS,CAAC,UAA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E,CAAC;QAC5B,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;IAC9B,CAAC;CACF;AA3dD,wDA2dC;AAGD,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,MAAM,GAAG,GAAG,KAAK,IAAI,EAAE;QACrB,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,IAAI,sBAAsB,EAAE,CAAC;YAC/C,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,QAAQ,EAAE,CAAC;YAE1C,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;gBACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,CACT,4CAA4C,MAAM,CAAC,UAAU,gBAAgB,CAC9E,CAAC;gBACF,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;gBAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACvC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC;IAEF,GAAG,EAAE,CAAC;AACR,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export declare class PreMigrationValidator {
|
|
2
|
-
private readonly sourceUrl;
|
|
3
|
-
private readonly targetUrl;
|
|
4
|
-
private readonly logger;
|
|
5
|
-
private readonly sourcePool;
|
|
6
|
-
private readonly targetPool;
|
|
7
|
-
private readonly reportPath;
|
|
8
|
-
private issues;
|
|
9
|
-
constructor(sourceUrl?: string, targetUrl?: string);
|
|
10
|
-
validate(): Promise<{
|
|
11
|
-
success: boolean;
|
|
12
|
-
issueCount: number;
|
|
13
|
-
reportPath: string;
|
|
14
|
-
}>;
|
|
15
|
-
private validateDatabaseConnections;
|
|
16
|
-
private validateApiKeys;
|
|
17
|
-
private validateDataTypeCompatibility;
|
|
18
|
-
private areTypesCompatible;
|
|
19
|
-
private validateColumnSizes;
|
|
20
|
-
private validateEnumValues;
|
|
21
|
-
private validateForeignKeyConstraints;
|
|
22
|
-
private validateUniqueConstraints;
|
|
23
|
-
private saveReport;
|
|
24
|
-
private cleanup;
|
|
25
|
-
}
|