@budibase/server 2.5.5-alpha.1 → 2.5.5-alpha.3

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.
@@ -8,7 +8,7 @@
8
8
  <link rel="preconnect" href="https://fonts.gstatic.com" />
9
9
  <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap"
10
10
  rel="stylesheet" />
11
- <script type="module" crossorigin src="/builder/assets/index.e30988f8.js"></script>
11
+ <script type="module" crossorigin src="/builder/assets/index.c409c736.js"></script>
12
12
  <link rel="stylesheet" href="/builder/assets/index.841e62d8.css">
13
13
  </head>
14
14
 
@@ -206,8 +206,11 @@ class SqlServerIntegration extends sql_1.default {
206
206
  if (typeof name !== "string") {
207
207
  continue;
208
208
  }
209
- schema[name] = Object.assign(Object.assign({ autocolumn: !!autoColumns.find(col => col === name), name: name, constraints: {
210
- presence: requiredColumns.find(col => col === name),
209
+ const hasDefault = def.COLUMN_DEFAULT;
210
+ const isAuto = !!autoColumns.find(col => col === name);
211
+ const required = !!requiredColumns.find(col => col === name);
212
+ schema[name] = Object.assign(Object.assign({ autocolumn: isAuto, name: name, constraints: {
213
+ presence: required && !isAuto && !hasDefault,
211
214
  } }, (0, utils_1.convertSqlType)(def.DATA_TYPE)), { externalType: def.DATA_TYPE });
212
215
  }
213
216
  tables[tableName] = {
@@ -186,12 +186,14 @@ class MySQLIntegration extends sql_1.default {
186
186
  if (column.Key === "PRI" && primaryKeys.indexOf(column.Key) === -1) {
187
187
  primaryKeys.push(columnName);
188
188
  }
189
- const constraints = {
190
- presence: column.Null !== "YES",
191
- };
189
+ const hasDefault = column.Default != null;
192
190
  const isAuto = typeof column.Extra === "string" &&
193
191
  (column.Extra === "auto_increment" ||
194
192
  column.Extra.toLowerCase().includes("generated"));
193
+ const required = column.Null !== "YES";
194
+ const constraints = {
195
+ presence: required && !isAuto && !hasDefault,
196
+ };
195
197
  schema[columnName] = Object.assign(Object.assign({ name: columnName, autocolumn: isAuto, constraints }, (0, utils_1.convertSqlType)(column.Type)), { externalType: column.Type });
196
198
  }
197
199
  if (!tables[tableName]) {
@@ -227,13 +227,15 @@ class PostgresIntegration extends sql_1.default {
227
227
  const identity = !!(column.identity_generation ||
228
228
  column.identity_start ||
229
229
  column.identity_increment);
230
- const constraints = {
231
- presence: column.is_nullable === "NO",
232
- };
233
- const hasDefault = typeof column.column_default === "string" &&
230
+ const hasDefault = column.column_default != null;
231
+ const hasNextVal = typeof column.column_default === "string" &&
234
232
  column.column_default.startsWith("nextval");
235
233
  const isGenerated = column.is_generated && column.is_generated !== "NEVER";
236
- const isAuto = hasDefault || identity || isGenerated;
234
+ const isAuto = hasNextVal || identity || isGenerated;
235
+ const required = column.is_nullable === "NO";
236
+ const constraints = {
237
+ presence: required && !hasDefault && !isGenerated,
238
+ };
237
239
  tables[tableName].schema[columnName] = Object.assign(Object.assign({ autocolumn: isAuto, name: columnName, constraints }, (0, utils_1.convertSqlType)(column.data_type)), { externalType: column.data_type });
238
240
  }
239
241
  const final = (0, utils_1.finaliseExternalTables)(tables, entities);
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/server",
3
3
  "email": "hi@budibase.com",
4
- "version": "2.5.5-alpha.0",
4
+ "version": "2.5.5-alpha.2",
5
5
  "description": "Budibase Web Server",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -45,12 +45,12 @@
45
45
  "license": "GPL-3.0",
46
46
  "dependencies": {
47
47
  "@apidevtools/swagger-parser": "10.0.3",
48
- "@budibase/backend-core": "2.5.5-alpha.0",
49
- "@budibase/client": "2.5.5-alpha.0",
50
- "@budibase/pro": "2.5.5-alpha.0",
51
- "@budibase/shared-core": "2.5.5-alpha.0",
52
- "@budibase/string-templates": "2.5.5-alpha.0",
53
- "@budibase/types": "2.5.5-alpha.0",
48
+ "@budibase/backend-core": "2.5.5-alpha.2",
49
+ "@budibase/client": "2.5.5-alpha.2",
50
+ "@budibase/pro": "2.5.5-alpha.2",
51
+ "@budibase/shared-core": "2.5.5-alpha.2",
52
+ "@budibase/string-templates": "2.5.5-alpha.2",
53
+ "@budibase/types": "2.5.5-alpha.2",
54
54
  "@bull-board/api": "3.7.0",
55
55
  "@bull-board/koa": "3.9.4",
56
56
  "@elastic/elasticsearch": "7.10.0",