nucleus-core-ts 0.8.158 → 0.8.161

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nucleus-core-ts",
3
- "version": "0.8.158",
3
+ "version": "0.8.161",
4
4
  "description": "Production-ready, enterprise-grade TypeScript framework for building multi-tenant APIs",
5
5
  "author": "Hidayet Can Özcan <hidayetcan@gmail.com>",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -176,7 +176,11 @@ function generateColumnCode(col: Column, allTables: string[], currentTable?: str
176
176
  code += '.defaultRandom()'
177
177
  } else if (col.default !== undefined) {
178
178
  if (typeof col.default === 'string') {
179
- code += `.default('${col.default}')`
179
+ if (col.type === 'jsonb' || col.type === 'json') {
180
+ code += `.default(sql\`'${col.default}'\`)`
181
+ } else {
182
+ code += `.default('${col.default}')`
183
+ }
180
184
  } else if (typeof col.default === 'boolean') {
181
185
  code += `.default(${col.default})`
182
186
  } else if (typeof col.default === 'number') {
@@ -207,9 +211,9 @@ function generateTableCode(table: TableDef, allTables: string[]): string {
207
211
  const TableName = tableName.charAt(0).toUpperCase() + tableName.slice(1)
208
212
  const columns = table.add_base_columns
209
213
  ? [
210
- ...BASE_COLUMNS,
211
- ...table.columns.filter((c) => !BASE_COLUMNS.find((bc) => bc.name === c.name)),
212
- ]
214
+ ...BASE_COLUMNS,
215
+ ...table.columns.filter((c) => !BASE_COLUMNS.find((bc) => bc.name === c.name)),
216
+ ]
213
217
  : table.columns
214
218
 
215
219
  let code = `export const ${tableName}Columns = {\n`