fixed versioning stuff to work with new namespace magic
[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/;
6116de11 7use DBIx::Class::Fixtures::SchemaVersioned;
9a9a7832 8use Class::C3;
9
10=head1 VERSION
11
12Version 1.000
13
14=cut
15
16our $VERSION = '1.000';
17
18=head1 NAME
19
9f96b203 20DBIx::Class::Fixtures::Versioned
9a9a7832 21
22=head1 DESCRIPTION
23
9f96b203 24Just ignore it for now, but it will vaguely tie in to DBIx::Class::Schema::Versioned's functionality eventually.
9a9a7832 25
26=cut
27
28sub populate {
29 my $self = shift;
30 my ($params) = @_;
31
32 $self->schema_class("DBIx::Class::Fixtures::SchemaVersioned");
33 unless ($params->{version}) {
9f96b203 34 return DBIx::Class::Exception->throw('You must pass a version to populate');
9a9a7832 35 }
9a9a7832 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(@_);
47
48 # set the db version to the schema version
9f96b203 49 $schema->upgrade(); # set version number
9a9a7832 50 return $schema;
51}
52
531;