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