From f48cef763e905210a9b0255433437bb5584ac71c Mon Sep 17 00:00:00 2001 From: Bruce Date: Fri, 2 Feb 2024 18:51:43 +0800 Subject: [PATCH] fix: create tag/edge statement with empty [NULL|NOT NULL] value (#762) mod: version@3.9.1 --- app/utils/gql.ts | 6 ++++-- package.json | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/utils/gql.ts b/app/utils/gql.ts index ae2eb59a..1a9dfc66 100644 --- a/app/utils/gql.ts +++ b/app/utils/gql.ts @@ -114,9 +114,11 @@ export const getTagOrEdgeCreateGQL = (params: { } const _type = item.type !== 'fixed_string' ? item.type : item.type + `(${item.fixedLength ? item.fixedLength : ''})`; - const _null = item.allowNull ? 'NULL' : 'NOT NULL'; + // `[NULL | NOT NULL]` is not required + // in `CREATE TAG` or `CREATE EDGE` statement, the default value is `NULL` if not specified + const _null = item.allowNull === undefined ? '' : item.allowNull ? 'NULL' : 'NOT NULL'; const _comment = item.comment ? `COMMENT "${handleEscape(item.comment)}"` : ''; - const conbine = [handleKeyword(item.name), _type, _null, valueStr, _comment]; + const conbine = [handleKeyword(item.name), _type, _null, valueStr, _comment].filter(Boolean); return conbine.join(' '); }) .join(', ') diff --git a/package.json b/package.json index dd9360b1..54260bfc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nebula-graph-studio", - "version": "3.9.0", + "version": "3.9.1", "description": "nebula-graph-studio", "private": true, "repository": {