Did you try:

sess_time: { type: datetime, defaultExpr: "NOW()" }

You must be using Propel 1.3 for this to work, though.

2008/11/17 [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
>
> Hi Kirill, look what I found out. When I define session table in
> schema.yml like that:
>
>  session:
>    sess_id: { type: VARCHAR, size: '40', required: true, default:
> '' }
>    sess_data: { type: LONGVARCHAR, required: false }
>    sess_time: { type: INTEGER, unsigned:true }
>
> console tells me that I specified autoincrement for column id but
> haven't specified idMethod="native" for table session. But - God sees
> - I don't have id column! Though I have sess_id column - I haven't
> specified autoincrement for it!
>
> OK then, I defined id column with idMethod="native".
>
>  session:
>    _attributes: { idMethod: native }
>    id: { type: INTEGER, required: true, autoIncrement: true,
> primaryKey: true, unsigned:true }
>    sess_id: { type: VARCHAR, size: '40', required: true, default:
> '' }
>    sess_data: { type: LONGVARCHAR, required: false }
>    sess_time: { type: INTEGER, unsigned:true }
>
> It works fine - but once I change type:INTEGER for type: timestamp,
> sqltype:datetime - it all stop work. I don't see any date in my db
> different from 0000-00-00 00:00. So the problem was that I used only
> type: timestamp, sqltype:datetime. I just tried to use type:INTEGER
> instead.
>
> Truly, learning symfony is a lot of fun.
>
>
>
>
> On 17 нояб, 15:21, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>> Hi, Kiril.
>>
>> Yes, I define this table in schema.yml. So I just need to know how to
>> define by default the current time. I've never heard about defaultExpr
>> attribute so I searched - but haven't found almost anything, the first
>> result was this page. Please, tell me if you know how to do it!
>>
>> P.S. Sorry for answering so late - I've been in St. Petersburg. I love
>> this town so much!
>>
>> On 14 нояб, 22:15, "Kiril Angov" <[EMAIL PROTECTED]> wrote:
>>
>> > Are you defining this table in your schema.yml or it is pre-created
>> > and you are just using it for the session storage. Give some more
>> > details and I am sure we will be able to help... and save one life :)
>>
>> > FYI, the default attribute in schema isn't meant to support SQL
>> > functions like CURRENT_TIME. Instead you should use the defaultExpr
>> > attribute.
>>
>> > Kiril
>>
>> > On Fri, Nov 14, 2008 at 8:04 PM, [EMAIL PROTECTED]
>>
>> > <[EMAIL PROTECTED]> wrote:
>>
>> > > Hi guys,
>>
>> > > I have the following problem. I specified a 'sessions' table with some
>> > > fields, one of them is called sess_time. I tried to set it's default
>> > > value as NOW(), i tried CURRENT_TIMESTAMP, with braces and without
>> > > them, with qutations and without them - I tried almost everything one
>> > > can ever imagine -  but it didn't work. Either it was an error in
>> > > console or symfony error: fail to write data in session table. I just
>> > > don't know what to do. I don't want to live anymore.
>>
>>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to