@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/{chunk-JCVJ7V7S.js → chunk-VS3UOQWY.js} +27 -6
- package/dist/chunk-VS3UOQWY.js.map +1 -0
- package/dist/index.cjs +26 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin.cjs +26 -5
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-JCVJ7V7S.js.map +0 -1
package/dist/index.js
CHANGED
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
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
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 =
|
|
1478
|
+
const incrementing = isNonIncrementing ? ` /**
|
|
1458
1479
|
* Indicates if the IDs are auto-incrementing.
|
|
1459
1480
|
*/
|
|
1460
1481
|
public $incrementing = false;
|