my $rs = $schema->resultset('Lots');
my $lots = $rs->search(
{ bar => undef },
{ '+select' => 'description', '+as' => 'description' },
);
...
$lot->update({ description => '...' });
but after upgrading to DBIx::Class version 0.08123 (from a really old version), it started giving the error
DBIx::Class::Relationship::CascadeActions::update(): No such column description at ...
Since this code runs inside an independent cron job, I can dynamically modify the schema without affecting any of the other scripts or the main website.
my $rs = $schema->resultset('Lots');
$rs->result_source->add_columns('description');
MyApp::Schema::Lots->add_columns('description');
MyApp::Schema::Lots->register_column('description');
my $lots = $rs->search({ bar => undef });
...
$lot->update({ description => '...' });
Since DBIx::Class doesn't support lazily loaded columns, this seems to be the best available workaround at the moment.
0 comments:
Post a Comment