How to create a new field type?

#1

Knex.js has only binary field type to store images.

I want to use the MySQL BLOB type which Knex.js does not have.
But Knex.js says you can create it (if I understand well) using the table.specificType() method:

specificType — table.specificType(name, type)

Sets a specific type for the column creation, if you’d like to add a
column type that isn’t supported here.

I am not sure how to use this.

I tried:

table.specificType('photo', longblog)
table.specificType('photo', "longblog")

But I am getting weird errors.

Any help?

0 Likes

#2

I hust had a typo : blob instead of blog.
Thank you.
Billal Begueradj

0 Likes