@famgia/omnify-laravel 0.0.52 → 0.0.54

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-VS3UOQWY.js";
25
+ } from "./chunk-U7ZCSAYW.js";
26
26
  export {
27
27
  formatColumnMethod,
28
28
  formatForeignKey,
package/dist/plugin.cjs CHANGED
@@ -122,6 +122,15 @@ function propertyToColumnMethod(propertyName, property, options = {}) {
122
122
  if (baseProp.unsigned && (method === "tinyInteger" || method === "integer" || method === "bigInteger")) {
123
123
  modifiers.push({ method: "unsigned" });
124
124
  }
125
+ if (method === "timestamp") {
126
+ const timestampProp = property;
127
+ if (timestampProp.useCurrent) {
128
+ modifiers.push({ method: "useCurrent" });
129
+ }
130
+ if (timestampProp.useCurrentOnUpdate) {
131
+ modifiers.push({ method: "useCurrentOnUpdate" });
132
+ }
133
+ }
125
134
  const rawDisplayName = property.displayName;
126
135
  if (rawDisplayName) {
127
136
  const displayName = (0, import_omnify_types.resolveLocalizedString)(rawDisplayName, options.locale);
@@ -193,6 +202,7 @@ function generatePolymorphicColumns(propertyName, property, allSchemas) {
193
202
  if (assocProp.relation !== "MorphTo") {
194
203
  return null;
195
204
  }
205
+ const isNullable2 = assocProp.nullable !== false;
196
206
  const targets = assocProp.targets;
197
207
  if (!targets || targets.length === 0) {
198
208
  return null;
@@ -204,7 +214,7 @@ function generatePolymorphicColumns(propertyName, property, allSchemas) {
204
214
  name: typeColumnName,
205
215
  method: "enum",
206
216
  args: [typeColumnName, targets],
207
- modifiers: [{ method: "nullable" }]
217
+ modifiers: isNullable2 ? [{ method: "nullable" }] : []
208
218
  };
209
219
  let idMethod = "unsignedBigInteger";
210
220
  for (const targetName of targets) {
@@ -223,7 +233,7 @@ function generatePolymorphicColumns(propertyName, property, allSchemas) {
223
233
  name: idColumnName,
224
234
  method: idMethod,
225
235
  args: idMethod === "string" ? [idColumnName, 255] : [idColumnName],
226
- modifiers: [{ method: "nullable" }]
236
+ modifiers: isNullable2 ? [{ method: "nullable" }] : []
227
237
  };
228
238
  const indexes = [
229
239
  {