[Catalyst] DB Functions in the Schema

Trevor Phillips trevor.phillips at gmail.com
Mon Aug 17 08:12:58 GMT 2009


Is there an easy way to represent a DB function call as a named column
within a DBIx::Class schema?

eg;

If at the DB level I would do something like:
  select updated, from_unixtime(updated) as updated2 from mytable;
... can I have;

__PACKAGE__->add_columns(
   "updated", { data_type => "TIMESTAMP" }
   "updated2", { something => "from_unixtime(updated)", etc...}
...
);

Thanks.

-- 
Trevor Phillips  - http://dortamur.livejournal.com/
"On nights such as this, evil deeds are done. And good deeds, of
course. But mostly evil, on the whole."
      -- (Terry Pratchett, Wyrd Sisters)



More information about the Catalyst mailing list