Database migrations, add nullable property

Edit: Jump to post #6 Database migrations, add nullable property

Hello,

I’m requesting the ability to add the “nullable” property when creating/changing table columns in the database manager.

For NodeJS projects, this can be achieved by appending .nullable() to the Knex builder, e.g.:

exports.up = function(knex) {
  return knex.schema
    .createTable('users', function (table) {
      table.increments('id');
      table.string('name').nullable();
      table.string('email');
      table.string('password');
    })
};

I haven’t tested how Wappler currently deals with null values, but since it doesn’t offer nullable columns so far I’m assuming it literally writes the string “NULL” instead of an actual NULL value, is this the case? If so, the behaviour would need to be changed to write NULL instead of “NULL” for columns containing a nullable property. As Wappler writes a db.json file containing column properties, it’s possible to check if the column is nullable without the overhead of checking directly with the database server itself.

Community Page
Last updated: