@saltcorn/server 1.1.2-beta.13 → 1.1.2-beta.14

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.
Files changed (2) hide show
  1. package/package.json +9 -9
  2. package/routes/tables.js +10 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltcorn/server",
3
- "version": "1.1.2-beta.13",
3
+ "version": "1.1.2-beta.14",
4
4
  "description": "Server app for Saltcorn, open-source no-code platform",
5
5
  "homepage": "https://saltcorn.com",
6
6
  "main": "index.js",
@@ -8,14 +8,14 @@
8
8
  "dependencies": {
9
9
  "@aws-sdk/client-s3": "^3.735.0",
10
10
  "@dr.pogodin/csurf": "^1.14.1",
11
- "@saltcorn/base-plugin": "1.1.2-beta.13",
12
- "@saltcorn/builder": "1.1.2-beta.13",
13
- "@saltcorn/data": "1.1.2-beta.13",
14
- "@saltcorn/admin-models": "1.1.2-beta.13",
15
- "@saltcorn/filemanager": "1.1.2-beta.13",
16
- "@saltcorn/markup": "1.1.2-beta.13",
17
- "@saltcorn/plugins-loader": "1.1.2-beta.13",
18
- "@saltcorn/sbadmin2": "1.1.2-beta.13",
11
+ "@saltcorn/base-plugin": "1.1.2-beta.14",
12
+ "@saltcorn/builder": "1.1.2-beta.14",
13
+ "@saltcorn/data": "1.1.2-beta.14",
14
+ "@saltcorn/admin-models": "1.1.2-beta.14",
15
+ "@saltcorn/filemanager": "1.1.2-beta.14",
16
+ "@saltcorn/markup": "1.1.2-beta.14",
17
+ "@saltcorn/plugins-loader": "1.1.2-beta.14",
18
+ "@saltcorn/sbadmin2": "1.1.2-beta.14",
19
19
  "@socket.io/cluster-adapter": "^0.2.1",
20
20
  "@socket.io/sticky": "^1.0.1",
21
21
  "adm-zip": "0.5.16",
package/routes/tables.js CHANGED
@@ -67,6 +67,7 @@ const {
67
67
  InvalidConfiguration,
68
68
  removeAllWhiteSpace,
69
69
  comparingCaseInsensitive,
70
+ validSqlId,
70
71
  } = require("@saltcorn/data/utils");
71
72
  const { EOL } = require("os");
72
73
 
@@ -484,7 +485,10 @@ const buildTableMarkup = (table) => {
484
485
  const members = fields
485
486
  // .filter((f) => !f.reftable_name)
486
487
  .map((f) =>
487
- indentString(`${removeAllWhiteSpace(f.type_name)} ${f.name}`, 6)
488
+ indentString(
489
+ `${removeAllWhiteSpace(f.type_name)} ${validSqlId(f.name)}`,
490
+ 6
491
+ )
488
492
  )
489
493
  .join(EOL);
490
494
  const keys = table
@@ -794,7 +798,9 @@ router.get(
794
798
  const triggers = table.id ? Trigger.find({ table_id: table.id }) : [];
795
799
  triggers.sort(comparingCaseInsensitive("name"));
796
800
  let fieldCard;
797
- const nPrimaryKeys = fields.filter((f) => f.primary_key).length;
801
+ const primaryKeys = fields.filter((f) => f.primary_key);
802
+ const nPrimaryKeys = primaryKeys.length;
803
+ const nonSerialPKS = primaryKeys.some((f) => f.attributes?.NonSerial);
798
804
 
799
805
  if (fields.length === 0) {
800
806
  fieldCard = [
@@ -858,11 +864,11 @@ router.get(
858
864
  { hover: true }
859
865
  );
860
866
  fieldCard = [
861
- nPrimaryKeys > 1 &&
867
+ (nPrimaryKeys > 1 || nonSerialPKS) &&
862
868
  div(
863
869
  { class: "alert alert-danger", role: "alert" },
864
870
  i({ class: "fas fa-exclamation-triangle" }),
865
- "This table has composite primary keys which is not supported in Saltcorn. A procedure to introduce a single autoincrementing primary key is available.",
871
+ "This table has composite primary keys, or a non-incrementing integer primary key, which are not supported in Saltcorn. A procedure to introduce a single autoincrementing primary key is available.",
866
872
  post_btn(
867
873
  `/table/repair-composite-primary/${table.id}`,
868
874
  "Add autoincrementing primary key",