@lark-apaas/db-schema-sync 0.1.11-alpha.2 → 0.1.11-beta.0
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/bin.js
CHANGED
|
@@ -1644,6 +1644,12 @@ function formatDefaultValue(value, field) {
|
|
|
1644
1644
|
}
|
|
1645
1645
|
return `.default(${trimmed})`;
|
|
1646
1646
|
}
|
|
1647
|
+
if (field && STRING_NUMERIC_TYPES.has(field.type)) {
|
|
1648
|
+
const castMatch = trimmed.match(/^'?(-?\d+(?:\.\d+)?)'?::(?:numeric|decimal)(?:\(\d+(?:,\s*\d+)?\))?$/i);
|
|
1649
|
+
if (castMatch) {
|
|
1650
|
+
return `.default('${castMatch[1]}')`;
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1647
1653
|
if (field && CUSTOM_CAST_TYPES.has(field.type) && !trimmed.includes("::") && trimmed.toLowerCase() !== CURRENT_USER_SENTINEL) {
|
|
1648
1654
|
const pgLiteral = trimmed.replace(/'/g, "''");
|
|
1649
1655
|
const escaped = pgLiteral.replace(/`/g, "\\`").replace(/\$\{/g, "\\${");
|
package/dist/index.js
CHANGED