How do you create a TINYINT column with Knex?
In the knex documentation, I only see the option to create an integer or biginteger.
For example, say I have a movies
table with a rating
column to store a movie’s 5 star rating:
// Migration script exports.up = knex => { return knex.schema .createTable('movies', table => { table.uuid('id').primary() ... table.integer('rating') // <-- I want this to be a TINYINT }) }
Is there a way to do this without resorting to a raw SQL query?
You can use specificType
as below:
table.specificType('rating', 'tinyint(1)')