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",
24 See L<DBIx::Class::Schema::Loader>.
29 return qw/DBIx::Class::PK::Auto::Pg/;
34 my $dbh = $class->storage->dbh;
36 # This is split out to avoid version parsing errors...
37 my $is_dbd_pg_gte_131 = ( $DBD::Pg::VERSION >= 1.31 );
38 my @tables = $is_dbd_pg_gte_131 ?
39 $dbh->tables( undef, $class->loader_data->{_db_schema}, "", "table", { noprefix => 1, pg_noprefix => 1 } )
47 my ( $class, $table ) = @_;
48 my $dbh = $class->storage->dbh;
50 my $sth = $dbh->column_info(undef, $class->loader_data->{_db_schema}, $table, undef);
51 my @cols = map { $_->[3] } @{ $sth->fetchall_arrayref };
54 my @primary = $dbh->primary_key(undef, $class->loader_data->{_db_schema}, $table);
58 return ( \@cols, \@primary );
63 L<DBIx::Class::Schema::Loader>