changed FileColumn to InflateColumn::File
[dbsrgits/DBIx-Class.git] / t / bindtype_columns.t
CommitLineData
6e399b4f 1use strict;
2use warnings;
3
4use Test::More;
5use lib qw(t/lib);
6use DBICTest;
7
9fdf90df 8my ($dsn, $dbuser, $dbpass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/};
6e399b4f 9
9fdf90df 10$dsn = 'dbi:Pg:dbname=postgres;host=localhost' unless $dsn;
11$dbuser = 'postgres' unless $dbuser;
12$dbpass = 'postgres' unless $dbpass;
6e399b4f 13
9fdf90df 14plan skip_all => 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test'
15 unless ($dsn && $dbuser);
16
17plan tests => 3;
18
19DBICTest::Schema->compose_connection('PGTest' => $dsn, $dbuser, $dbpass);
20
21my $dbh = PGTest->schema->storage->dbh;
22
23$dbh->do(qq[
24
25 CREATE TABLE artist
26 (
27 artistid serial NOT NULL PRIMARY KEY,
28 media bytea NOT NULL,
29 name varchar NULL
30 );
31],{ RaiseError => 1, PrintError => 1 });
32
33
34PGTest::Artist->load_components(qw/
35
36 PK::Auto
37 Core
38/);
39
40PGTest::Artist->add_columns(
6e399b4f 41
9fdf90df 42 "media", {
6e399b4f 43
9fdf90df 44 data_type => "bytea",
7036ea60 45 is_nullable => 0,
9fdf90df 46 },
47);
48
49# test primary key handling
50my $big_long_string = 'abcd' x 250000;
51
52my $new = PGTest::Artist->create({ media => $big_long_string });
53
54ok($new->artistid, "Created a blob row");
55is($new->media, $big_long_string, "Set the blob correctly.");
56
57my $rs = PGTest::Artist->find({artistid=>$new->artistid});
58
59is($rs->get_column('media'), $big_long_string, "Created the blob correctly.");
60
61$dbh->do("DROP TABLE artist");
62
63
6e399b4f 64