Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

knex.js + pg specify varchar to be > 255

When creating a table in knex migrations, I have indicated a col as such:

table.string("content");

It defaults to varchar 255. I would like it to be able to hold more text. How do I indicate to knex that I want this to occur?

like image 881
kuanb Avatar asked Mar 05 '16 18:03

kuanb


1 Answers

You can define the col in following way to set the length of the string:

    table.string("content", 1000)

This results to:

    content         character varying(1000)

Reference: http://knexjs.org/#Schema-string

like image 61
Sanjeev Kumar Pandit Avatar answered Oct 06 '22 00:10

Sanjeev Kumar Pandit