isa => 'Bool',
);
+has quiet => (
+ is => 'rw',
+ isa => 'Bool',
+);
+
has '_confirm' => (
is => 'ro',
isa => 'Bool',
# schema is unversioned
die "could not determin current schema version, please either install or deploy";
} else {
- $schema->upgrade();
+ my $ret = $schema->upgrade();
+ return $ret;
}
}
warn "forcing install may not be a good idea";
if($self->confirm() ) {
# FIXME private api
- warn $version;
$self->schema->_set_db_version({ version => $version});
}
}
#die('Do not use the where option with the insert op') if ($where);
#die('Do not use the attrs option with the insert op') if ($attrs);
sub insert_data {
- my ($self, $resultset, $set) = @_;
+ my ($self, $rs, $set) = @_;
+ my $resultset = $self->schema->resultset($rs);
my $obj = $resultset->create( $set );
print ''.ref($resultset).' ID: '.join(',',$obj->id())."\n" if (!$self->quiet);
}
sub confirm {
my ($self) = @_;
- print "Are you sure you want to do this? (type YES to confirm) ";
+ print "Are you sure you want to do this? (type YES to confirm) \n";
# mainly here for testing
return 1 if ($self->_confirm());
my $response = <STDIN>;