Friday, August 7, 2009

Invalid default value for 'logTime'

Process of database restoration using the following SQL query :

CREATE TABLE `smf_log_online` (
SESSION varchar( 32 ) NOT NULL default '',
logTime timestamp default 'CURRENT_TIMESTAMP' ,
ID_MEMBER mediumint( 8 ) unsigned NOT NULL default 0,
ip int( 10 ) unsigned NOT NULL default 0,
url text NOT NULL default '',
PRIMARY KEY ( SESSION ) ,
KEY logTime( logTime ) ,
KEY ID_MEMBER( ID_MEMBER )
) TYPE = MYISAM


There is a massive problem occur, The following message:

" #1067 - Invalid default value for 'logTime' "


For this problem you need to change SQL statement to get it to work following:

remove '' from '
CURRENT_TIMESTAMP' ..

CREATE TABLE `smf_log_online` (
SESSION varchar( 32 ) NOT NULL default '',
logTime timestamp default CURRENT_TIMESTAMP ,
ID_MEMBER mediumint( 8 ) unsigned NOT NULL default 0,
ip int( 10 ) unsigned NOT NULL default 0,
url text NOT NULL default '',
PRIMARY KEY ( SESSION ) ,
KEY logTime( logTime ) ,
KEY ID_MEMBER( ID_MEMBER )
) TYPE = MYISAM


No comments: