I have the following SQL:
CREATE TABLE Documents (
Id INT NOT NULL,
UserId INT NOT NULL,
Label CHARACTER VARYING(220) NOT NULL,
Image BYTEA NOT NULL,
PRIMARY Key(Id),
FOREIGN KEY (UserId) REFERENCES Users(Id)
);
I want to know, How should I have to insert the Base64 image into the table.
The Base64 string comes from a Buffer from after getting the image using the fs module on Node.js.
I'm attempting to insert the image using raw queries of Sequelize, but I have not found proper information on this.
Try this:
insert into table_name (image)
values decode('AcAAFBAO5Az....AQAAAFBCO5gT/AEAABT', 'base64')
Here is some information about decode