I am trying to migrate a relation to my postgres database. The problem is I have no clue what value type to use for an image.
exports.up = function (knex, Promise) => {
return knex.schema.createTable('observations', (table) => {
table.increments();
table.integer('user_id').notNullable();
table.blob('image').notNullable(); //???
table.string('category').notNullable();
table.string('description').notNullable();
table.boolean('approved').notNullable().defaultTo(false);
table.float('latitude').notNullable();
table.float('longitude').notNullable();
table.timestamp('created_at').defaultTo(knex.fn.now());
});
};
I thought there would be a 'blob' file type but in the documentation there seems to be no sign of migrating any media.
Please help me.
Looks like table.binary
should fit the bill.
The PostgreSQL data type should be bytea
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With