From 39182cfbc097071a93c14f126fef66606369ad0f Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 1 Apr 2022 17:13:28 +0100 Subject: [PATCH 1/2] Fixing issue #5817 - making sure that date strings are correctly parsed into the bindings. --- packages/server/scripts/integrations/mysql/init.sql | 5 +++-- packages/server/src/integrations/mysql.ts | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/server/scripts/integrations/mysql/init.sql b/packages/server/scripts/integrations/mysql/init.sql index f37ef0d532..9fa608f42d 100644 --- a/packages/server/scripts/integrations/mysql/init.sql +++ b/packages/server/scripts/integrations/mysql/init.sql @@ -14,6 +14,7 @@ CREATE TABLE Tasks ( TaskID int NOT NULL AUTO_INCREMENT, PersonID INT, TaskName varchar(255), + CreatedAt DATE, PRIMARY KEY (TaskID), CONSTRAINT fkPersons FOREIGN KEY(PersonID) @@ -25,6 +26,6 @@ CREATE TABLE Products ( updated time ); INSERT INTO Persons (FirstName, LastName, Age, Address, City, CreatedAt) VALUES ('Mike', 'Hughes', 28.2, '123 Fake Street', 'Belfast', '2021-01-19 03:14:07'); -INSERT INTO Tasks (PersonID, TaskName) VALUES (1, 'assembling'); -INSERT INTO Tasks (PersonID, TaskName) VALUES (1, 'processing'); +INSERT INTO Tasks (PersonID, TaskName, CreatedAt) VALUES (1, 'assembling', '2020-01-01'); +INSERT INTO Tasks (PersonID, TaskName, CreatedAt) VALUES (2, 'processing', '2019-12-31'); INSERT INTO Products (name, updated) VALUES ('Meat', '11:00:22'), ('Fruit', '10:00:00'); diff --git a/packages/server/src/integrations/mysql.ts b/packages/server/src/integrations/mysql.ts index 6f009bbd4a..cd5dc77f9b 100644 --- a/packages/server/src/integrations/mysql.ts +++ b/packages/server/src/integrations/mysql.ts @@ -14,6 +14,7 @@ import { finaliseExternalTables, } from "./utils" import { DatasourcePlus } from "./base/datasourcePlus" +import dayjs from "dayjs" module MySQLModule { const mysql = require("mysql2/promise") @@ -86,10 +87,16 @@ module MySQLModule { if (typeof binding !== "string") { continue } - const matches = binding.match(/^\d*/g) + const matches = binding.match(/^\d*$/g) + // check if number first if (matches && matches[0] !== "" && !isNaN(Number(matches[0]))) { bindings[i] = parseFloat(binding) } + // if not a number, see if it is a date - important to do in this order as any + // integer will be considered a valid date + else if (dayjs(binding).isValid()) { + bindings[i] = dayjs(binding).toDate() + } } return bindings } From defd0a29a7acf71b93fed5152253e366faf28d26 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Mon, 4 Apr 2022 09:54:00 +0000 Subject: [PATCH 2/2] v1.0.104 --- lerna.json | 2 +- packages/backend-core/package.json | 2 +- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 2 +- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/server/package.json | 8 ++++---- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lerna.json b/lerna.json index c8916671d4..5b5c1dbb00 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.0.103", + "version": "1.0.104", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index ae6d8635f3..55b6a8dcca 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.0.103", + "version": "1.0.104", "description": "Budibase backend core libraries used in server and worker", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index ef22631ff8..44cd108f81 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "1.0.103", + "version": "1.0.104", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "^1.2.1", - "@budibase/string-templates": "^1.0.103", + "@budibase/string-templates": "^1.0.104", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index d1611d739c..fcd0c7f8db 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.0.103", + "version": "1.0.104", "license": "GPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.0.103", - "@budibase/client": "^1.0.103", - "@budibase/frontend-core": "^1.0.103", - "@budibase/string-templates": "^1.0.103", + "@budibase/bbui": "^1.0.104", + "@budibase/client": "^1.0.104", + "@budibase/frontend-core": "^1.0.104", + "@budibase/string-templates": "^1.0.104", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 4f61b494a1..985dfeb632 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.0.103", + "version": "1.0.104", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index af7cf27fe2..5d8a60a91d 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.0.103", + "version": "1.0.104", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^1.0.103", - "@budibase/frontend-core": "^1.0.103", - "@budibase/string-templates": "^1.0.103", + "@budibase/bbui": "^1.0.104", + "@budibase/frontend-core": "^1.0.104", + "@budibase/string-templates": "^1.0.104", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index 95d88200a0..a04d0abe28 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.0.103", + "version": "1.0.104", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^1.0.103", + "@budibase/bbui": "^1.0.104", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index 78d6b3f41d..e38ba41a02 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.0.103", + "version": "1.0.104", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -68,9 +68,9 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "^10.0.3", - "@budibase/backend-core": "^1.0.103", - "@budibase/client": "^1.0.103", - "@budibase/string-templates": "^1.0.103", + "@budibase/backend-core": "^1.0.104", + "@budibase/client": "^1.0.104", + "@budibase/string-templates": "^1.0.104", "@bull-board/api": "^3.7.0", "@bull-board/koa": "^3.7.0", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index b40aafff5c..581530a565 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.0.103", + "version": "1.0.104", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index f10e0b7de9..fd7485e648 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.0.103", + "version": "1.0.104", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -31,8 +31,8 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^1.0.103", - "@budibase/string-templates": "^1.0.103", + "@budibase/backend-core": "^1.0.104", + "@budibase/string-templates": "^1.0.104", "@koa/router": "^8.0.0", "@sentry/node": "^6.0.0", "@techpass/passport-openidconnect": "^0.3.0",