fixed ::Versioned class
[dbsrgits/DBIx-Class-Fixtures.git] / lib / DBIx / Class / Fixtures / Versioned.pm
CommitLineData
9a9a7832 1package DBIx::Class::Fixtures::Versioned;
2
3use strict;
4use warnings;
5
6use base qw/DBIx::Class::Fixtures/;
7use Class::C3;
8
9=head1 VERSION
10
11Version 1.000
12
13=cut
14
15our $VERSION = '1.000';
16
17=head1 NAME
18
9f96b203 19DBIx::Class::Fixtures::Versioned
9a9a7832 20
21=head1 DESCRIPTION
22
9f96b203 23Just ignore it for now, but it will vaguely tie in to DBIx::Class::Schema::Versioned's functionality eventually.
9a9a7832 24
25=cut
26
27sub populate {
28 my $self = shift;
29 my ($params) = @_;
30
31 $self->schema_class("DBIx::Class::Fixtures::SchemaVersioned");
32 unless ($params->{version}) {
9f96b203 33 return DBIx::Class::Exception->throw('You must pass a version to populate');
9a9a7832 34 }
35
36 return $self->next::method(@_);
37}
38
39sub _generate_schema {
40 my $self = shift;
41 my ($params) = @_;
42
9a9a7832 43 # manually set the schema version
9f96b203 44 $DBIx::Class::Fixtures::SchemaVersioned::VERSION = $params->{version};
9a9a7832 45
46 my $schema = $self->next::method(@_);
9f96b203 47 $schema->schema_version($params->{version});
9a9a7832 48
49 # set the db version to the schema version
9f96b203 50 $schema->upgrade(); # set version number
9a9a7832 51
52 return $schema;
53}
54
551;