Set default to NULL with laravel migration
I am adding a field to a table in a migration that I wish to allow to be NULL but also I wish for it to default to NULL. What do I place in the default method? I fear that putting "NULL"
in will attempt to place a string of NULL
in which I obviously don't want. Please help :)
Schema::table('item_categories', function(Blueprint $table)
{
$table->integer('parent_item_category_id')->unsigned()->nullable()->default($what_to_put here);
});
When you use the nullable()
method on a field, that field will default to NULL.
$table->integer('parent_item_category_id')->nullable();