I have a table something like this:
Table: Deal Columns: Id int, deal int[]
Each entry in deal array references some other table id. How can we create the migration for the structure? Also, how can we create array column in knex for postgres.
I have a table something like this:
Table: Deal Columns: Id int, deal int[]
Each entry in deal array references some other table id. How can we create the migration for the structure? Also, how can we create array column in knex for postgres.
You can use the specificType method for that:
knex.schema.createTable('deal', function(t) {
t.increments()
t.specificType('deal', 'INT[]')
})
knex.schema.createTable('deal', function(t)
{
t.increments(),
t.specificType('deal', 'integer ARRAY')
})
One can like this aswell.