forked from GNUsocial/gnu-social
Database fields with timestamp type now allow CURRENT_TIMESTAMP to be set as default value
Add default values to created and modified columns of Profile_list table to fix issue #338
This commit is contained in:
parent
b3c3af1ef6
commit
9a39ebe66f
@ -48,8 +48,8 @@ class Profile_list extends Managed_DataObject
|
|||||||
'description' => array('type' => 'text', 'description' => 'description of the people tag'),
|
'description' => array('type' => 'text', 'description' => 'description of the people tag'),
|
||||||
'private' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'is this tag private'),
|
'private' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'is this tag private'),
|
||||||
|
|
||||||
'created' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date the tag was added'),
|
'created' => array('type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date the tag was added'),
|
||||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date the tag was modified'),
|
'modified' => array('type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date the tag was modified'),
|
||||||
|
|
||||||
'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'),
|
'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'),
|
||||||
'mainpage' => array('type' => 'varchar', 'length' => 191, 'description' => 'page to link to'),
|
'mainpage' => array('type' => 'varchar', 'length' => 191, 'description' => 'page to link to'),
|
||||||
|
@ -790,7 +790,7 @@ class Schema
|
|||||||
|
|
||||||
function quoteDefaultValue($cd)
|
function quoteDefaultValue($cd)
|
||||||
{
|
{
|
||||||
if ($cd['type'] == 'datetime' && $cd['default'] == 'CURRENT_TIMESTAMP') {
|
if (($cd['type'] == 'datetime' || $cd['type'] == 'timestamp') && $cd['default'] == 'CURRENT_TIMESTAMP') {
|
||||||
return $cd['default'];
|
return $cd['default'];
|
||||||
} else {
|
} else {
|
||||||
return $this->quoteValue($cd['default']);
|
return $this->quoteValue($cd['default']);
|
||||||
|
Loading…
Reference in New Issue
Block a user