<commit_before>package t::Tools;

# inspired by Test::Fixture::DBIC::Schema

use strict;
use warnings;

use Artemis::Schema::ReportsDB;
use Artemis::Reports::Web;
use Artemis::Config;

my $reportsdb_schema;

sub setup_reportsdb {

        # explicitely prefix into {test} subhash of the config file,
        # to avoid painful mistakes with deploy

        my $dsn = Artemis::Config->subconfig->{test}{database}{ReportsDB}{dsn};

        my ($tmpfname) = $dsn =~ m,dbi:SQLite:dbname=([\w./]+),i;
        unlink $tmpfname;

        $reportsdb_schema = Artemis::Schema::ReportsDB->connect($dsn,
                                                                Artemis::Reports::Web->config->{test}{database}{ReportsDB}{username},
                                                                Artemis::Reports::Web->config->{test}{database}{ReportsDB}{password}
                                                               );
        #$reportsdb_schema->deploy;
}

sub import {
        my $pkg = caller(0);
        no strict 'refs';       ## no critic.
        *{"$pkg\::reportsdb_schema"} = sub () { $reportsdb_schema };
}

setup_reportsdb;

1;
<commit_msg>- more versioning support, requires bleading edge DBIx::Class,   although with features just for us :-)<commit_after>package t::Tools;

# inspired by Test::Fixture::DBIC::Schema

use strict;
use warnings;

use Artemis::Schema::ReportsDB;
use Artemis::Reports::Web;
use Artemis::Config;

my $reportsdb_schema;

sub setup_reportsdb {

        # explicitely prefix into {test} subhash of the config file,
        # to avoid painful mistakes with deploy

        my $dsn = Artemis::Config->subconfig->{test}{database}{ReportsDB}{dsn};

        my ($tmpfname) = $dsn =~ m,dbi:SQLite:dbname=([\w./]+),i;
        unlink $tmpfname;

        $reportsdb_schema = Artemis::Schema::ReportsDB->connect($dsn,
                                                                Artemis::Reports::Web->config->{test}{database}{ReportsDB}{username},
                                                                Artemis::Reports::Web->config->{test}{database}{ReportsDB}{password},
                                                                { ignore_version => 1 }
                                                               );
        $reportsdb_schema->deploy;
        $reportsdb_schema->upgrade;
}

sub import {
        my $pkg = caller(0);
        no strict 'refs';       ## no critic.
        *{"$pkg\::reportsdb_schema"} = sub () { $reportsdb_schema };
}

setup_reportsdb;

1;

{'fraction_non_alphanumeric': 0.13201581027667983, 'fraction_numerical': 0.001976284584980237, 'mean_word_length': 1.9293981481481481, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4244858', 'n_tokens_mistral': 729, 'n_tokens_neox': 681, 'n_words': 143}