phinx icon indicating copy to clipboard operation
phinx copied to clipboard

Add a Phinx\Db\Table::addTimestamps() method

Open robmorgan opened this issue 13 years ago • 2 comments

This method should automatically create two datetime columns: created_at and updated_at.

Call the following code:

$table->addColumn('created', 'datetime')
$table->addColumn('updated', 'datetime', array('null' => true, 'default' => null))

robmorgan avatar Jan 23 '13 04:01 robmorgan

Maybe use the CURRENT_TIMESTAMP support I added here: https://github.com/robmorgan/phinx/pull/68 I find having the date fields automatically updating saves excess code :)

valorin avatar Apr 19 '13 01:04 valorin

Names of columns should be configurable in phinx.yml, default values: created_at and updated_at

czogori avatar Jun 01 '13 22:06 czogori