@famgia/omnify-laravel 2.0.22 → 2.0.24
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-RSC5ATSV.js → chunk-LAM2IBUF.js} +14 -4
- package/dist/chunk-LAM2IBUF.js.map +1 -0
- package/dist/index.cjs +13 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin.cjs +13 -3
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-RSC5ATSV.js.map +0 -1
|
@@ -288,7 +288,7 @@ function generateForeignKey(propertyName, property, allSchemas, options = {}) {
|
|
|
288
288
|
const columnName = toColumnName(propertyName) + "_id";
|
|
289
289
|
const targetSchema = assocProp.target ? allSchemas[assocProp.target] : void 0;
|
|
290
290
|
const targetTable = assocProp.target ? toTableName(assocProp.target) : "unknown";
|
|
291
|
-
const targetPkType = targetSchema ? getIdType(targetSchema) : "BigInt";
|
|
291
|
+
const targetPkType = assocProp.idType ?? (targetSchema ? getIdType(targetSchema) : "BigInt");
|
|
292
292
|
let method = "unsignedBigInteger";
|
|
293
293
|
if (targetPkType === "Int") {
|
|
294
294
|
method = "unsignedInteger";
|
|
@@ -1496,7 +1496,12 @@ function formatAddColumn(columnName, prop) {
|
|
|
1496
1496
|
}
|
|
1497
1497
|
if (isAssociationWithFkColumn(prop)) {
|
|
1498
1498
|
const fkColumn = getAssociationFkColumnName(columnName);
|
|
1499
|
-
|
|
1499
|
+
const idType = prop.idType ?? "BigInt";
|
|
1500
|
+
let columnMethod = "unsignedBigInteger";
|
|
1501
|
+
if (idType === "Int") columnMethod = "unsignedInteger";
|
|
1502
|
+
else if (idType === "Uuid") columnMethod = "uuid";
|
|
1503
|
+
else if (idType === "String") columnMethod = "string";
|
|
1504
|
+
let code2 = `$table->${columnMethod}('${fkColumn}')`;
|
|
1500
1505
|
if (prop.nullable) code2 += "->nullable()";
|
|
1501
1506
|
lines.push(code2 + ";");
|
|
1502
1507
|
if (prop.target) {
|
|
@@ -1559,7 +1564,12 @@ function formatRenameColumn(oldName, newName, prop) {
|
|
|
1559
1564
|
function formatModifyColumn(columnName, _prevProp, currProp) {
|
|
1560
1565
|
if (isAssociationWithFkColumn(currProp)) {
|
|
1561
1566
|
const fkColumn = getAssociationFkColumnName(columnName);
|
|
1562
|
-
|
|
1567
|
+
const idType = currProp.idType ?? "BigInt";
|
|
1568
|
+
let columnMethod = "unsignedBigInteger";
|
|
1569
|
+
if (idType === "Int") columnMethod = "unsignedInteger";
|
|
1570
|
+
else if (idType === "Uuid") columnMethod = "uuid";
|
|
1571
|
+
else if (idType === "String") columnMethod = "string";
|
|
1572
|
+
let code2 = `$table->${columnMethod}('${fkColumn}')`;
|
|
1563
1573
|
if (currProp.nullable) code2 += "->nullable()";
|
|
1564
1574
|
return code2 + "->change();";
|
|
1565
1575
|
}
|
|
@@ -5451,4 +5461,4 @@ export {
|
|
|
5451
5461
|
getFactoryPath,
|
|
5452
5462
|
laravelPlugin
|
|
5453
5463
|
};
|
|
5454
|
-
//# sourceMappingURL=chunk-
|
|
5464
|
+
//# sourceMappingURL=chunk-LAM2IBUF.js.map
|