1 package DBIx::Class::Schema::Loader::Pg;
4 use base 'DBIx::Class::Schema::Loader::Generic';
10 DBIx::Class::Schema::Loader::Pg - DBIx::Class::Schema::Loader Postgres Implementation.
14 use DBIx::Class::Schema::Loader;
16 # $loader is a DBIx::Class::Schema::Loader::Pg
17 my $loader = DBIx::Class::Schema::Loader->new(
18 dsn => "dbi:Pg:dbname=dbname",
26 See L<DBIx::Class::Schema::Loader>.
31 return qw/DBIx::Class::PK::Auto::Pg/;
36 my $dbh = $self->{_storage}->dbh;
38 # This is split out to avoid version parsing errors...
39 my $is_dbd_pg_gte_131 = ( $DBD::Pg::VERSION >= 1.31 );
40 my @tables = $is_dbd_pg_gte_131 ?
41 $dbh->tables( undef, $self->{_db_schema}, "", "table", { noprefix => 1, pg_noprefix => 1 } )
49 my ( $self, $table ) = @_;
50 my $dbh = $self->{_storage}->dbh;
52 my $sth = $dbh->column_info(undef, $self->{_db_schema}, $table, undef);
53 my @cols = map { $_->[3] } @{ $sth->fetchall_arrayref };
56 my @primary = $dbh->primary_key(undef, $self->{_db_schema}, $table);
60 return ( \@cols, \@primary );
65 L<DBIx::Class::Schema::Loader>