@famgia/omnify-laravel 0.0.50 → 0.0.52

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/index.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  schemaToBlueprint,
23
23
  toColumnName,
24
24
  toTableName
25
- } from "./chunk-JCVJ7V7S.js";
25
+ } from "./chunk-VS3UOQWY.js";
26
26
  export {
27
27
  formatColumnMethod,
28
28
  formatForeignKey,
package/dist/plugin.cjs CHANGED
@@ -38,6 +38,7 @@ var TYPE_METHOD_MAP = {
38
38
  Decimal: "decimal",
39
39
  Boolean: "boolean",
40
40
  Text: "text",
41
+ MediumText: "mediumText",
41
42
  LongText: "longText",
42
43
  Date: "date",
43
44
  Time: "time",
@@ -876,12 +877,14 @@ function getMigrationPath(migration, outputDir = "database/migrations") {
876
877
  // src/migration/alter-generator.ts
877
878
  var TYPE_METHOD_MAP2 = {
878
879
  String: "string",
880
+ TinyInt: "tinyInteger",
879
881
  Int: "integer",
880
882
  BigInt: "bigInteger",
881
883
  Float: "double",
882
884
  Decimal: "decimal",
883
885
  Boolean: "boolean",
884
886
  Text: "text",
887
+ MediumText: "mediumText",
885
888
  LongText: "longText",
886
889
  Date: "date",
887
890
  Time: "time",
@@ -1330,10 +1333,28 @@ function generateEntityBaseModel(schema, schemas, options, stubContent, authStub
1330
1333
  const className = toPascalCase(schema.name);
1331
1334
  const tableName = schema.options?.tableName ?? pluralize(toSnakeCase(schema.name));
1332
1335
  const isAuth = schema.options?.authenticatable ?? false;
1333
- const primaryKey = "id";
1334
- const idType = schema.options?.idType ?? "BigInt";
1335
- const isUuid = idType === "Uuid";
1336
- const isStringKey = idType === "Uuid" || idType === "String";
1336
+ const hasAutoId2 = schema.options?.id !== false;
1337
+ let primaryKey = "id";
1338
+ let isStringKey = false;
1339
+ let isUuid = false;
1340
+ let isNonIncrementing = false;
1341
+ if (hasAutoId2) {
1342
+ const idType = schema.options?.idType ?? "BigInt";
1343
+ isUuid = idType === "Uuid";
1344
+ isStringKey = idType === "Uuid" || idType === "String";
1345
+ isNonIncrementing = isUuid;
1346
+ } else {
1347
+ const properties2 = schema.properties ?? {};
1348
+ for (const [propName, propDef] of Object.entries(properties2)) {
1349
+ if (propDef.primary === true) {
1350
+ primaryKey = toSnakeCase(propName);
1351
+ const propType = propDef.type;
1352
+ isStringKey = propType === "String" || propType === "Text" || propType === "Email";
1353
+ isNonIncrementing = true;
1354
+ break;
1355
+ }
1356
+ }
1357
+ }
1337
1358
  const imports = [];
1338
1359
  const traits = [];
1339
1360
  const fillable = [];
@@ -1454,7 +1475,7 @@ ${docProperties.join("\n")}
1454
1475
  protected $keyType = 'string';
1455
1476
 
1456
1477
  ` : "";
1457
- const incrementing = isUuid ? ` /**
1478
+ const incrementing = isNonIncrementing ? ` /**
1458
1479
  * Indicates if the IDs are auto-incrementing.
1459
1480
  */
1460
1481
  public $incrementing = false;