1 package DBIx::Class::Schema::Loader::Pg;
4 use base 'DBIx::Class::Schema::Loader::Generic';
9 DBIx::Class::Schema::Loader::Pg - DBIx::Class::Schema::Loader Postgres Implementation.
13 use DBIx::Class::Schema::Loader;
15 # $loader is a DBIx::Class::Schema::Loader::Pg
16 my $loader = DBIx::Class::Schema::Loader->new(
17 dsn => "dbi:Pg:dbname=dbname",
25 See L<DBIx::Class::Schema::Loader>.
30 return qw/DBIx::Class::PK::Auto::Pg/;
35 my $dbh = $class->storage->dbh;
37 # This is split out to avoid version parsing errors...
38 my $is_dbd_pg_gte_131 = ( $DBD::Pg::VERSION >= 1.31 );
39 my @tables = $is_dbd_pg_gte_131 ?
40 $dbh->tables( undef, $class->loader_data->{_db_schema}, "", "table", { noprefix => 1, pg_noprefix => 1 } )
48 my ( $class, $table ) = @_;
49 my $dbh = $class->storage->dbh;
51 my $sth = $dbh->column_info(undef, $class->loader_data->{_db_schema}, $table, undef);
52 my @cols = map { $_->[3] } @{ $sth->fetchall_arrayref };
55 my @primary = $dbh->primary_key(undef, $class->loader_data->{_db_schema}, $table);
59 return ( \@cols, \@primary );
64 L<DBIx::Class::Schema::Loader>