Commit | Line | Data |
5d567302 |
1 | use lib qw(lib t/lib); |
2 | use DBICTest::Schema; |
3 | |
4 | use Test::More; |
5 | |
6 | my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/}; |
7 | |
cba994a1 |
8 | #warn "$dsn $user $pass"; |
5d567302 |
9 | |
10 | plan skip_all, 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test' |
11 | unless ($dsn && $user); |
12 | |
13 | plan tests => 1; |
14 | |
15 | DBICTest::Schema->compose_connection('PgTest' => $dsn, $user, $pass); |
16 | |
17 | my $dbh = PgTest::Artist->storage->dbh; |
18 | |
19 | eval { |
20 | $dbh->do("DROP TABLE artist;"); |
21 | }; |
22 | |
23 | $dbh->do("CREATE TABLE artist (artistid serial PRIMARY KEY, name VARCHAR(255));"); |
24 | |
25 | PgTest::Artist->load_components('PK::Auto::Pg'); |
26 | |
27 | my $new = PgTest::Artist->create({ name => 'foo' }); |
28 | |
29 | ok($new->artistid, "Auto-PK worked"); |
30 | |
31 | 1; |