Skip to content

fix: show table name in 'to' column validation error message#5449

Open
isaackaara wants to merge 1 commit intodrizzle-team:betafrom
isaackaara:fix/relation-to-column-error-message
Open

fix: show table name in 'to' column validation error message#5449
isaackaara wants to merge 1 commit intodrizzle-team:betafrom
isaackaara:fix/relation-to-column-error-message

Conversation

@isaackaara
Copy link

When a relation's to column doesn't belong to the expected table, the error message was printing the table object itself instead of the table name string, so it showed [object Object] in the output.

Before:

relations -> blogs: { posts: r.many.post(...) }: all "to" columns must belong to table "[object Object]", found column of table "blog"

After:

relations -> blogs: { posts: r.many.post(...) }: all "to" columns must belong to table "post", found column of table "blog"

Change: In processRelations, the error string was interpolating targetTable (the table object) instead of targetTableName (the string). One-character difference in variable name.

Fixes #5350

When a relation's 'to' column doesn't belong to the expected table,
the error message was interpolating the table object itself instead
of the table name string, resulting in '[object Object]' in the output.

Replace `targetTable` with `targetTableName` in the error string.

Fixes drizzle-team#5350
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant