Someone familiar with how Bigtop functions able to bring me up to speed?

1 view
Skip to first unread message

Tony Shadwick

unread,
Feb 21, 2011, 3:41:19 PM2/21/11
to Gantry
http://code.google.com/p/gantry/issues/detail?id=4

I'm wanting to set things up so that using bigtop, one can specify a
column to be datetime (or timestamp?), and the default value be
NOW(). That way the user can quickly generated "created" and
"modified" fields. It looks like MySQL has you handle it via on "on
update" trigger. SQLite has more or less native support. Haven't yet
looked at PostgreSQL or DB2.

I've begun looking at Bigtop's sources, but I can't quite get a handle
on where something like this would be introduced. My initial reaction
is to want to add it to the %expansion_for hash, then mess with the
templates to utilize it.

Thoughts?

Tony Shadwick

Phil Crow

unread,
Mar 1, 2011, 4:45:05 PM3/1/11
to gan...@googlegroups.com
Sorry for the delay in my reply.  Your message sifted down my stack and I just remembered it.

You can use any type your database understands as part of an is statement.  The backends have been trained to interpret datetime appropriately for their engine.  You can also include extra phrases on the end of the is statement to provide defaults etc.  These must be valid as you type them.  So, you could do this:

field stamped {
    is datetime, `DEFAULT NOW()`;
}

These comma separated values just become clauses in the column creation, so syntax varies by database.

Phil


--
You received this message because you are subscribed to the Google Groups "Gantry" group.
To post to this group, send email to gan...@googlegroups.com.
To unsubscribe from this group, send email to gantry+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gantry?hl=en.


Reply all
Reply to author
Forward
0 new messages