Support for binary type
See original GitHub issueProblem
PostgreSQL, MySQL and SQLite provide capabilities to store binary blobs:
- SQLite has a
BLOB
data type - PostgreSQL has
bytea
and a Large Object feature, which stores the binary data in a separate table in a special format, and refers to that table by storing a value of type OID in your table. - MySQL has
BINARY
andVARBINARY
Prisma does not support these data types.
Suggested solution
Add support for a binary type in PSL.
Alternatives
@onmyflow describes a workaround below.
Additional context
Original issue
Hi folks, I’m looking to store and access large arrays of binary data using PostgreSQL and Prisma, but it doesn’t seem like the type that would make the most sense for my use case here (bytea) is supported by Prisma. Is there some possible workaround or plans to add this as a supported type?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:21
- Comments:16 (9 by maintainers)
Top Results From Across the Web
MicroStrategy support for binary data types
MicroStrategy support for binary data types ; SQL Server. Binary. Varbinary ; Sybase IQ. Binary. Varbinary ; Sybase ASE. Binary. Varbinary ; MySQL....
Read more >Enabling binary support using the API Gateway console
The section explains how to enable binary support using the API Gateway console. As an example, we use an API that is integrated...
Read more >Binary Data Types
The following aggregate functions are supported for binary data types: BIT_AND. BIT_OR.
Read more >Binary data types
Columns that use the binary data types do not support some of the common query processing operations. For example, binary data type columns...
Read more >Documentation: 15: 8.4. Binary Data Types
A binary string is a sequence of octets (or bytes). Binary strings are distinguished from character strings in two ways. First, binary strings...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@albertoperdomo I can’t speak to their use cases, but I can say that for quick prototypes or internal apps it can be convenient to centralize everything in postgres, particularly if file storage needs are limited and file sizes small and there are not many concurrent users. I’m not aware of any scenario where this is the best thing to do, but there are places where it makes sense to save effort. It would be nice to have blobs as a supported type in Prisma.
EDIT: I guess this is a use case: https://wiki.postgresql.org/wiki/BinaryFilesInDB#When_should_files_be_stored_in_the_database.3F
New URL for the byte type: https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#bytes