Database Publishing - Last Published Metadata

ryan.griffith's Avatar

ryan.griffith

12 Jan, 2011 04:53 PM

I couldn't find anything on here so I figured I'd throw this out there.

We're playing around with database publishing and I noticed that, when publishing for the first time, the last_published_at and last_published_by columns are not populated; however, once you publish the file again, they are populated. I've only tested this with files at the moment, but I'm assuming the same will be true for folders and pages.

It would be useful if these columns were populated on first publish so results can be ordered by the last_published_at column. Assuming modifying the default database publishing schema wouldn't cause any issues, I can throw in a workaround by defaulting that column to the system date, but figured I'd bring this up anyway. Is this something that has been updated in a newer version (we're on v6.4.6)?

Thanks in advance.

Ryan

  1. 1 Posted by ryan.griffith on 12 Jan, 2011 07:25 PM

    ryan.griffith's Avatar

    I didn't realize that you can't set a default value for DATETIME. So I tried changing the column to a TIMESTAMP and defaulting the value. Works, but seemed to yield inconsistent results.

    Maybe there is some SQL magic that can be done here...

  2. 2 Posted by ryan.griffith on 18 Jan, 2011 03:32 PM

    ryan.griffith's Avatar

    I found a pretty solid workaround by using the IFNULL function to look for a NULL value in the last_published_at column, if NULL is found I'm replacing it with the updated_at value.

    IFNULL(last_published_at, updated_at) last_published_at

  3. Bradley Wagner closed this discussion on 29 Mar, 2012 09:48 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac