Permalink
Browse files

Make the schema's version an object attribute, until needed otherwise.

  • Loading branch information...
1 parent d4e1575 commit 0e0a8ac67995486fd81117e7fb03da5d1ba4edfc Jeffrey Ryan Thalhammer committed May 9, 2012
Showing with 5 additions and 8 deletions.
  1. +1 −1 lib/Pinto/Database.pm
  2. +2 −5 lib/Pinto/Schema.pm
  3. +2 −2 t/09-init.t
View
@@ -153,7 +153,7 @@ sub deploy {
$self->debug( 'Creating database at ' . $self->config->db_file );
$self->schema->deploy;
- my $props = { name => 'pinto:schema-version',
+ my $props = { name => 'pinto:schema_version',
value => $self->schema->version };
$self->schema->resultset('RepositoryProperty')->create($props);
View
@@ -23,20 +23,17 @@ __PACKAGE__->load_namespaces;
#-------------------------------------------------------------------------------
-use MooseX::ClassAttribute;
-
-#-------------------------------------------------------------------------------
-
has logger => (
is => 'rw',
isa => 'Pinto::Logger',
handles => [ qw(debug notice info warning error fatal) ],
);
-class_has version => (
+has version => (
is => 'ro',
isa => 'Int',
+ init_arg => undef,
default => 1,
);
View
@@ -36,8 +36,8 @@ is $pinto->config->sources, 'MySource', 'Got custom source';
#------------------------------------------------------------------------------
# Test repository props
-my $ver = $pinto->repos->get_property('pinto:schema-version');
-is $ver, Pinto::Schema->version, 'Got pinto:schema-version prop';
+my $ver = $pinto->repos->get_property('pinto:schema_version');
+is $ver, $pinto->repos->db->schema->version, 'Got pinto:schema_version prop';
#------------------------------------------------------------------------------

0 comments on commit 0e0a8ac

Please sign in to comment.