NAME
DBIx::Class::Schema::Versioned::Inline::Candy - add Candy to result classes
SYNOPSIS
package MyApp::Schema::Candy;
use base 'DBIx::Class::Candy';
sub base { $_[1] || 'DBIx::Class::Core' }
sub autotable { 1 }
sub parse_arguments {
my $self = shift;
my $args = $self->next::method(@_);
push @{$args->{components}}, 'Schema::Versioned::Inline::Candy';
return $args;
}
...
package MyApp::Schema::Result::Foo;
use MyApp::Schema::Candy -components => ['SomeExtraComponent'];
since '0.2',
renamed_from 'Bar';
column age =>
{ data_type => "integer", is_nullable => 1, till => '0.7' };
...
package MyApp::Schema::Result::Bar;
use MyApp::Schema::Candy -components => ['SomeExtraComponent'];
till '0.2',
CANDY EXPORTS
If used in conjunction with DBIx::Class::Candy this component will export:
since $version
The equivalent of:
__PACKAGE__->resultset_attributes(
{ versioned => { since => $version } } );
till $version
The equivalent of:
__PACKAGE__->resultset_attributes(
{ versioned => { until => $version } } );
renamed_from $old_class
The equivalent of:
__PACKAGE__->resultset_attributes(
{ versioned =>
{ since => $version, renamed_from => $old_table }
});
NOTE: when using the Candy version of "renamed_from" the argument can be the name of the resultset class (actually the source_name) rather than the old table name so the following would be equivalent:
__PACKAGE__->resultset_attributes(
{ versioned =>
{ since => '1.4', renamed_from => 'foos' }
});
since '1.4';
renamed_from 'Foo';
The reasoning here is that if you user autotables => 1 then you might not know the old table name.