Framework: [Proposal] Default values for boolean and timestamp database columns

Created on 18 Feb 2013  路  2Comments  路  Source: laravel/framework

It would be handy if we could set default values for boolean and timestamp columns like this:

$table->boolean('active', true); // Results in a default value of 1.
$table->timestamp('added_on', 'CURRENT_TIMESTAMP');

Perhaps this could be handy for other columns as well, I didn't go over the entire list, I just mentioned these two use cases I encountered up until now.

Most helpful comment

What is wrong with $table->boolean('active')->default(true)? It's much more consistent.

All 2 comments

What is wrong with $table->boolean('active')->default(true)? It's much more consistent.

No, you're right. I missed that one.. Sorry for not thinking of that!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SachinAgarwal1337 picture SachinAgarwal1337  路  3Comments

lzp819739483 picture lzp819739483  路  3Comments

shopblocks picture shopblocks  路  3Comments

PhiloNL picture PhiloNL  路  3Comments

Anahkiasen picture Anahkiasen  路  3Comments