@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.
package/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.1",
4
+ "version": "2.5.5-alpha.3",
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.1",
49
- "@budibase/client": "2.5.5-alpha.1",
50
- "@budibase/pro": "2.5.5-alpha.0",
51
- "@budibase/shared-core": "2.5.5-alpha.1",
52
- "@budibase/string-templates": "2.5.5-alpha.1",
53
- "@budibase/types": "2.5.5-alpha.1",
48
+ "@budibase/backend-core": "2.5.5-alpha.3",
49
+ "@budibase/client": "2.5.5-alpha.3",
50
+ "@budibase/pro": "2.5.5-alpha.2",
51
+ "@budibase/shared-core": "2.5.5-alpha.3",
52
+ "@budibase/string-templates": "2.5.5-alpha.3",
53
+ "@budibase/types": "2.5.5-alpha.3",
54
54
  "@bull-board/api": "3.7.0",
55
55
  "@bull-board/koa": "3.9.4",
56
56
  "@elastic/elasticsearch": "7.10.0",
@@ -176,5 +176,5 @@
176
176
  "optionalDependencies": {
177
177
  "oracledb": "5.3.0"
178
178
  },
179
- "gitHead": "16d1fac0f32f40e955ea88ab1f152164594b375b"
179
+ "gitHead": "6703f79212bec5fe1f4b1a130de1b1f203483995"
180
180
  }
@@ -11,6 +11,7 @@ if [ "$1" = '/opt/mssql/bin/sqlservr' ]; then
11
11
 
12
12
  echo "RUNNING BUDIBASE SETUP"
13
13
 
14
+ cat setup.sql
14
15
  #run the setup script to create the DB and the schema in the DB
15
16
  /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Passw0rd -i setup.sql
16
17
 
@@ -34,7 +34,7 @@ GO
34
34
  CREATE TABLE people
35
35
  (
36
36
  name varchar(30) NOT NULL,
37
- age varchar(20),
37
+ age int default 20 NOT NULL,
38
38
  CONSTRAINT pk_people PRIMARY KEY NONCLUSTERED (name, age)
39
39
  );
40
40
 
@@ -50,22 +50,22 @@ VALUES
50
50
  ('Processing', 1);
51
51
 
52
52
  INSERT INTO people (name, age)
53
- VALUES ('Bob', '30'),
54
- ('Bert', '10'),
55
- ('Jack', '12'),
56
- ('Mike', '31'),
57
- ('Dave', '44'),
58
- ('Jim', '43'),
59
- ('Kerry', '32'),
60
- ('Julie', '12'),
61
- ('Kim', '55'),
62
- ('Andy', '33'),
63
- ('John', '22'),
64
- ('Ruth', '66'),
65
- ('Robert', '88'),
66
- ('Bobert', '99'),
67
- ('Jan', '22'),
68
- ('Megan', '11');
53
+ VALUES ('Bob', 30),
54
+ ('Bert', 10),
55
+ ('Jack', 12),
56
+ ('Mike', 31),
57
+ ('Dave', 44),
58
+ ('Jim', 43),
59
+ ('Kerry', 32),
60
+ ('Julie', 12),
61
+ ('Kim', 55),
62
+ ('Andy', 33),
63
+ ('John', 22),
64
+ ('Ruth', 66),
65
+ ('Robert', 88),
66
+ ('Bobert', 99),
67
+ ('Jan', 22),
68
+ ('Megan', 11);
69
69
 
70
70
 
71
71
  IF OBJECT_ID ('Chains.sizes', 'U') IS NOT NULL
@@ -3,7 +3,7 @@ USE main;
3
3
  CREATE TABLE Persons (
4
4
  PersonID int NOT NULL AUTO_INCREMENT,
5
5
  CreatedAt datetime,
6
- Age float,
6
+ Age float DEFAULT 20 NOT NULL,
7
7
  LastName varchar(255),
8
8
  FirstName varchar(255),
9
9
  Address varchar(255),
@@ -8,6 +8,7 @@ CREATE TABLE Persons (
8
8
  FirstName varchar(255),
9
9
  Address varchar(255),
10
10
  City varchar(255) DEFAULT 'Belfast',
11
+ Age INTEGER DEFAULT 20 NOT NULL,
11
12
  Type person_job
12
13
  );
13
14
  CREATE TABLE Tasks (
@@ -243,11 +243,14 @@ class SqlServerIntegration extends Sql implements DatasourcePlus {
243
243
  if (typeof name !== "string") {
244
244
  continue
245
245
  }
246
+ const hasDefault = def.COLUMN_DEFAULT
247
+ const isAuto = !!autoColumns.find(col => col === name)
248
+ const required = !!requiredColumns.find(col => col === name)
246
249
  schema[name] = {
247
- autocolumn: !!autoColumns.find(col => col === name),
250
+ autocolumn: isAuto,
248
251
  name: name,
249
252
  constraints: {
250
- presence: requiredColumns.find(col => col === name),
253
+ presence: required && !isAuto && !hasDefault,
251
254
  },
252
255
  ...convertSqlType(def.DATA_TYPE),
253
256
  externalType: def.DATA_TYPE,
@@ -229,13 +229,15 @@ class MySQLIntegration extends Sql implements DatasourcePlus {
229
229
  if (column.Key === "PRI" && primaryKeys.indexOf(column.Key) === -1) {
230
230
  primaryKeys.push(columnName)
231
231
  }
232
- const constraints = {
233
- presence: column.Null !== "YES",
234
- }
232
+ const hasDefault = column.Default != null
235
233
  const isAuto: boolean =
236
234
  typeof column.Extra === "string" &&
237
235
  (column.Extra === "auto_increment" ||
238
236
  column.Extra.toLowerCase().includes("generated"))
237
+ const required = column.Null !== "YES"
238
+ const constraints = {
239
+ presence: required && !isAuto && !hasDefault,
240
+ }
239
241
  schema[columnName] = {
240
242
  name: columnName,
241
243
  autocolumn: isAuto,
@@ -262,15 +262,17 @@ class PostgresIntegration extends Sql implements DatasourcePlus {
262
262
  column.identity_start ||
263
263
  column.identity_increment
264
264
  )
265
- const constraints = {
266
- presence: column.is_nullable === "NO",
267
- }
268
- const hasDefault =
265
+ const hasDefault = column.column_default != null
266
+ const hasNextVal =
269
267
  typeof column.column_default === "string" &&
270
268
  column.column_default.startsWith("nextval")
271
269
  const isGenerated =
272
270
  column.is_generated && column.is_generated !== "NEVER"
273
- const isAuto: boolean = hasDefault || identity || isGenerated
271
+ const isAuto: boolean = hasNextVal || identity || isGenerated
272
+ const required = column.is_nullable === "NO"
273
+ const constraints = {
274
+ presence: required && !hasDefault && !isGenerated,
275
+ }
274
276
  tables[tableName].schema[columnName] = {
275
277
  autocolumn: isAuto,
276
278
  name: columnName,