my $schema = DBICTest->init_schema(
no_deploy=>1,
no_populate=>1,
+ storage_type=>'::DBI::Replicated',
);
This method removes the test SQLite database in t/var/DBIxClass.db
=cut
-sub init_schema {
+sub _database {
my $self = shift;
- my %args = @_;
my $db_file = "t/var/DBIxClass.db";
unlink($db_file) if -e $db_file;
my $dbuser = $ENV{"DBICTEST_DBUSER"} || '';
my $dbpass = $ENV{"DBICTEST_DBPASS"} || '';
- my $compose_method = ($args{compose_connection}
- ? 'compose_connection'
- : 'compose_namespace');
+ my @connect_info = ($dsn, $dbuser, $dbpass, { AutoCommit => 1 });
+
+ return @connect_info;
+}
- my $schema = DBICTest::Schema->$compose_method('DBICTest')
- ->connect($dsn, $dbuser, $dbpass);
- $schema->storage->on_connect_do(['PRAGMA synchronous = OFF']);
+sub init_schema {
+ my $self = shift;
+ my %args = @_;
+
+ my $schema;
+
+ if ($args{compose_connection}) {
+ $schema = DBICTest::Schema->compose_connection(
+ 'DBICTest', $self->_database
+ );
+ } else {
+ $schema = DBICTest::Schema->compose_namespace('DBICTest');
+ }
+ if( $args{storage_type}) {
+ $schema->storage_type($args{storage_type});
+ }
+ if ( !$args{no_connect} ) {
+ $schema = $schema->connect($self->_database);
+ $schema->storage->on_connect_do(['PRAGMA synchronous = OFF']);
+ }
if ( !$args{no_deploy} ) {
__PACKAGE__->deploy_schema( $schema );
__PACKAGE__->populate_schema( $schema ) if( !$args{no_populate} );