Hi all, I’m using postgres and prisma and trying t...
# orm-help
d
Hi all, I’m using postgres and prisma and trying to create a model for a User that includes an image for their profile. What would the type of the image be in the model? Is it Bytea? I haven’t seen any examples of this.
j
You could consider hosting the images outside the database on S3 or behind a CDN. Then just have a string type that is the URL of the location for the image
DB storage is usually more expensive than file storage.
But if you really want to, storing it as a BLOB aka Bytes is what you'll need
👍 1
n
I agree with what Jared mentioned, it’s always a good idea to store images on Blob storage like AWS S3 or similar, you should store reference to the image in your database.
d
@Nurul @Jared Fraser Thank you! Really appreciate the response
If I do decide to store it in DB storage (just because it’s only a couple images), do the images have to be converted into base64?
j
They don't have to be but can be, base64 is good for transporting data, but binary should be sufficient for storage, You could test each to see storage/transfer impacts/costs