Hi all I have a strange problem.
When creating a table from my addon's activate() method I get a default value for the first timestamp field.
For example:
Capsule::schema()->create('sample_table', function($table) {
$table->increments('table_id');
$table->integer('age');
$table->string('name', 100);
$table->timestamp('created');
$table->timestamp('updated');
$table->float('amount', 8, 2);
$table->text('description');
});
This creates a table like this:
CREATE TABLE `sample_table` (
`table_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`age` int(11) NOT NULL,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`amount` double(8,2) NOT NULL,
`description` text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`table_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
See default value for "created" and "updated"?
Can someone explain why? Or how should I get it filled by zeros like the other timestamp field?
Thank you