Commit | Line | Data |
c6d74d3e |
1 | package # hide from PAUSE |
2 | DBICTest; |
1c339d71 |
3 | |
4 | use strict; |
5 | use warnings; |
6 | use DBICTest::Schema; |
4b8dcc58 |
7 | use DBICTest::Schema::Relationships; |
1c339d71 |
8 | |
4b8dcc58 |
9 | sub init_schema { |
1c339d71 |
10 | |
11 | my $db_file = "t/var/DBIxClass.db"; |
4b8dcc58 |
12 | |
1c339d71 |
13 | unlink($db_file) if -e $db_file; |
14 | unlink($db_file . "-journal") if -e $db_file . "-journal"; |
15 | mkdir("t/var") unless -d "t/var"; |
4b8dcc58 |
16 | |
e673f011 |
17 | my $dsn = $ENV{"DBICTEST_DSN"} || "dbi:SQLite:${db_file}"; |
18 | my $dbuser = $ENV{"DBICTEST_DBUSER"} || ''; |
19 | my $dbpass = $ENV{"DBICTEST_DBPASS"} || ''; |
20 | |
4b8dcc58 |
21 | my $schema = DBICTest::Schema->compose_connection('DBICTest' => $dsn, $dbuser, $dbpass); |
22 | $schema->deploy(); |
23 | $schema->auto_populate(); |
24 | return $schema; |
25 | |
1c339d71 |
26 | } |
4b8dcc58 |
27 | |
510ca912 |
28 | 1; |