views:

35

answers:

1

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 would be appreciated. Running Cake 1.3 and MS SQL 2005.

+1  A: 

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.

Jason McCreary