Knex pass over db FK constraints
I had before my knexfile.js like this:

    var knex = require('knex')({
    dialect: 'sqlite3',
    connection: {
      filename: './database'
    },
    useNullAsDefault: true
  });


It was needed to activate here the PRAGMA for foreign_keys. To do it change it to:

    var knex = require('knex')({
    dialect: 'sqlite3',
    connection: {
      filename: './database'
    },
    pool: {
      afterCreate: function (conn, cb) {
        conn.run('PRAGMA foreign_keys = ON', cb)
      }
    },
    useNullAsDefault: true
  });