DBIx::Class::Schema::Versioned::Inline::Candy - add Candy to result classes
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',
If used in conjunction with DBIx::Class::Candy this component will export:
The equivalent of:
__PACKAGE__->resultset_attributes( { versioned => { since => $version } } );
__PACKAGE__->resultset_attributes( { versioned => { until => $version } } );
__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.
To install DBIx::Class::Schema::Versioned::Inline, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::Class::Schema::Versioned::Inline
CPAN shell
perl -MCPAN -e shell install DBIx::Class::Schema::Versioned::Inline
For more information on module installation, please visit the detailed CPAN module installation guide.