@cadenza.io/service 1.6.11 → 1.6.12

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 CHANGED
@@ -2392,14 +2392,13 @@ var DatabaseController = class _DatabaseController {
2392
2392
  "Generates auto-tasks for database schema"
2393
2393
  ),
2394
2394
  CadenzaService.createMetaTask("Generate DDL from table", (ctx) => {
2395
- var _a2;
2396
2395
  const { ddl, table, tableName, schema, options } = ctx;
2397
2396
  const fieldDefs = Object.entries(table.fields).map((value) => {
2398
- var _a3, _b2, _c2, _d2, _e, _f, _g;
2397
+ var _a2, _b2, _c2, _d2, _e, _f, _g;
2399
2398
  const [fieldName, field] = value;
2400
2399
  let def = `${fieldName} ${field.type.toUpperCase()}`;
2401
2400
  if (field.type === "varchar")
2402
- def += `(${(_b2 = (_a3 = field.constraints) == null ? void 0 : _a3.maxLength) != null ? _b2 : 255})`;
2401
+ def += `(${(_b2 = (_a2 = field.constraints) == null ? void 0 : _a2.maxLength) != null ? _b2 : 255})`;
2403
2402
  if (field.type === "decimal")
2404
2403
  def += `(${(_d2 = (_c2 = field.constraints) == null ? void 0 : _c2.precision) != null ? _d2 : 10},${(_f = (_e = field.constraints) == null ? void 0 : _e.scale) != null ? _f : 2})`;
2405
2404
  if (field.primary) def += " PRIMARY KEY";
@@ -2419,10 +2418,6 @@ var DatabaseController = class _DatabaseController {
2419
2418
  return def;
2420
2419
  }).join(", ");
2421
2420
  let sql = `CREATE TABLE IF NOT EXISTS ${tableName} (${fieldDefs})`;
2422
- if ((_a2 = table.meta) == null ? void 0 : _a2.appendOnly) {
2423
- sql += `;
2424
- CREATE TRIGGER prevent_modification BEFORE UPDATE OR DELETE ON ${tableName} FOR EACH STATEMENT EXECUTE FUNCTION prevent_context_modification();`;
2425
- }
2426
2421
  ddl.push(sql);
2427
2422
  return { ddl, table, tableName, schema, options };
2428
2423
  }).then(