mutano 1.0.1 → 1.0.3
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/main.js +5 -3
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -229,10 +229,12 @@ async function generate(config) {
|
|
|
229
229
|
} else {
|
|
230
230
|
const prismaTable = prismaTables.find((t) => t?.name === table);
|
|
231
231
|
let enumOptions;
|
|
232
|
-
describes = prismaTable.properties.filter(
|
|
232
|
+
describes = prismaTable.properties.filter(
|
|
233
|
+
(p) => p.type === "field" && !p.attributes?.find((a) => a.name === "relation")
|
|
234
|
+
).map((field) => {
|
|
233
235
|
const defaultValueField = field.attributes ? field.attributes.find((a) => a.name === "default") : null;
|
|
234
236
|
const defaultValue = defaultValueField?.args?.[0].value;
|
|
235
|
-
const parsedDefaultValue =
|
|
237
|
+
const parsedDefaultValue = defaultValue !== void 0 && typeof defaultValue !== "object" ? defaultValue.toString() : null;
|
|
236
238
|
let fieldType = field.fieldType.toString();
|
|
237
239
|
if (!prismaValidTypes.includes(fieldType)) {
|
|
238
240
|
enumOptions = schema.findAllByType("enum", {
|
|
@@ -246,7 +248,7 @@ async function generate(config) {
|
|
|
246
248
|
Field: field.name,
|
|
247
249
|
Default: parsedDefaultValue,
|
|
248
250
|
EnumOptions: enumOptions,
|
|
249
|
-
Extra:
|
|
251
|
+
Extra: parsedDefaultValue !== null ? "DEFAULT_GENERATED" : "",
|
|
250
252
|
Type: fieldType,
|
|
251
253
|
Null: field.optional ? "YES" : "NO",
|
|
252
254
|
Comment: field.comment ?? ""
|
package/package.json
CHANGED