Subject: | regression with add_column |
`add_column` used to work in 0.08270, but not anymore in recent versions.
To reproduce
============
1. Prepare database:
#!/bin/sh
pg_ctl init -D var/db
pg_ctl -D var/db start
sleep 3
createdb -e dbictest
psql dbictest <<SQL
create table queue (
id bigserial primary key,
submitted timestamp with time zone default now(),
visible boolean not null default true
);
insert into queue default values;
SQL
2. Install dependencies:
cpanm DBD::Pg DateTime DateTime::Format::Pg \
DBIx::Class::InflateColumn::DateTime DBIx::Class::Schema::Loader
cpanm -l old-dbic DBIx::Class@0.08270
3. Run the program:
use 5.010;
use strict;
use warnings;
# use lib 'old-dbic/lib/perl5';
use DateTime qw();
require DateTime::Format::Pg;
require DBIx::Class::InflateColumn::DateTime;
use DBIx::Class::Schema::Loader qw();
require DBD::Pg;
DBIx::Class::Schema::Loader->loader_options(
components => 'InflateColumn::DateTime',
naming => {ALL => 'preserve'},
);
for my $q (
DBIx::Class::Schema::Loader->connect(
'dbi:Pg:dbname=dbictest',
undef, undef, { pg_enable_utf8 => 1 }
)->resultset('Queue')->search(
{ visible => 1 }, { order_by => 'submitted' }
)->all
) {
$q->add_column('eta');
$q->eta(DateTime->now);
}
say 'survived';
Expected
========
Message "survived". You can see this used to work when you uncomment line 4.
Actual
======
Throws error:
DBIx::Class::Row::get_column(): No such column 'eta' on
DBIx::Class::Schema::Loader::Result::Queue at add-col.pl line 23