DBIC note to self...
There's an interesting interaction between PostgreSQL, DBIx::Class::Schema::Loader and DBIx::Class:InflateColumn::DateTime.
When you define a column to be of type TIMESTAMP, it actually becomes a TIMESTAMP WITHOUT TIME ZONE. DBIx::Class::Schema::Loader just copies this into the DBIC data_type field without translation, and so when DBIx::Class::InflateColumn::DateTime comes along, it doesn't realise it's a time value and doesn't bother to add the inflater.
This awful kludge hooks register_column and changes the data_type field to "timestamp", thus making it all work as expected.
(code after the cut)
When you define a column to be of type TIMESTAMP, it actually becomes a TIMESTAMP WITHOUT TIME ZONE. DBIx::Class::Schema::Loader just copies this into the DBIC data_type field without translation, and so when DBIx::Class::InflateColumn::DateTime comes along, it doesn't realise it's a time value and doesn't bother to add the inflater.
This awful kludge hooks register_column and changes the data_type field to "timestamp", thus making it all work as expected.
(code after the cut)
package DBIx::Class::InflateColumn::PgDateTimeTZKludge;
use Moose;
extends qw/DBIx::Class/;
# This DBIC component is added to the DBIC loader_options *just after*
# InflateColumn::DateTime - it's chained so it's actually run *first* - and
# it will change "timestamp without time zone" columns to "timestamp" so
# that InflateColumn realises they are timestamp types and adds its
# inflater/deflater.
sub register_column {
my ($self, $column, $info, @rest) = @_;
$self->next::method($column, $info, @rest);
return unless defined($info->{data_type});
my $type = lc $info->{data_type};
if($type eq 'timestamp without time zone') {
$info->{data_type} = 'timestamp';
} # elsif etc
}