fiberx-backend-toolkit 0.0.63 → 0.0.64
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.
|
@@ -60,8 +60,8 @@ const serializeIndexDefinition = (index) => {
|
|
|
60
60
|
const serializeSequelizeColumnsObject = (columns) => {
|
|
61
61
|
const rendered = Object.entries(columns)
|
|
62
62
|
.map(([col_name, col_def]) => {
|
|
63
|
-
const
|
|
64
|
-
return `"${col_name}": ${
|
|
63
|
+
const col_code = serializeSequelizeColumnDefinition(col_def);
|
|
64
|
+
return `"${col_name}": ${col_code}`;
|
|
65
65
|
})
|
|
66
66
|
.join(",\n");
|
|
67
67
|
return `{
|
|
@@ -145,19 +145,17 @@ class Create${schema_model_name}TableMigration {
|
|
|
145
145
|
${indentBlock(rendered_columns, 4)}
|
|
146
146
|
);
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
|
|
149
|
+
${schema_definition.indexes?.map(index => `
|
|
150
150
|
await queryInterface.addIndex(
|
|
151
151
|
table_name,
|
|
152
152
|
${JSON.stringify(index.fields)},
|
|
153
153
|
{
|
|
154
154
|
name: "${index.name}",
|
|
155
|
-
|
|
155
|
+
${indentBlock(serializeIndexDefinition(index), 2)}
|
|
156
156
|
}
|
|
157
157
|
);
|
|
158
|
-
|
|
159
|
-
return indentBlock(indexCode.trim(), 3);
|
|
160
|
-
}).join("\n\n") || ""}
|
|
158
|
+
`).join("")}
|
|
161
159
|
|
|
162
160
|
this.logger.success(\`✅ Table "\${table_name}" created successfully.\`);
|
|
163
161
|
}
|
|
@@ -210,7 +208,7 @@ class Update${model_name}TableMigration {
|
|
|
210
208
|
await queryInterface.addColumn(
|
|
211
209
|
table_name,
|
|
212
210
|
"${col}",
|
|
213
|
-
${serializeSequelizeColumnDefinition(current_schema.columns[col])}
|
|
211
|
+
${indentBlock(serializeSequelizeColumnDefinition(current_schema.columns[col]), 1)}
|
|
214
212
|
);
|
|
215
213
|
`).join("")}
|
|
216
214
|
|
|
@@ -219,7 +217,7 @@ class Update${model_name}TableMigration {
|
|
|
219
217
|
await queryInterface.changeColumn(
|
|
220
218
|
table_name,
|
|
221
219
|
"${col}",
|
|
222
|
-
${serializeSequelizeColumnDefinition(current_schema.columns[col])}
|
|
220
|
+
${indentBlock(serializeSequelizeColumnDefinition(current_schema.columns[col]), 1)}
|
|
223
221
|
);
|
|
224
222
|
`).join("")}
|
|
225
223
|
|
|
@@ -241,7 +239,7 @@ class Update${model_name}TableMigration {
|
|
|
241
239
|
${JSON.stringify(idx.fields)},
|
|
242
240
|
{
|
|
243
241
|
name: "${idx.name}",
|
|
244
|
-
|
|
242
|
+
${indentBlock(serializeIndexDefinition(idx).replace(/^{|}$/g, ""), 2)}
|
|
245
243
|
}
|
|
246
244
|
);
|
|
247
245
|
` : "";
|
|
@@ -259,7 +257,7 @@ class Update${model_name}TableMigration {
|
|
|
259
257
|
${JSON.stringify(idx.fields)},
|
|
260
258
|
{
|
|
261
259
|
name: "${idx.name}",
|
|
262
|
-
|
|
260
|
+
${indentBlock(serializeIndexDefinition(idx).replace(/^{|}$/g, ""), 2)}
|
|
263
261
|
}
|
|
264
262
|
);
|
|
265
263
|
` : "";
|
|
@@ -298,7 +296,7 @@ class Update${model_name}TableMigration {
|
|
|
298
296
|
${JSON.stringify(idx.fields)},
|
|
299
297
|
{
|
|
300
298
|
name: "${idx.name}",
|
|
301
|
-
|
|
299
|
+
${indentBlock(serializeIndexDefinition(idx).replace(/^{|}$/g, ""), 2)}
|
|
302
300
|
}
|
|
303
301
|
);
|
|
304
302
|
` : "";
|
|
@@ -313,7 +311,7 @@ class Update${model_name}TableMigration {
|
|
|
313
311
|
${JSON.stringify(idx.fields)},
|
|
314
312
|
{
|
|
315
313
|
name: "${idx.name}",
|
|
316
|
-
|
|
314
|
+
${indentBlock(serializeIndexDefinition(idx).replace(/^{|}$/g, ""), 2)}
|
|
317
315
|
}
|
|
318
316
|
);
|
|
319
317
|
` : "";
|
|
@@ -324,7 +322,7 @@ class Update${model_name}TableMigration {
|
|
|
324
322
|
await queryInterface.changeColumn(
|
|
325
323
|
table_name,
|
|
326
324
|
"${col}",
|
|
327
|
-
|
|
325
|
+
${indentBlock(serializeSequelizeColumnDefinition(previous_schema.columns[col]), 1)}
|
|
328
326
|
);
|
|
329
327
|
`).join("")}
|
|
330
328
|
|
|
@@ -336,7 +334,7 @@ class Update${model_name}TableMigration {
|
|
|
336
334
|
await queryInterface.addColumn(
|
|
337
335
|
table_name,
|
|
338
336
|
"${col}",
|
|
339
|
-
|
|
337
|
+
${indentBlock(serializeSequelizeColumnDefinition(previous_schema.columns[col]), 1)}
|
|
340
338
|
);
|
|
341
339
|
`).join("")}
|
|
342
340
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fiberx-backend-toolkit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.64",
|
|
4
4
|
"description": "A TypeScript backend toolkit providing shared domain logic, infrastructure helpers, and utilities for FiberX server-side applications and services.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./dist/index.js",
|