开发者

CakePHP created and modified columns for MS SQL

It appears that my automatic CakePHP table columns - created and modified - are causing an error when I migrated to Microsoft SQL Server 2005. I found this old ticket, but nothing that seemed to resolve the issue.

Here is the error:

Warning (512): SQL Error: Conversion failed when converting datetime from character string.
[CORE/cake/libs/model/datasources/dbo_source.php, line 673]

[main] - APP/webroot/index.php, line 83

Query: INSERT INTO [user_log] ([created], [user_id]) VALUES ('NULL', 1)

This is my schema:

created datetime NULL CONSTRAINT [DF_user_log_created] DEFAULT (NULL),

I also tried:

created datetime NULL,

Any direction开发者_Go百科 would be appreciated. Running Cake 1.3 and MS SQL 2005.


Looks like I was indeed mistaken. I reread the old ticket and even though I had tried both column schema definitions, I forgot to flush the model cache in tmp/

So for clarity and in case anyone else makes my same mistake:

created datetime NULL,
modified datetime NULL,

Are the appropriate column definitions for MS SQL, and be sure to flush your model cache.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜