@famgia/omnify-laravel 0.0.166 → 0.0.167

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.
@@ -1409,6 +1409,50 @@ function generateAlterMigrationContent(tableName, change, options = {}) {
1409
1409
  downLines.push(` $table->softDeletes();`);
1410
1410
  }
1411
1411
  }
1412
+ if (change.optionChanges.idType) {
1413
+ const { from, to } = change.optionChanges.idType;
1414
+ const fromType = from ?? "BigInt";
1415
+ const toType = to ?? "BigInt";
1416
+ const getColumnMethod = (type) => {
1417
+ switch (type) {
1418
+ case "Uuid":
1419
+ return "uuid";
1420
+ case "Int":
1421
+ return "unsignedInteger";
1422
+ case "String":
1423
+ return "string";
1424
+ default:
1425
+ return "unsignedBigInteger";
1426
+ }
1427
+ };
1428
+ const toMethod = getColumnMethod(toType);
1429
+ const fromMethod = getColumnMethod(fromType);
1430
+ upLines.push(` // Changing primary key type from ${fromType} to ${toType}`);
1431
+ upLines.push(` // Note: This requires doctrine/dbal package`);
1432
+ if (toType === "Uuid") {
1433
+ upLines.push(` $table->dropPrimary('id');`);
1434
+ upLines.push(` $table->uuid('id')->change();`);
1435
+ upLines.push(` $table->primary('id');`);
1436
+ } else if (fromType === "Uuid") {
1437
+ upLines.push(` $table->dropPrimary('id');`);
1438
+ upLines.push(` $table->${toMethod}('id')->change();`);
1439
+ upLines.push(` $table->primary('id');`);
1440
+ } else {
1441
+ upLines.push(` $table->${toMethod}('id')->change();`);
1442
+ }
1443
+ downLines.push(` // Reverting primary key type from ${toType} to ${fromType}`);
1444
+ if (fromType === "Uuid") {
1445
+ downLines.push(` $table->dropPrimary('id');`);
1446
+ downLines.push(` $table->uuid('id')->change();`);
1447
+ downLines.push(` $table->primary('id');`);
1448
+ } else if (toType === "Uuid") {
1449
+ downLines.push(` $table->dropPrimary('id');`);
1450
+ downLines.push(` $table->${fromMethod}('id')->change();`);
1451
+ downLines.push(` $table->primary('id');`);
1452
+ } else {
1453
+ downLines.push(` $table->${fromMethod}('id')->change();`);
1454
+ }
1455
+ }
1412
1456
  }
1413
1457
  const connection = options.connection ? `
1414
1458
  protected $connection = '${options.connection}';
@@ -1460,7 +1504,7 @@ function generateAlterMigration(change, options = {}) {
1460
1504
  if (change.changeType !== "modified") {
1461
1505
  return null;
1462
1506
  }
1463
- const hasChanges = change.columnChanges && change.columnChanges.length > 0 || change.indexChanges && change.indexChanges.length > 0 || change.optionChanges && (change.optionChanges.timestamps || change.optionChanges.softDelete);
1507
+ const hasChanges = change.columnChanges && change.columnChanges.length > 0 || change.indexChanges && change.indexChanges.length > 0 || change.optionChanges && (change.optionChanges.timestamps || change.optionChanges.softDelete || change.optionChanges.idType);
1464
1508
  if (!hasChanges) {
1465
1509
  return null;
1466
1510
  }
@@ -2596,7 +2640,10 @@ class {{CLASS_NAME}}Locales
2596
2640
  return stubs[stubName] ?? "";
2597
2641
  }
2598
2642
  function generateServiceProvider(schemas, options, stubContent) {
2599
- const morphMap = Object.values(schemas).filter((s) => s.kind !== "enum" && s.kind !== "partial" && s.options?.hidden !== true).map((s) => {
2643
+ const morphMap = Object.values(schemas).filter(
2644
+ (s) => s.kind !== "enum" && s.kind !== "partial" && s.options?.hidden !== true && !s.packageOutput
2645
+ // Skip schemas from external packages (additionalSchemaPaths)
2646
+ ).map((s) => {
2600
2647
  const className = toPascalCase(s.name);
2601
2648
  return ` '${s.name}' => \\${options.modelNamespace}\\${className}::class,`;
2602
2649
  }).join("\n");
@@ -5270,4 +5317,4 @@ export {
5270
5317
  shouldGenerateAIGuides,
5271
5318
  laravelPlugin
5272
5319
  };
5273
- //# sourceMappingURL=chunk-CB3WDQMR.js.map
5320
+ //# sourceMappingURL=chunk-SMMOFVZD.js.map