Skip to content

fix(core): Fix some DataStore backend API issues #17978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: ADO-3851
Choose a base branch
from

Conversation

ivov
Copy link
Member

@ivov ivov commented Aug 4, 2025

Fixes to unblock Adore. Tests now recognize entities, but they now fail because sql-utils.ts needs to be made sensitive to DB type.

@ivov ivov requested a review from a team as a code owner August 4, 2025 18:42
@ivov ivov requested review from CharlieKolb and removed request for a team August 4, 2025 18:42
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic analysis

2 issues found across 4 files • Review in cubic

React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.

default:
throw new NotFoundError(`Unsupported field type: ${type as string}`);
}
}

function columnToWildcardAndType(column: DataStoreCreateColumnSchema) {
return `\`${column.name}\` ${dataStoreColumnTypeToSql(column.type)}`;
return `\`${column.name}\` ${dataStoreColumnTypeToSql(column.type)}`; // Postgres identifiers use double quotes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Column names are quoted with back-ticks even when targeting Postgres, which requires double quotes, leading to invalid SQL at runtime (Based on your team's feedback about avoiding backend SQL mismatches).

Prompt for AI agents
Address the following comment on packages/cli/src/modules/data-store/utils/sql-utils.ts at line 29:

<comment>Column names are quoted with back-ticks even when targeting Postgres, which requires double quotes, leading to invalid SQL at runtime (Based on your team&#39;s feedback about avoiding backend SQL mismatches).</comment>

<file context>
@@ -19,14 +19,14 @@ function dataStoreColumnTypeToSql(type: DataStoreCreateColumnSchema[&#39;type&#39;]) {
 		case &#39;boolean&#39;:
 			return &#39;BOOLEAN&#39;;
 		case &#39;date&#39;:
-			return &#39;DATETIME&#39;;
+			return &#39;DATETIME&#39;; // Postgres has no DATETIME
 		default:
 			throw new NotFoundError(`Unsupported field type: ${type as string}`);
 	}
 }
</file context>

@@ -19,14 +19,14 @@
case 'boolean':
return 'BOOLEAN';
case 'date':
return 'DATETIME';
return 'DATETIME'; // Postgres has no DATETIME
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returns DATETIME even though the comment notes the type is not supported by Postgres, so queries generated for Postgres will fail (Based on your team's feedback about catching backend SQL mismatches).

Prompt for AI agents
Address the following comment on packages/cli/src/modules/data-store/utils/sql-utils.ts at line 22:

<comment>Returns `DATETIME` even though the comment notes the type is not supported by Postgres, so queries generated for Postgres will fail (Based on your team&#39;s feedback about catching backend SQL mismatches).</comment>

<file context>
@@ -19,14 +19,14 @@ function dataStoreColumnTypeToSql(type: DataStoreCreateColumnSchema[&#39;type&#39;]) {
 		case &#39;boolean&#39;:
 			return &#39;BOOLEAN&#39;;
 		case &#39;date&#39;:
-			return &#39;DATETIME&#39;;
+			return &#39;DATETIME&#39;; // Postgres has no DATETIME
 		default:
 			throw new NotFoundError(`Unsupported field type: ${type as string}`);
</file context>

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant