loopbackio / loopbackio/loopback-next

lb4 discover does not handle BLOB fields

Open
#6,295 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug db:MySQL db:Oracle db:PostgreSQL good first issue Hacktoberfest help wanted Model Discovery
Dominant language
TypeScript
Stars
5.1k
Forks
1.1k
Avg merge
2d 21h
Merged PRs (30d)
27

Description

## Steps to reproduce
To reproduce this problem use lb4 discover in a MySQL table having a BLOB field. It will generate a model where BLOB is mapped to binary and does not start.

## Current Behavior

The lb4 discover blob fields as binary fields

## Expected Behavior

Blob fields should be discovered as buffer type.

## Link to reproduction sandbox

## Additional information

The created model property is like

```ts
@property({
type: 'Binary',
required: true,
length: 65535,
mysql: {columnName: 'photo', dataType: 'blob', dataLength: 65535, dataPrecision: null, dataScale: null, nullable: 'N'},
})
// Binary is not defined so compiler fails
// it should be Buffer
photo: Binary;
```
## Related Issues

No similar issues found.

_See [Reporting Issues](http://loopback.io/doc/en/contrib/Reporting-issues.html) for more tips on writing good issues_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with lb4 discover against a MySQL table containing a BLOB field, then inspect the generated TypeScript model shown in the report. Verify that BLOB is mapped to Buffer rather than the undefined Binary type and that the generated model compiles and starts successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, typescript
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.