relq 1.0.114 → 1.0.116

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.
@@ -253,6 +253,13 @@ async function runPush(config, projectRoot, opts = {}) {
253
253
  for (const rename of comparison.renamed.indexes) {
254
254
  console.log(` ${colors_1.colors.cyan('→')} index ${rename.from} → ${rename.to} ${colors_1.colors.muted('(rename index)')}`);
255
255
  }
256
+ const modifiedIndexesByTable = new Map();
257
+ for (const idx of comparison.modified.indexes) {
258
+ const list = modifiedIndexesByTable.get(idx.table) || [];
259
+ list.push(idx);
260
+ modifiedIndexesByTable.set(idx.table, list);
261
+ }
262
+ const shownModifiedIndexTables = new Set();
256
263
  for (const table of filteredDiff.tables) {
257
264
  if (renamedFromNames.has(table.name) || renamedToNames.has(table.name))
258
265
  continue;
@@ -283,12 +290,29 @@ async function runPush(config, projectRoot, opts = {}) {
283
290
  const prefix = idx.type === 'added' ? colors_1.colors.green('+') : idx.type === 'removed' ? colors_1.colors.red('-') : colors_1.colors.yellow('~');
284
291
  console.log(` ${prefix} index ${idx.name}`);
285
292
  }
293
+ const tableModifiedIndexes = modifiedIndexesByTable.get(table.name);
294
+ if (tableModifiedIndexes) {
295
+ for (const midx of tableModifiedIndexes) {
296
+ console.log(` ${colors_1.colors.yellow('~')} index ${midx.newIndex.name} ${colors_1.colors.muted(`(${midx.changes.join(', ')})`)}`);
297
+ }
298
+ shownModifiedIndexTables.add(table.name);
299
+ }
286
300
  for (const con of table.constraints || []) {
287
301
  const prefix = con.type === 'added' ? colors_1.colors.green('+') : con.type === 'removed' ? colors_1.colors.red('-') : colors_1.colors.yellow('~');
288
302
  console.log(` ${prefix} constraint ${con.name}`);
289
303
  }
290
304
  }
291
305
  }
306
+ for (const [tableName, indexes] of modifiedIndexesByTable) {
307
+ if (shownModifiedIndexTables.has(tableName))
308
+ continue;
309
+ if (renamedFromNames.has(tableName) || renamedToNames.has(tableName))
310
+ continue;
311
+ console.log(` ${colors_1.colors.yellow('~')} ${colors_1.colors.bold(tableName)}`);
312
+ for (const midx of indexes) {
313
+ console.log(` ${colors_1.colors.yellow('~')} index ${midx.newIndex.name} ${colors_1.colors.muted(`(${midx.changes.join(', ')})`)}`);
314
+ }
315
+ }
292
316
  for (const e of comparison.added.enums) {
293
317
  console.log(` ${colors_1.colors.green('+')} ${colors_1.colors.bold(e.name)} ${colors_1.colors.muted('(new enum)')}`);
294
318
  }
@@ -300,9 +324,6 @@ async function runPush(config, projectRoot, opts = {}) {
300
324
  const removed = e.changes.removed.length > 0 ? `-${e.changes.removed.join(',')}` : '';
301
325
  console.log(` ${colors_1.colors.yellow('~')} ${colors_1.colors.bold(e.name)} ${colors_1.colors.muted(`(enum: ${[added, removed].filter(Boolean).join(' ')})`)}`);
302
326
  }
303
- for (const idx of comparison.modified.indexes) {
304
- console.log(` ${colors_1.colors.yellow('~')} index ${colors_1.colors.bold(idx.newIndex.name)} ${colors_1.colors.muted(`(${idx.changes.join(', ')})`)}`);
305
- }
306
327
  for (const d of comparison.added.domains) {
307
328
  console.log(` ${colors_1.colors.green('+')} ${colors_1.colors.bold(d.name)} ${colors_1.colors.muted('(new domain)')}`);
308
329
  }
@@ -464,6 +485,35 @@ async function runPush(config, projectRoot, opts = {}) {
464
485
  }
465
486
  }
466
487
  }
488
+ const modifiedIdxCount = comparison.modified.indexes.length;
489
+ if (modifiedIdxCount > 0) {
490
+ let regIdxAdded = 0, regIdxRemoved = 0;
491
+ for (const t of summaryDiff.tables) {
492
+ for (const idx of t.indexes || []) {
493
+ if (idx.type === 'added')
494
+ regIdxAdded++;
495
+ else if (idx.type === 'removed')
496
+ regIdxRemoved++;
497
+ }
498
+ }
499
+ const idxParts = [];
500
+ if (regIdxAdded)
501
+ idxParts.push(colors_1.colors.green(`${regIdxAdded} added`));
502
+ if (modifiedIdxCount)
503
+ idxParts.push(colors_1.colors.yellow(`${modifiedIdxCount} modified`));
504
+ if (regIdxRemoved)
505
+ idxParts.push(colors_1.colors.red(`${regIdxRemoved} removed`));
506
+ if (idxParts.length > 0) {
507
+ const idxLine = ` ${colors_1.colors.muted('indexes:')} ${idxParts.join(', ')}`;
508
+ const idxLineIdx = summaryLines.findIndex(l => l.includes('indexes:'));
509
+ if (idxLineIdx >= 0) {
510
+ summaryLines[idxLineIdx] = idxLine;
511
+ }
512
+ else {
513
+ summaryLines.push(idxLine);
514
+ }
515
+ }
516
+ }
467
517
  const allSummaryLines = [...renameParts, ...summaryLines];
468
518
  if (allSummaryLines.length > 0) {
469
519
  for (const line of allSummaryLines)
@@ -647,12 +697,13 @@ async function runPush(config, projectRoot, opts = {}) {
647
697
  + comparison.removed.sequences.length + comparison.removed.compositeTypes.length
648
698
  + comparison.removed.views.length + comparison.removed.functions.length
649
699
  + comparison.removed.triggers.length + comparison.removed.extensions.length;
700
+ const sIdxModified = comparison.modified.indexes.length;
650
701
  const ddlModified = comparison.modified.enums.length;
651
702
  const totalRenamed = comparison.renamed.tables.length + comparison.renamed.columns.length
652
703
  + comparison.renamed.indexes.length + comparison.renamed.enums.length
653
704
  + comparison.renamed.sequences.length + comparison.renamed.functions.length;
654
705
  const totalAdded = sTablesAdded + sColsAdded + sIdxAdded + ddlAdded + renColAdded;
655
- const totalModified = sTablesModified + sColsModified + ddlModified + renColModified;
706
+ const totalModified = sTablesModified + sColsModified + sIdxModified + ddlModified + renColModified;
656
707
  const totalRemoved = sTablesRemoved + sColsRemoved + sIdxRemoved + ddlRemoved + renColRemoved;
657
708
  const parts = [];
658
709
  if (totalAdded > 0 || totalModified > 0 || totalRemoved > 0 || totalRenamed > 0) {
@@ -217,6 +217,13 @@ export async function runPush(config, projectRoot, opts = {}) {
217
217
  for (const rename of comparison.renamed.indexes) {
218
218
  console.log(` ${colors.cyan('→')} index ${rename.from} → ${rename.to} ${colors.muted('(rename index)')}`);
219
219
  }
220
+ const modifiedIndexesByTable = new Map();
221
+ for (const idx of comparison.modified.indexes) {
222
+ const list = modifiedIndexesByTable.get(idx.table) || [];
223
+ list.push(idx);
224
+ modifiedIndexesByTable.set(idx.table, list);
225
+ }
226
+ const shownModifiedIndexTables = new Set();
220
227
  for (const table of filteredDiff.tables) {
221
228
  if (renamedFromNames.has(table.name) || renamedToNames.has(table.name))
222
229
  continue;
@@ -247,12 +254,29 @@ export async function runPush(config, projectRoot, opts = {}) {
247
254
  const prefix = idx.type === 'added' ? colors.green('+') : idx.type === 'removed' ? colors.red('-') : colors.yellow('~');
248
255
  console.log(` ${prefix} index ${idx.name}`);
249
256
  }
257
+ const tableModifiedIndexes = modifiedIndexesByTable.get(table.name);
258
+ if (tableModifiedIndexes) {
259
+ for (const midx of tableModifiedIndexes) {
260
+ console.log(` ${colors.yellow('~')} index ${midx.newIndex.name} ${colors.muted(`(${midx.changes.join(', ')})`)}`);
261
+ }
262
+ shownModifiedIndexTables.add(table.name);
263
+ }
250
264
  for (const con of table.constraints || []) {
251
265
  const prefix = con.type === 'added' ? colors.green('+') : con.type === 'removed' ? colors.red('-') : colors.yellow('~');
252
266
  console.log(` ${prefix} constraint ${con.name}`);
253
267
  }
254
268
  }
255
269
  }
270
+ for (const [tableName, indexes] of modifiedIndexesByTable) {
271
+ if (shownModifiedIndexTables.has(tableName))
272
+ continue;
273
+ if (renamedFromNames.has(tableName) || renamedToNames.has(tableName))
274
+ continue;
275
+ console.log(` ${colors.yellow('~')} ${colors.bold(tableName)}`);
276
+ for (const midx of indexes) {
277
+ console.log(` ${colors.yellow('~')} index ${midx.newIndex.name} ${colors.muted(`(${midx.changes.join(', ')})`)}`);
278
+ }
279
+ }
256
280
  for (const e of comparison.added.enums) {
257
281
  console.log(` ${colors.green('+')} ${colors.bold(e.name)} ${colors.muted('(new enum)')}`);
258
282
  }
@@ -264,9 +288,6 @@ export async function runPush(config, projectRoot, opts = {}) {
264
288
  const removed = e.changes.removed.length > 0 ? `-${e.changes.removed.join(',')}` : '';
265
289
  console.log(` ${colors.yellow('~')} ${colors.bold(e.name)} ${colors.muted(`(enum: ${[added, removed].filter(Boolean).join(' ')})`)}`);
266
290
  }
267
- for (const idx of comparison.modified.indexes) {
268
- console.log(` ${colors.yellow('~')} index ${colors.bold(idx.newIndex.name)} ${colors.muted(`(${idx.changes.join(', ')})`)}`);
269
- }
270
291
  for (const d of comparison.added.domains) {
271
292
  console.log(` ${colors.green('+')} ${colors.bold(d.name)} ${colors.muted('(new domain)')}`);
272
293
  }
@@ -428,6 +449,35 @@ export async function runPush(config, projectRoot, opts = {}) {
428
449
  }
429
450
  }
430
451
  }
452
+ const modifiedIdxCount = comparison.modified.indexes.length;
453
+ if (modifiedIdxCount > 0) {
454
+ let regIdxAdded = 0, regIdxRemoved = 0;
455
+ for (const t of summaryDiff.tables) {
456
+ for (const idx of t.indexes || []) {
457
+ if (idx.type === 'added')
458
+ regIdxAdded++;
459
+ else if (idx.type === 'removed')
460
+ regIdxRemoved++;
461
+ }
462
+ }
463
+ const idxParts = [];
464
+ if (regIdxAdded)
465
+ idxParts.push(colors.green(`${regIdxAdded} added`));
466
+ if (modifiedIdxCount)
467
+ idxParts.push(colors.yellow(`${modifiedIdxCount} modified`));
468
+ if (regIdxRemoved)
469
+ idxParts.push(colors.red(`${regIdxRemoved} removed`));
470
+ if (idxParts.length > 0) {
471
+ const idxLine = ` ${colors.muted('indexes:')} ${idxParts.join(', ')}`;
472
+ const idxLineIdx = summaryLines.findIndex(l => l.includes('indexes:'));
473
+ if (idxLineIdx >= 0) {
474
+ summaryLines[idxLineIdx] = idxLine;
475
+ }
476
+ else {
477
+ summaryLines.push(idxLine);
478
+ }
479
+ }
480
+ }
431
481
  const allSummaryLines = [...renameParts, ...summaryLines];
432
482
  if (allSummaryLines.length > 0) {
433
483
  for (const line of allSummaryLines)
@@ -611,12 +661,13 @@ export async function runPush(config, projectRoot, opts = {}) {
611
661
  + comparison.removed.sequences.length + comparison.removed.compositeTypes.length
612
662
  + comparison.removed.views.length + comparison.removed.functions.length
613
663
  + comparison.removed.triggers.length + comparison.removed.extensions.length;
664
+ const sIdxModified = comparison.modified.indexes.length;
614
665
  const ddlModified = comparison.modified.enums.length;
615
666
  const totalRenamed = comparison.renamed.tables.length + comparison.renamed.columns.length
616
667
  + comparison.renamed.indexes.length + comparison.renamed.enums.length
617
668
  + comparison.renamed.sequences.length + comparison.renamed.functions.length;
618
669
  const totalAdded = sTablesAdded + sColsAdded + sIdxAdded + ddlAdded + renColAdded;
619
- const totalModified = sTablesModified + sColsModified + ddlModified + renColModified;
670
+ const totalModified = sTablesModified + sColsModified + sIdxModified + ddlModified + renColModified;
620
671
  const totalRemoved = sTablesRemoved + sColsRemoved + sIdxRemoved + ddlRemoved + renColRemoved;
621
672
  const parts = [];
622
673
  if (totalAdded > 0 || totalModified > 0 || totalRemoved > 0 || totalRenamed > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "relq",
3
- "version": "1.0.114",
3
+ "version": "1.0.116",
4
4
  "description": "The Fully-Typed PostgreSQL ORM for TypeScript",
5
5
  "author": "Olajide Mathew O. <olajide.mathew@yuniq.solutions>",
6
6
  "license": "MIT",