sub connection
{
my $self = shift;
- $self->next::method(@_);
+ my $schema = $self->next::method(@_);
# print STDERR join(":", $self->sources), "\n";
$self->_journal_schema->deploy();
$self->_journal_schema->class('ChangeSet')->belongs_to('user', @{$self->journal_user});
$self->_journal_schema->storage->disconnect();
+
+ return $schema;
}
sub get_audit_log_class_name
my $cs = $self->_journal_schema->resultset('ChangeSet');
$self->txn_begin;
- my $changeset = $cs->create({ ( $self->_journal_schema->current_user() ? ( user_id => $self->_journal_schema->current_user()) : () ),
-# user_id => $self->_journal_schema->current_user(),
- session_id => $self->_journal_schema->current_session(),
- });
+ my %changesetdata = ( $self->_journal_schema->current_user() ? ( 'user_id', $self->_journal_schema->current_user()) : () ),
+ ( $self->_journal_schema->current_session() ? ( session_id => $self->_journal_schema->current_session() ) : () );
+ if(!%changesetdata)
+ {
+ %changesetdata = ( ID => undef );
+ }
+ my $changeset = $cs->create({ %changesetdata });
$self->_journal_schema->current_changeset($changeset->ID);
$self->next::method($code);
my $dbuser = $ENV{"DBICTEST_DBUSER"} || '';
my $dbpass = $ENV{"DBICTEST_DBPASS"} || '';
- my $schema = DBICTest::Schema->compose_connection('DBICTest' => $dsn, $dbuser, $dbpass);
+ my $schema;
+ my @connect_info = ($dsn, $dbuser, $dbpass, { AutoCommit => 1 });
+
+ if ($args{compose_connection}) {
+ $schema = DBICTest::Schema->compose_connection(
+ 'DBICTest', @connect_info
+ );
+ } else {
+ $schema = DBICTest::Schema->compose_namespace('DBICTest')
+ ->connect(@connect_info);
+ print STDERR "Created Schema: ", ref($schema), "\n";
+ }
+# my $schema = DBICTest::Schema->compose_connection('DBICTest' => $dsn, $dbuser, $dbpass);
# $schema->storage->on_connect_do(['PRAGMA synchronous = OFF']);
if ( !$args{no_deploy} ) {
__PACKAGE__->deploy_schema( $schema );
my $self = shift;
my $schema = shift;
- if ($ENV{"DBICTEST_SQLT_DEPLOY"}) {
+# if ($ENV{"DBICTEST_SQLT_DEPLOY"}) {
return $schema->deploy();
- } else {
- open IN, "t/lib/sqlite.sql";
- my $sql;
- { local $/ = undef; $sql = <IN>; }
- close IN;
- ($schema->storage->dbh->do($_) || print "Error on SQL: $_\n") for split(/;\n/, $sql);
- }
+# } else {
+# open IN, "t/lib/sqlite.sql";
+# my $sql;
+# { local $/ = undef; $sql = <IN>; }
+# close IN;
+# ($schema->storage->dbh->do($_) || print "Error on SQL: $_\n") for split(/;\n/, $sql);
+# }
}
=head2 populate_schema