nucleus-core-ts 0.9.38 → 0.9.39
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 +1 -1
- package/scripts/generate-schema.ts +17 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nucleus-core-ts",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.39",
|
|
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",
|
|
@@ -30,6 +30,8 @@ interface Column {
|
|
|
30
30
|
mode?: string
|
|
31
31
|
dimensions?: number
|
|
32
32
|
generatedAlwaysAs?: string
|
|
33
|
+
generatedByDefaultAsIdentity?: boolean
|
|
34
|
+
generatedAlwaysAsIdentity?: boolean
|
|
33
35
|
comment?: string
|
|
34
36
|
check?: string
|
|
35
37
|
}
|
|
@@ -167,6 +169,18 @@ function generateColumnCode(col: Column, allTables: string[], currentTable?: str
|
|
|
167
169
|
}
|
|
168
170
|
|
|
169
171
|
if (col.primaryKey) code += '.primaryKey()'
|
|
172
|
+
|
|
173
|
+
if (col.generatedByDefaultAsIdentity) {
|
|
174
|
+
code += '.generatedByDefaultAsIdentity()'
|
|
175
|
+
if (col.unique) code += '.unique()'
|
|
176
|
+
return code
|
|
177
|
+
}
|
|
178
|
+
if (col.generatedAlwaysAsIdentity) {
|
|
179
|
+
code += '.generatedAlwaysAsIdentity()'
|
|
180
|
+
if (col.unique) code += '.unique()'
|
|
181
|
+
return code
|
|
182
|
+
}
|
|
183
|
+
|
|
170
184
|
if (col.notNull) code += '.notNull()'
|
|
171
185
|
if (col.unique) code += '.unique()'
|
|
172
186
|
|
|
@@ -211,9 +225,9 @@ function generateTableCode(table: TableDef, allTables: string[]): string {
|
|
|
211
225
|
const TableName = tableName.charAt(0).toUpperCase() + tableName.slice(1)
|
|
212
226
|
const columns = table.add_base_columns
|
|
213
227
|
? [
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
228
|
+
...BASE_COLUMNS,
|
|
229
|
+
...table.columns.filter((c) => !BASE_COLUMNS.find((bc) => bc.name === c.name)),
|
|
230
|
+
]
|
|
217
231
|
: table.columns
|
|
218
232
|
|
|
219
233
|
let code = `export const ${tableName}Columns = {\n`
|