@ronin/compiler 0.17.20 → 0.17.21
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 +5 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1577,10 +1577,10 @@ var ROOT_MODEL = {
|
|
1577
1577
|
// Providing an empty object as a default value allows us to use `json_insert`
|
1578
1578
|
// without needing to fall back to an empty object in the insertion statement,
|
1579
1579
|
// which makes the statement shorter.
|
1580
|
-
fields: { type: "json", defaultValue:
|
1581
|
-
indexes: { type: "json", defaultValue:
|
1582
|
-
triggers: { type: "json", defaultValue:
|
1583
|
-
presets: { type: "json", defaultValue:
|
1580
|
+
fields: { type: "json", defaultValue: {} },
|
1581
|
+
indexes: { type: "json", defaultValue: {} },
|
1582
|
+
triggers: { type: "json", defaultValue: {} },
|
1583
|
+
presets: { type: "json", defaultValue: {} }
|
1584
1584
|
}
|
1585
1585
|
};
|
1586
1586
|
var ROOT_MODEL_WITH_ATTRIBUTES = addDefaultModelAttributes(ROOT_MODEL, true);
|
@@ -1642,6 +1642,7 @@ var getFieldStatement = (models, model, field) => {
|
|
1642
1642
|
const symbol = getQuerySymbol(field.defaultValue);
|
1643
1643
|
let value = typeof field.defaultValue === "string" ? `'${field.defaultValue}'` : field.defaultValue;
|
1644
1644
|
if (symbol) value = `(${parseFieldExpression(model, "to", symbol.value)})`;
|
1645
|
+
if (field.type === "json") value = `'${JSON.stringify(field.defaultValue)}'`;
|
1645
1646
|
statement += ` DEFAULT ${value}`;
|
1646
1647
|
}
|
1647
1648
|
if (field.type === "string" && field.collation) {
|